-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathdocker-compose.yml
107 lines (102 loc) · 3.54 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
name: dolos
services:
db:
image: mariadb:11
volumes:
- dolos-db-data:/var/lib/mysql
environment:
MARIADB_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD:?}
MARIADB_DATABASE: dolos
MARIADB_USER: ${DATABASE_USER:?}
MARIADB_PASSWORD: ${DATABASE_PASSWORD:?}
networks:
- dolos
healthcheck:
start_period: 2s
interval: 5s
test: healthcheck.sh --su-mysql --connect --innodb_initialized
restart: always
web:
image: ghcr.io/dodona-edu/dolos-web
# build: ./web/
ports:
# This renders to "host:port:8080", so traffic from the provided hosts on the specified
# port is available to port 8080 inside the container. By default, this will be
# 0.0.0.0:8080:8080.
- ${FRONTEND_INTERNAL_HOST:-0.0.0.0}:${FRONTEND_INTERNAL_PORT:-${FRONTEND_EXTERNAL_PORT:?}}:8080
environment:
VITE_HOST: 0.0.0.0
VITE_PORT: 8080
VITE_API_URL: ${WEB_PROTOCOL:?}://${API_EXTERNAL_HOST:?}:${API_EXTERNAL_PORT:?}/${API_EXTERNAL_PATH:-}
VITE_MODE: server
depends_on:
- api
networks:
- dolos
healthcheck:
start_period: 45s
test: curl --fail http://localhost:8080 || exit 1
restart: always
api:
image: ghcr.io/dodona-edu/dolos-api
# build: ./api/
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails db:prepare && bundle exec rails s -p 3000 -b '0.0.0.0'"
volumes:
- dolos-api-storage:/dolos/storage
- /tmp:/tmp
ports:
# This renders to "host:port:3000", so traffic from the provided hosts on the specified
# port is available to port 3000 inside the container. By default, this will be
# 0.0.0.0:3000:3000.
- ${API_INTERNAL_HOST:-0.0.0.0}:${API_INTERNAL_PORT:-${API_EXTERNAL_PORT:?}}:3000
environment:
DOLOS_API_FRONT_END_URL: ${WEB_PROTOCOL:?}://${FRONTEND_EXTERNAL_HOST:?}:${FRONTEND_EXTERNAL_PORT:?}/${FRONTEND_EXTERNAL_PATH:-}
DOLOS_API_URL: ${WEB_PROTOCOL:?}://${API_EXTERNAL_HOST:?}:${API_EXTERNAL_PORT:?}/${API_EXTERNAL_PATH:-}
DOLOS_API_DATABASE_USERNAME: ${DATABASE_USER:?}
DOLOS_API_DATABASE_PASSWORD: ${DATABASE_PASSWORD:?}
DOLOS_API_DATABASE_HOST: db
RAILS_ENV: production
RAILS_LOG_TO_STDOUT: true
SECRET_KEY_BASE_DUMMY: true
depends_on:
db:
condition: service_healthy
networks:
- dolos
healthcheck:
start_period: 2s
interval: 10s
# This health check "emulates" a browser request to API_EXTERNAL_*, while actually just
# querying localhost. This way, we overcome the strict host checking done by rails, which
# is based on the DOLOS_API_URL variable.
test: 'curl --fail --header "Host: ${API_EXTERNAL_HOST:-localhost}:${API_EXTERNAL_PORT:?}" --header "X-Forwarded-Proto: ${WEB_PROTOCOL:-http}" "localhost:3000/up" || exit 1'
restart: always
worker:
image: ghcr.io/dodona-edu/dolos-api
# build: ./api/
command: bash -c "bundle exec rails jobs:work"
volumes:
- dolos-api-storage:/dolos/storage
- /tmp:/tmp
- ${DOCKER_SOCKET}:/var/run/docker.sock
environment:
DOLOS_API_DATABASE_USERNAME: ${DATABASE_USER:?}
DOLOS_API_DATABASE_PASSWORD: ${DATABASE_PASSWORD:?}
DOLOS_API_DATABASE_HOST: db
RAILS_ENV: production
SECRET_KEY_BASE_DUMMY: true
RAILS_LOG_TO_STDOUT: true
depends_on:
- api
networks:
- dolos
healthcheck:
start_period: 2s
interval: 5s
test: ruby -e true || exit 1
restart: always
volumes:
dolos-db-data:
dolos-api-storage:
networks:
dolos: