This repository has been archived by the owner on May 13, 2021. It is now read-only.
forked from mdn/kuma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
169 lines (158 loc) · 5.37 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
version: '2.1'
services:
worker: &worker
build:
context: .
dockerfile: docker/images/kuma_base/Dockerfile
image: mdnwebdocs/kuma_base
command: ./scripts/start-worker
user: ${UID:-1000}
volumes:
- ./:/app:z
depends_on:
- mysql
- redis
- kumascript
- minio
environment:
# Django settings overrides:
- ACCOUNT_DEFAULT_HTTP_PROTOCOL=http
- ALLOW_ALL_IFRAMES=${ALLOW_ALL_IFRAMES:-False}
- ALLOWED_HOSTS=*
- ATTACHMENT_HOST=${ATTACHMENT_HOST:-localhost:8000}
- ATTACHMENTS_USE_S3=${ATTACHMENTS_USE_S3:-True}
- ATTACHMENTS_AWS_ACCESS_KEY_ID=${ATTACHMENTS_AWS_ACCESS_KEY_ID:-minio}
- ATTACHMENTS_AWS_SECRET_ACCESS_KEY=${ATTACHMENTS_AWS_SECRET_ACCESS_KEY:-minio123}
- ATTACHMENTS_AWS_S3_CUSTOM_DOMAIN=${ATTACHMENTS_AWS_S3_CUSTOM_DOMAIN:-localhost:9000/media}
- ATTACHMENTS_AWS_S3_SECURE_URLS=${ATTACHMENTS_AWS_S3_SECURE_URLS:-False}
- ATTACHMENTS_AWS_S3_ENDPOINT_URL=${ATTACHMENTS_AWS_S3_ENDPOINT_URL:-http://minio:9000}
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-}
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_TASK_ALWAYS_EAGER=False
- CELERY_RESULT_BACKEND=redis://redis:6379/1
- CSRF_COOKIE_SECURE=False
- DATABASE_URL=mysql://${DATABASE_USER:-root}:${DATABASE_PASSWORD:-kuma}@mysql:3306/developer_mozilla_org
- DEBUG=${DEBUG:-True}
- DOMAIN=${DOMAIN:-localhost}
- ENABLE_RESTRICTIONS_BY_HOST=${ENABLE_RESTRICTIONS_BY_HOST:-False}
- INTERACTIVE_EXAMPLES_BASE=${INTERACTIVE_EXAMPLES_BASE:-https://interactive-examples.mdn.mozilla.net}
- KUMASCRIPT_URL_TEMPLATE=http://kumascript:9080/docs/{path}
- REDIS_CACHE_SERVER=redis://redis:6379/3
- PROTOCOL=http://
- SESSION_COOKIE_SECURE=False
- SITE_URL=${SITE_URL:-http://localhost:8000}
- STATIC_URL=${STATIC_URL:-http://localhost:8000/static/}
- WAFFLE_COOKIE_SECURE=False
# Other environment overrides
- PYTHONDONTWRITEBYTECODE=1
- PYTHONUNBUFFERED=True
- PYTHONWARNINGS=${PYTHONWARNINGS:-}
- MAINTENANCE_MODE=${MAINTENANCE_MODE:-False}
- REVISION_HASH=${KUMA_REVISION_HASH:-undefined}
# For the server side rendering server and the code that connects to it.
- SSR_PORT=8000
- SSR_URL=http://ssr:8000/ssr
- SSR_TIMEOUT=1
- GOOGLE_ANALYTICS_TRACKING_URL=http://mockga:7000/collect
# Web is based on worker b/c you cannot clear the "ports" with docker-compose.
web:
<<: *worker
command: gunicorn -w ${GUNICORN_WORKERS:-4} --bind 0.0.0.0:8000 --access-logfile=- --timeout=120 --worker-class=meinheld.gmeinheld.MeinheldWorker kuma.wsgi:application
depends_on:
- mysql
- redis
- ssr
- minio
- mockga
ports:
- "8000:8000"
# Used for ci testing
testing:
<<: *worker
command: bash
depends_on:
- mysql
- redis
- ssr
- kumascript
- minio
- minio_setup
volumes:
- ./:/app
# ssr is a Node server that performs server-side rendering of our React UI
ssr:
<<: *worker
command: node kuma/javascript/ssr-server.js
depends_on: []
ports:
- "8002:8000"
mysql:
image: mysql:5.6
environment:
- MYSQL_USER=kuma
- MYSQL_PASSWORD=kuma
- MYSQL_DATABASE=developer_mozilla_org
- MYSQL_ROOT_PASSWORD=kuma
command:
- mysqld
- --character-set-server=utf8
- --collation-server=utf8_general_ci
- --innodb-flush-log-at-trx-commit=0
- --innodb-log-file-size=132M
- --max-allowed-packet=100M
volumes:
- mysqlvolume:/var/lib/mysql
redis:
# The version of this Redis image should be kept synchronized with production. It
# should match the "redis_engine_version" variable in the following Terraform file:
# https://github.com/mdn/infra/blob/master/apps/mdn/mdn-aws/infra/modules/multi_region/redis/variables.tf
image: redis:5.0.6
kumascript:
image: mdnwebdocs/kumascript
command: node run.js
depends_on:
- web
- redis
environment:
- DOCUMENT_URL_TEMPLATE=http://web:8000/en-US/docs/{path}?raw=1&redirect=no
- DOCUMENT_URL=http://web:8000
- INTERACTIVE_EXAMPLES_URL=${INTERACTIVE_EXAMPLES_BASE:-https://interactive-examples.mdn.mozilla.net}
- LIVE_SAMPLES_URL=http://${ATTACHMENT_HOST:-localhost:8000}
- REDIS_URL=redis://redis:6379/2
ports:
- "9080:9080"
volumes:
- ./kumascript:/app
# MinIO: S3-compatible object storage (https://min.io)
minio:
image: minio/minio
command: server /data
environment:
MINIO_ACCESS_KEY: "minio"
MINIO_SECRET_KEY: "minio123"
ports:
- "9000:9000"
volumes:
- miniodata:/data
# One-shot service that ensures Minio is properly configured for Kuma
# No need to explicitly wait for minio; mc automatically wailts
minio_setup:
image: minio/mc
depends_on:
- minio
environment:
MC_HOST_minio: "http://${MINIO_ACCESS_KEY:-minio}:${MINIO_SECRET_KEY:-minio123}@minio:9000"
entrypoint: ""
command: /bin/sh -c "for BUCKET in 'test' 'media'; do mc mb -p minio/$$BUCKET && mc policy set download minio/$$BUCKET; done"
mockga:
build:
context: mockga
dockerfile: Dockerfile
ports:
- "7000:7000"
volumes:
miniodata:
mysqlvolume:
esdata:
driver: local