-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
162 lines (151 loc) · 3.53 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
version: '3'
services:
app:
container_name: "app"
restart: always
build: ./app/
ports:
- "4444:4444"
- "8000:8000"
expose:
- "8000"
links:
- postgres:postgres
- redis:redis
- elasticsearch:elasticsearch
- smtp:smtp
env_file:
- .env
environment:
- DATABASE_URL=postgresql+psycopg2://${DB_USER}:${DB_PASS}@${DB_SERVICE}:5432/${DB_NAME}
volumes:
- ./app:/data/app
working_dir: /data/app
command: ["sh", "./wait-for-postgres.sh", "postgres://${DB_USER}:${DB_PASS}@${DB_SERVICE}:5432/${DB_NAME}", "gunicorn", "microblog:app", "-w", "2", "-b", ":8000"]
depends_on:
- app-migration
- app-translation
- postgres
- rq-worker
- elasticsearch
- redis
app-migration:
container_name: "app-migration"
restart: on-failure
build: ./app/
links:
- postgres:postgres
env_file:
- .env
environment:
- DATABASE_URL=postgresql+psycopg2://${DB_USER}:${DB_PASS}@${DB_SERVICE}:5432/${DB_NAME}
volumes:
- ./app:/data/app
working_dir: /data/app
command: flask db upgrade
depends_on:
- postgres
app-translation:
container_name: "app-translation"
restart: on-failure
build: ./app/
env_file:
- .env
volumes:
- ./app:/data/app
working_dir: /data/app
command: flask translate compile
app-testing:
container_name: "app-testing"
restart: always
build: ./app/
links:
- postgres:postgres
env_file:
- .env
environment:
- ENV_TYPE=TESTING
- DATABASE_URL_TESTING=postgresql+psycopg2://${DB_USER_TESTING}:${DB_PASS_TESTING}@${DB_SERVICE_TESTING}:5432/${DB_NAME_TESTING}
volumes:
- ./app:/data/app
working_dir: /data/app
command: tail -f /dev/null
depends_on:
- postgres
rq-worker:
container_name: "rq-worker"
restart: always
build: ./app/
ports:
- "4445:4445"
links:
- redis:redis
- postgres:postgres
- elasticsearch:elasticsearch
- smtp:smtp
env_file:
- .env
environment:
- DATABASE_URL=postgresql+psycopg2://${DB_USER}:${DB_PASS}@${DB_SERVICE}:5432/${DB_NAME}
- FLASK_DEBUG=0
volumes:
- ./app:/data/app
command: rq worker microblog-tasks -u ${REDIS_URL}
depends_on:
- redis
- elasticsearch
- postgres
nginx:
container_name: "nginx"
restart: always
build: ./nginx/
ports:
- "80:80"
volumes:
- ./app:/data/app
links:
- app:app
depends_on:
- app
- postgres
- app-migration
postgres:
container_name: "postgres"
restart: always
image: postgres:9.6
volumes:
- ./postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
- db:/var/lib/postgresql
env_file:
- .env
elasticsearch:
container_name: "elasticsearch"
image: docker.elastic.co/elasticsearch/elasticsearch:6.2.1
container_name: elasticsearch
environment:
- cluster.name=flask-mt
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- elasticsearch:/usr/share/elasticsearch/data
ports:
- 9200:9200
redis:
container_name: "redis"
restart: always
image: redis:latest
ports:
- 6379:6379
smtp:
container_name: "smtp"
image: python:3.7
expose:
- "25"
command: python -m smtpd -n -c DebuggingServer 0.0.0.0:25
volumes:
elasticsearch:
db: