-
Notifications
You must be signed in to change notification settings - Fork 541
/
Copy pathdocker-compose.yml
223 lines (209 loc) Β· 6.58 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
x-env-mapping: &env
# https://docs.docker.com/compose/environment-variables/envvars-precedence/
env_file:
- .env
environment:
- CELERY_BROKER_URL=amqp://olympia:olympia@rabbitmq/olympia
- CELERY_RESULT_BACKEND=redis://redis:6379/1
- DATABASES_DEFAULT_URL=mysql://root:@mysqld/olympia
- ELASTICSEARCH_LOCATION=elasticsearch:9200
- MEMCACHE_LOCATION=memcached:11211
- MYSQL_DATABASE=olympia
- MYSQL_ROOT_PASSWORD=docker
- SITE_URL=http://olympia.test
- PYTHONDONTWRITEBYTECODE=1
- PYTHONUNBUFFERED=1
- PYTHONBREAKPOINT=ipdb.set_trace
- TERM=xterm-256color
- HISTFILE=/data/olympia/docker/artifacts/bash_history
- HISTSIZE=50000
- HISTIGNORE=ls:exit:"cd .."
- HISTCONTROL=erasedups
- ENV=local
- SWAGGER_UI_ENABLED=true
- CIRCLECI
- SKIP_DATA_SEED
- FXA_CLIENT_ID
- FXA_CLIENT_SECRET
- STATIC_URL_PREFIX
- MEDIA_URL_PREFIX
x-olympia: &olympia
<<: *env
image: ${DOCKER_TAG:-}
# We don't want docker compose to manage the image for us.
# We sometimes build the image locally and sometimes pull from a registry
# but docker compose should always assume the image is available.
pull_policy: never
# We drop down to a different user through entrypoint.sh, but starting as
# root allows us to fix the ownership of files generated at image build
# time through the ./docker/entrypoint.sh script.
user: root
platform: linux/amd64
entrypoint: ["/data/olympia/docker/entrypoint.sh"]
services:
static:
<<: *olympia
ports:
- "5173:5173"
volumes:
- ./:/data/olympia
- ./deps:/data/olympia/deps
command: make run_vite
worker:
<<: *olympia
command: [
"DJANGO_SETTINGS_MODULE=settings",
"watchmedo",
"auto-restart",
"--directory=/data/olympia/src",
"--pattern=*.py",
"--recursive",
"--no-restart-on-command-exit",
"--",
"celery -A olympia.amo.celery:app worker -E -c 2 --loglevel=INFO",
]
volumes:
- ./:/data/olympia
extra_hosts:
- "olympia.test:127.0.0.1"
restart: on-failure:5
healthcheck:
test: ["CMD-SHELL", "./manage.py monitors --services celery_worker --skip-checks"]
interval: 30s
retries: 3
start_interval: 1s
depends_on:
- mysqld
- elasticsearch
- redis
- memcached
- rabbitmq
- autograph
web:
extends:
service: worker
command:
- DJANGO_SETTINGS_MODULE=settings uwsgi --ini /data/olympia/docker/uwsgi.ini
healthcheck:
test: ["CMD-SHELL", "./manage.py monitors --services localdev_web --skip-checks"]
interval: 30s
retries: 3
start_interval: 1s
nginx:
image: nginx:1.27-bookworm@sha256:124b44bfc9ccd1f3cedf4b592d4d1e8bddb78b51ec2ed5056c52d3692baebc19
<<: *env
volumes:
- data_nginx:/etc/nginx/templates
- ./:/srv
ports:
- "80:80"
networks:
default:
aliases:
- olympia.test
depends_on:
- web
memcached:
image: memcached:1.5.16@sha256:9258aa018bce5300ba3548aba19e95612508b43e6587462c6e22b5ac6a35d5a9
mysqld:
image: mysql:8.0@sha256:bf577825b52ab281d6281fb281eabbfdc73507eda8f2c2745790251533ef0306
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
- MYSQL_DATABASE=olympia
ports:
- "3306:3306"
volumes:
- data_mysqld:/var/lib/mysql
command:
# Optimize for development speed over durability
- --innodb-flush-log-at-trx-commit=0
- --innodb-buffer-pool-size=64M
- --innodb-log-buffer-size=8M
- --innodb-log-file-size=32M
# Skip DNS lookups
- --skip-name-resolve
# Disable performance schema for faster startup
- --performance-schema=OFF
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "--silent"]
start_interval: 1s
timeout: 2s
start_period: 10s
retries: 3
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.27@sha256:e3db87aef5d115408b36e3d5bbd309629100597462910d6b5efec70fcfead22a
environment:
# Disable all xpack related features to avoid unrelated logging
# in docker logs. https://github.com/mozilla/addons-server/issues/8887
# This also avoids us to require authentication for local development
# which simplifies the setup.
- xpack.security.enabled=false
- xpack.monitoring.enabled=false
- xpack.graph.enabled=false
- xpack.watcher.enabled=false
- "discovery.type=single-node"
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
mem_limit: 2g
redis:
image: redis:6.2-bookworm@sha256:c628c49a6ce4a68bfbd548d7957d3d52b2267a4cd4b4a16779a1ca0cd1126527
volumes:
- data_redis:/data
rabbitmq:
image: rabbitmq:3.12@sha256:4dc5d5a5076f7c458b7f3468e2282f329a8911cc3c31c4ed4aefcedb27917da2
hostname: olympia
expose:
- "5672"
environment:
- RABBITMQ_DEFAULT_USER=olympia
- RABBITMQ_DEFAULT_PASS=olympia
- RABBITMQ_DEFAULT_VHOST=olympia
volumes:
- data_rabbitmq:/var/lib/rabbitmq
autograph:
image: mozilla/autograph:7.3.6@sha256:abbd38f0969b86fca2266570870087c15db91204533b893cc2a948c422ed3424
command: /go/bin/autograph -c /data/autograph/autograph_localdev_config.yaml
volumes:
- data_autograph:/data/autograph
addons-frontend:
<<: *env
image: mozilla/addons-frontend:2025.03.20-1@sha256:32b1c20b6678df73df4ac81c19cbb74bfe5a062a7e39273efba626d0347e8019
platform: linux/amd64
environment:
# We change the proxy port (which is the main entrypoint) as well as the
# webpack port to avoid a conflict in case someone runs both addons-server
# and addons-frontend locally, with the frontend configured to access
# addons-server locally.
- PROXY_PORT=7010
- WEBPACK_SERVER_PORT=7011
ports:
# We need to expose this port so that statics can be fetched (they are
# exposed using webpack and not by the node app server).
- 7011:7011
command: yarn amo:olympia
networks:
default:
driver: bridge
enable_ipv6: false
volumes:
# Volume for rabbitmq/redis to avoid anonymous volumes
data_rabbitmq:
data_redis:
data_mysqld:
# Keep this value in sync with Makefile-os
# External volumes must be manually created/destroyed
name: addons-server_data_mysqld
external: true
# Volume for nginx configuration
data_nginx:
driver: local
driver_opts:
type: none
o: bind
device: ${PWD}/docker/nginx
# Volume for autograph configuration
data_autograph:
driver: local
driver_opts:
type: none
o: bind
device: ${PWD}/docker/autograph