-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
176 lines (166 loc) · 5.05 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
version: "3.3"
services:
proxy:
image: traefik:v1.7
networks:
- ${TRAEFIK_PUBLIC_NETWORK}
- default
ports:
- "80:80"
- "8090:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: --docker \
--docker.watch \
--docker.exposedbydefault=false \
--constraints=tag==${TRAEFIK_TAG} \
--logLevel=INFO \
--accessLog \
--web
deploy:
placement:
constraints:
- node.role == manager
labels:
# For the configured domain
- traefik.frontend.rule=Host:${DOMAIN}
# For a domain with and without 'www'
# Comment the previous line above and un-comment the line below
# - "traefik.frontend.rule=Host:www.${DOMAIN},${DOMAIN}"
- traefik.enable=true
- traefik.port=80
- traefik.tags=${TRAEFIK_PUBLIC_TAG}
- traefik.docker.network=${TRAEFIK_PUBLIC_NETWORK}
- traefik.frontend.entryPoints=http,https
- traefik.frontend.redirect.entryPoint=https
# Uncomment the config line below to detect and redirect www to non-www (or the contrary)
# The lines above for traefik.frontend.rule are needed too
# - "traefik.frontend.redirect.regex=^https?://(www.)?(${DOMAIN})/(.*)"
# To redirect from non-www to www un-comment the line below
# - "traefik.frontend.redirect.replacement=https://www.${DOMAIN}/$$3"
# To redirect from www to non-www un-comment the line below
# - "traefik.frontend.redirect.replacement=https://${DOMAIN}/$$3"
db:
image: postgres:12
volumes:
- app-db-data:/var/lib/postgresql/data/pgdata
env_file:
- .env
environment:
- PGDATA=/var/lib/postgresql/data/pgdata
deploy:
placement:
constraints:
- node.labels.${STACK_NAME}.app-db-data == true
pgadmin:
image: dpage/pgadmin4
networks:
- ${TRAEFIK_PUBLIC_NETWORK}
- default
depends_on:
- db
env_file:
- .env
deploy:
labels:
- traefik.frontend.rule=Host:pgadmin.${DOMAIN}
- traefik.enable=true
- traefik.port=5050
- traefik.tags=${TRAEFIK_PUBLIC_TAG}
- traefik.docker.network=${TRAEFIK_PUBLIC_NETWORK}
- traefik.frontend.entryPoints=http,https
- traefik.frontend.redirect.entryPoint=https
queue:
image: rabbitmq:3
# Using the below image instead is required to enable the "Broker" tab in the flower UI:
# image: rabbitmq:3-management
#
# You also have to change the flower command
flower:
image: mher/flower
networks:
- ${TRAEFIK_PUBLIC_NETWORK}
- default
env_file:
- .env
command:
- "--broker=amqp://guest@queue:5672//"
# For the "Broker" tab to work in the flower UI, uncomment the following command argument,
# and change the queue service's image as well
# - "--broker_api=http://guest:guest@queue:15672/api//"
deploy:
labels:
- traefik.frontend.rule=Host:flower.${DOMAIN}
- traefik.enable=true
- traefik.port=5555
- traefik.tags=${TRAEFIK_PUBLIC_TAG}
- traefik.docker.network=${TRAEFIK_PUBLIC_NETWORK}
- traefik.frontend.entryPoints=http,https
- traefik.frontend.redirect.entryPoint=https
backend:
image: '${DOCKER_IMAGE_BACKEND}:${TAG-latest}'
depends_on:
- db
env_file:
- .env
environment:
- SERVER_NAME=${DOMAIN}
- SERVER_HOST=https://${DOMAIN}
# Allow explicit env var override for tests
- SMTP_HOST=${SMTP_HOST}
build:
context: ./backend
dockerfile: backend.dockerfile
args:
INSTALL_DEV: ${INSTALL_DEV-false}
# labels:
# - traefik.frontend.rule=PathPrefix:/api,/docs,/redoc
# - traefik.enable=true
# - traefik.port=80
# - traefik.tags=${TRAEFIK_TAG}
# deploy:
# labels:
# - traefik.frontend.rule=PathPrefix:/api,/docs,/redoc
# - traefik.enable=true
# - traefik.port=80
# - traefik.tags=${TRAEFIK_TAG}
celeryworker:
image: '${DOCKER_IMAGE_CELERYWORKER}:${TAG-latest}'
depends_on:
- db
- queue
env_file:
- .env
environment:
- SERVER_NAME=${DOMAIN}
- SERVER_HOST=https://${DOMAIN}
# Allow explicit env var override for tests
- SMTP_HOST=${SMTP_HOST}
build:
context: ./backend
dockerfile: celeryworker.dockerfile
args:
INSTALL_DEV: ${INSTALL_DEV-false}
frontend:
image: '${DOCKER_IMAGE_FRONTEND}:${TAG-latest}'
build:
context: ./frontend
args:
FRONTEND_ENV: ${FRONTEND_ENV-production}
# labels:
# - traefik.frontend.rule=PathPrefix:/
# - traefik.enable=true
# - traefik.port=80
# - traefik.tags=${TRAEFIK_TAG}
# deploy:
# labels:
# - traefik.frontend.rule=PathPrefix:/
# - traefik.enable=true
# - traefik.port=80
# - traefik.tags=${TRAEFIK_TAG}
volumes:
app-db-data:
networks:
traefik-public:
# Allow setting it to false for testing
external: ${TRAEFIK_PUBLIC_NETWORK_IS_EXTERNAL-false}