-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yaml
More file actions
207 lines (196 loc) · 5.38 KB
/
compose.yaml
File metadata and controls
207 lines (196 loc) · 5.38 KB
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
services:
mr-postgres:
image: postgres:15
container_name: ${NAME_PREFIX}mr-postgres
environment:
- POSTGRES_PASSWORD=postgres
healthcheck:
test: 'psql -c "\l" postgres postgres'
start_period: 2s
restart: always
volumes:
- pgdata:/var/lib/postgresql/data
- ./backend/create_db.sql:/docker-entrypoint-initdb.d/myresearch.sql
- ./scripts/dumps:/mnt/dumps
ports:
- "54320:5432"
nginx-dev: &nginx-dev
image: nginx:latest
container_name: ${NAME_PREFIX}mr-nginx-dev
hostname: mr-nginx
restart: unless-stopped
profiles: ["dev"]
depends_on:
- django-dev
- vue-dev
volumes:
- ./nginx.conf.dev:/etc/nginx/nginx.conf:ro
ports:
- "5000:80"
nginx-prod:
<<: *nginx-dev
container_name: ${NAME_PREFIX}mr-nginx-prod
profiles: ["prod"]
depends_on:
- django-prod
- vue-prod
volumes:
- ./nginx.conf.prod:/etc/nginx/nginx.conf:ro
- backend_static:/var/www/backend_static/
django-dev: &django-dev
image: mr-django
container_name: ${NAME_PREFIX}mr-django-dev
hostname: mr-django
depends_on:
mr-postgres:
condition: service_healthy
restart: no
profiles: ["dev"]
extra_hosts:
- "host.docker.internal:host-gateway"
build:
context: ./backend
healthcheck:
test: "curl -f mr-django:8000/healthcheck/"
start_period: 2s
volumes:
- ./backend:/usr/src/app/backend
- bapyca:/usr/src/app/backend/__pycache__
expose:
- "8000"
command: sh -c "
python manage.py migrate &&
python manage.py runserver 0.0.0.0:8000
"
stdin_open: true
tty: true
ports:
- "8000:8000"
environment:
DB_HOST: 'mr-postgres'
DJANGO_LOG_LEVEL: ${DJANGO_LOG_LEVEL}
DJANGO_SETTINGS_MODULE: myresearch.settings.dev
SAML_BASE_URL: ${SAML_BASE_URL}
IDP_METADATA_URL: ${IDP_METADATA_URL}
django-prod:
<<: *django-dev
container_name: ${NAME_PREFIX}mr-django-prod
restart: unless-stopped
profiles: ["prod"]
ports: []
volumes:
- backend_static:/var/www/backend_static/
- ${LOG_DIR:-./backend/logs/}:/var/log/django/
command: sh -c "
python manage.py migrate &&
python manage.py collectstatic --no-input &&
gunicorn --timeout 300 --reload -b 0.0.0.0:8000 myresearch.wsgi:application
"
environment:
DB_HOST: 'mr-postgres'
DJANGO_SETTINGS_MODULE: myresearch.settings.prod
DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY}
DJANGO_LOG_LEVEL: ${DJANGO_LOG_LEVEL}
DJANGO_LOGFILE: /var/log/django/mr-django-prod.log
DJANGO_ALLOWED_HOSTS: ${DJANGO_ALLOWED_HOSTS}
PRIVATE_KEY_PATH: /run/secrets/private_key
PUBLIC_CERT_PATH: /run/secrets/public_cert
CSRF_TRUSTED_ORIGINS: ${CSRF_TRUSTED_ORIGINS}
SAML_BASE_URL: ${SAML_BASE_URL}
IDP_METADATA_URL: ${IDP_METADATA_URL}
secrets:
- private_key
- public_cert
vue-dev:
image: mr-vue-dev
container_name: ${NAME_PREFIX}mr-vue-dev
hostname: mr-vue
restart: no
profiles: ["dev"]
build:
context: ./frontend
dockerfile: Dockerfile.dev
entrypoint: ./start_dev.sh
depends_on:
django-dev:
condition: service_healthy
expose:
- "3000"
ports:
- "3000:3000"
environment:
# Allows Nuxt to be accessible from the outside.
- HOST=0.0.0.0
- CODEGEN_SCHEMA=http://mr-django:8000/api/graphql
- NUXT_PUBLIC_API_URL=${BASE_URL}/api
- NUXT_PUBLIC_SAML_URL=${BASE_URL}/saml
develop:
watch:
- path: ./frontend
target: /app
action: sync
ignore:
- node_modules
- .nuxt
- dist
- path: ./frontend/package.json
target: /app/package.json
action: restart
- path: ./frontend/vite.config.js
target: /app/vite.config.js
action: restart
vue-prod:
image: mr-vue-prod
container_name: ${NAME_PREFIX}mr-vue-prod
hostname: mr-vue
restart: unless-stopped
profiles: ["prod"]
depends_on:
django-prod:
condition: service_healthy
build:
context: ./frontend
dockerfile: Dockerfile.prod
args:
- NUXT_PUBLIC_API_URL=${BASE_URL}/api
- CODEGEN_SCHEMA=schema.json
dev-idp:
image: ghcr.io/centrefordigitalhumanities/development-idp/development-idp:latest
hostname: mr-dev-idp
container_name: ${NAME_PREFIX}mr-dev-idp
ports:
- "7000:7000"
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
- DJANGO_SECRET_KEY=django-insecure-wa2AengahShofo8tieR6
- DJANGO_DEBUG=False
- DJANGO_DEBUG_TOOLBAR=True
- DJANGO_HOST=localhost:7000
- DJANGO_ALLOWED_HOSTS=mr-dev-idp,localhost,127.0.0.1,host.docker.internal
- DJANGO_DB_TYPE=sqlite3
- DJANGO_SQLLITE_FILE=/run/db/db.sqlite3
- DJANGO_HTTPS=False
- DJANGO_IDP_PRIVATE_KEY=/run/secrets/private_key
- DJANGO_IDP_PUBLIC_CERT=/run/secrets/public_cert
volumes:
- ./db:/run/db
profiles: ["dev"]
stdin_open: true
tty: true
restart: unless-stopped
secrets:
- private_key
- public_cert
volumes:
pgdata:
bapyca:
backend_static:
networks:
my-research:
driver: bridge
secrets:
private_key:
file: ./secrets/private.key
public_cert:
file: ./secrets/public.cert