forked from mitodl/ocw-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
240 lines (229 loc) · 6.42 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
232
233
234
235
236
237
238
239
240
version: '3.7'
x-environment:
&py-enviroment
DEBUG: 'False'
NODE_ENV: 'production'
DEV_ENV: 'True' # necessary to have nginx connect to web container
SECRET_KEY: local_unsafe_key # pragma: allowlist secret
DATABASE_URL: postgres://postgres:postgres@db:5432/postgres # pragma: allowlist secret
OCW_STUDIO_SECURE_SSL_REDIRECT: 'False'
OCW_STUDIO_DB_DISABLE_SSL: 'True'
CELERY_TASK_ALWAYS_EAGER: 'False'
CELERY_BROKER_URL: redis://redis:6379/4
CELERY_RESULT_BACKEND: redis://redis:6379/4
DOCKER_HOST: ${DOCKER_HOST:-missing}
WEBPACK_DEV_SERVER_HOST: ${WEBPACK_DEV_SERVER_HOST:-localhost}
DJANGO_SETTINGS_MODULE: "main.settings"
PYTHONPATH: "."
networks:
default-network:
driver: bridge
concourse-network:
driver: bridge
ipam:
driver: default
config:
- subnet: "10.1.0.0/24"
services:
db:
image: postgres:12.8
ports:
- "5431:5432"
environment:
POSTGRES_PASSWORD: postgres # pragma: allowlist secret
networks:
default-network:
concourse-network:
ipv4_address: 10.1.0.103
redis:
image: redis:6.0.10
ports:
- "6379"
networks:
- default-network
- concourse-network
nginx:
image: nginx:1.22.0
environment:
AWS_PREVIEW_BUCKET_NAME: $AWS_PREVIEW_BUCKET_NAME
AWS_PUBLISH_BUCKET_NAME: $AWS_PUBLISH_BUCKET_NAME
ports:
- "8043:8043"
- "8044:8044"
- "8045:8045"
links:
- web
- s3
networks:
default-network:
concourse-network:
ipv4_address: 10.1.0.102
volumes:
- ./config/nginx.conf:/etc/nginx/templates/web.conf.template
- ./:/src
web:
build:
context: .
dockerfile: Dockerfile
command: >
/bin/bash -c '
sleep 3 &&
python3 manage.py collectstatic --noinput &&
python3 manage.py migrate --noinput &&
uwsgi uwsgi.ini --honour-stdin'
stdin_open: true
tty: true
ports:
- "8041:8041"
environment:
<< : *py-enviroment
PORT: 8041
DEBUG: 'True'
NODE_ENV: 'development'
WEBPACK_USE_DEV_SERVER: 'True'
WEBPACK_DEV_SERVER_PORT: 8042
env_file: .env
links:
- db
- redis
networks:
- default-network
- concourse-network
volumes:
- .:/src
- django_media:/var/media
watch:
image: node:16.15.0
working_dir: /src
command: >
/bin/bash -c './webpack_dev_server.sh --install'
ports:
- "8042:8042"
environment:
NODE_ENV: 'development'
DOCKER_HOST: ${DOCKER_HOST:-missing}
CONTAINER_NAME: 'watch'
env_file: .env
networks:
- default-network
volumes:
- .:/src
- yarn-cache:/home/mitodl/.cache/yarn
celery:
build:
context: .
dockerfile: Dockerfile
environment:
<<: *py-enviroment
DEBUG: 'True'
NODE_ENV: 'development'
WEBPACK_USE_DEV_SERVER: 'True'
WEBPACK_DEV_SERVER_PORT: 8042
env_file: .env
command: >
/bin/bash -c '
sleep 3;
celery -A main.celery:app worker -Q publish,batch,default, -B -l ${OCW_STUDIO_LOG_LEVEL:-INFO}'
links:
- db
- redis
networks:
- default-network
- concourse-network
volumes:
- .:/src
- django_media:/var/media
concourse-db:
image: postgres:11.6
environment:
POSTGRES_DB: concourse
POSTGRES_USER: postgres
PGDATA: /database
networks:
- default-network
concourse:
image: concourse/concourse:7.9.0
command: quickstart
privileged: true
depends_on: [concourse-db]
ports: ["8080:8080"]
stdin_open: true
tty: true
environment:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
CONCOURSE_POSTGRES_HOST: concourse-db
CONCOURSE_POSTGRES_USER: postgres
CONCOURSE_POSTGRES_DATABASE: concourse
CONCOURSE_EXTERNAL_URL: ${CONCOURSE_URL:-http://concourse:8080}
CONCOURSE_ADD_LOCAL_USER: ${CONCOURSE_USER_NAME:-test}:${CONCOURSE_PASSWORD:-test} # pragma: allowlist secret
CONCOURSE_MAIN_TEAM_LOCAL_USER: ${CONCOURSE_USER_NAME:-test}
CONCOURSE_WORKER_BAGGAGECLAIM_DRIVER: overlay
CONCOURSE_X_FRAME_OPTIONS: allow
CONCOURSE_CONTENT_SECURITY_POLICY: "*"
CONCOURSE_CLUSTER_NAME: ocw
CONCOURSE_WORKER_CONTAINERD_DNS_SERVER: "8.8.8.8"
CONCOURSE_CONTAINERD_ALLOW_HOST_ACCESS: "true"
CONCOURSE_WORKER_RUNTIME: "containerd"
CONCOURSE_ENABLE_PIPELINE_INSTANCES: "true"
CONCOURSE_ENABLE_ACROSS_STEP: "true"
CONCOURSE_CONTAINERD_MAX_CONTAINERS: 1200
links:
- web
- nginx
- s3
networks:
default-network:
concourse-network:
ipv4_address: 10.1.0.101
s3:
image: minio/minio
ports:
- "9000:9000"
- "9001:9001"
volumes:
- ./s3:/data
environment:
MINIO_ROOT_USER: $MINIO_ROOT_USER
MINIO_ROOT_PASSWORD: $MINIO_ROOT_PASSWORD
command: server --address 0.0.0.0:9000 --console-address 0.0.0.0:9001 /data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
networks:
default-network:
concourse-network:
ipv4_address: 10.1.0.100
create-buckets:
image: minio/mc
depends_on:
s3:
condition: service_healthy
environment:
MINIO_ROOT_USER: $MINIO_ROOT_USER
MINIO_ROOT_PASSWORD: $MINIO_ROOT_PASSWORD
AWS_STORAGE_BUCKET_NAME: $AWS_STORAGE_BUCKET_NAME
AWS_PREVIEW_BUCKET_NAME: $AWS_PREVIEW_BUCKET_NAME
AWS_PUBLISH_BUCKET_NAME: $AWS_PUBLISH_BUCKET_NAME
AWS_ARTIFACTS_BUCKET_NAME: $AWS_ARTIFACTS_BUCKET_NAME
restart: on-failure
entrypoint: >
/bin/sh -c "
/usr/bin/mc alias set minio http://10.1.0.100:9000 $MINIO_ROOT_USER $MINIO_ROOT_PASSWORD;
/usr/bin/mc mb minio/$AWS_STORAGE_BUCKET_NAME;
/usr/bin/mc policy set public minio/$AWS_STORAGE_BUCKET_NAME;
/usr/bin/mc mb minio/$AWS_PREVIEW_BUCKET_NAME;
/usr/bin/mc policy set public minio/$AWS_PREVIEW_BUCKET_NAME;
/usr/bin/mc mb minio/$AWS_PUBLISH_BUCKET_NAME;
/usr/bin/mc policy set public minio/$AWS_PUBLISH_BUCKET_NAME;
/usr/bin/mc mb minio/$AWS_ARTIFACTS_BUCKET_NAME;
/usr/bin/mc policy set public minio/$AWS_ARTIFACTS_BUCKET_NAME;
/usr/bin/mc version enable minio/$AWS_ARTIFACTS_BUCKET_NAME;
"
networks:
- concourse-network
volumes:
django_media: {}
yarn-cache: {}