-
Notifications
You must be signed in to change notification settings - Fork 15
/
docker-compose.yml
231 lines (216 loc) · 6.27 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
---
services:
# Base container is used for development tasks like tests, linting,
# and building docs.
base:
build:
context: .
dockerfile: docker/Dockerfile
args:
userid: ${USE_UID:-10001}
groupid: ${USE_GID:-10001}
image: tecken:build
env_file:
- docker/config/local_dev.env
- .env
# Web container is a prod-like fully-functioning container.
web:
extends:
service: base
ports:
- "${EXPOSE_TECKEN_PORT:-8000}:8000"
depends_on:
db: &condition_service_healthy
condition: service_healthy
fakesentry: *condition_service_healthy
gcs-emulator: *condition_service_healthy
redis-cache: *condition_service_healthy
localstack: *condition_service_healthy
oidcprovider: *condition_service_healthy
statsd: *condition_service_healthy
volumes:
- $PWD:/app
command: ["web", "--dev"]
# Container specifically for running tests.
test-ci:
extends:
service: base
env_file:
- docker/config/local_dev.env
- docker/config/test.env
depends_on:
db: *condition_service_healthy
gcs-emulator: *condition_service_healthy
fakesentry: *condition_service_healthy
redis-cache: *condition_service_healthy
localstack: *condition_service_healthy
oidcprovider: *condition_service_healthy
statsd: *condition_service_healthy
# TODO(2024-01-30): This configuration can be simplified using `extends: test-ci` once the fix for
# https://github.com/docker/compose/issues/11413 is available in all relevant environments.
test:
extends:
service: base
env_file:
- docker/config/local_dev.env
- docker/config/test.env
depends_on:
db: *condition_service_healthy
gcs-emulator: *condition_service_healthy
fakesentry: *condition_service_healthy
redis-cache: *condition_service_healthy
localstack: *condition_service_healthy
oidcprovider: *condition_service_healthy
statsd: *condition_service_healthy
volumes:
- $PWD:/app
# Dev container https://containers.dev/, e.g. for VS Code
devcontainer:
extends:
service: base
build:
dockerfile: .devcontainer/Dockerfile
args:
userid: ${USE_UID:-10001}
groupid: ${USE_GID:-10001}
image: tecken-devcontainer
entrypoint: ["sleep", "inf"]
stop_signal: SIGKILL # Doesn't seem to respond to anything else
env_file:
- docker/config/local_dev.env
- docker/config/test.env
depends_on:
db: *condition_service_healthy
gcs-emulator: *condition_service_healthy
fakesentry: *condition_service_healthy
redis-cache: *condition_service_healthy
localstack: *condition_service_healthy
oidcprovider: *condition_service_healthy
statsd: *condition_service_healthy
volumes:
- $PWD:/app
# Web container is a prod-like fully-functioning container.
gunicorn:
extends:
service: base
ports:
- "${EXPOSE_TECKEN_PORT:-8000}:8000"
depends_on:
db: *condition_service_healthy
redis-cache: *condition_service_healthy
command: web
# Same as 'frontend' but no volumes or command
frontend-ci:
build:
context: .
dockerfile: frontend/Dockerfile
args:
userid: ${USE_UID:-10001}
groupid: ${USE_GID:-10001}
frontend:
extends:
frontend-ci
environment:
- NODE_ENV=development
ports:
- "3000:3000"
- "35729:35729"
volumes:
- $PWD/frontend:/app
command: start
# https://hub.docker.com/_/postgres/
db:
image: postgres:12.7
environment:
# Create the superuser account
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=tecken
healthcheck:
test: ["CMD", "pg_isready"]
interval: 1s
timeout: 3s
retries: 5
# https://hub.docker.com/_/redis
# This is the version we run in production
redis-cache:
image: redis:6.2.6
healthcheck:
test: ["CMD-SHELL", '[ "$(redis-cli ping)" = "PONG" ]']
interval: 1s
timeout: 3s
retries: 5
# https://github.com/fsouza/fake-gcs-server
# Fake GCP GCS server for local development and testing
gcs-emulator:
build:
context: docker/images/gcs-emulator
image: local/tecken_gcs_emulator
command: >-
-port 8001
-scheme http
-external-url http://gcs-emulator:8001
-public-host gcs-emulator:8001
ports:
- "${EXPOSE_GCS_EMULATOR_PORT:-8001}:8001"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8001/storage/v1/b"]
interval: 1s
timeout: 3s
retries: 5
depends_on:
- gcs-cdn
# nginx as a reverse proxy simulating a CDN in front of the GCS emulator.
gcs-cdn:
build:
context: docker/images/gcs-cdn
image: local/tecken_gcs_cdn
ports:
- "${EXPOSE_CDN_PORT:-8002}:8002"
# https://hub.docker.com/r/localstack/localstack/
# localstack running a fake AWS S3
localstack:
image: localstack/localstack:2.2.0
environment:
- LOCALSTACK_HOST=localstack
ports:
- "${EXPOSE_LOCALSTACK_PORT:-4566}:4566"
# https://github.com/willkg/kent
fakesentry:
build:
context: docker/images/fakesentry
image: local/tecken_fakesentry
ports:
- "${EXPOSE_SENTRY_PORT:-8090}:8090"
command: run --host 0.0.0.0 --port 8090
stop_signal: SIGINT
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8090/"]
interval: 1s
timeout: 3s
retries: 5
# https://hub.docker.com/r/mozilla/oidc-testprovider
oidcprovider:
build:
context: docker/images/oidcprovider
image: local/tecken_oidcprovider
ports:
- "${EXPOSE_OIDC_PORT:-8080}:8080"
# The next line can be removed if this PR is included in the image we use:
# https://github.com/mozilla/docker-test-mozilla-django-oidc/pull/84
stop_signal: SIGKILL
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/"]
interval: 2s
timeout: 5s
retries: 10
# https://hub.docker.com/r/hopsoft/graphite-statsd/
statsd:
image: hopsoft/graphite-statsd:latest
ports:
- "${EXPOSE_GRAFANA_PORT:-8081}:80"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/"]
interval: 1s
timeout: 3s
retries: 5