forked from ubccpsc/classy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
93 lines (90 loc) · 3.33 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
# Before deploying, make sure you have done the following:
# - created a user `classy` on the host
# - installed SSL certificates for the host
# - created a `.env` file in the same dir as this file and populated appropriately
# - opened port 80 and port 443 (publicly)
#
# A few high-level notes about this config file:
# - At deploy-time, all services have access to the values in the .env file; however, they are only accessible to the
# running service if the env_file directive is specified. If you only need to pass a subset of the env vars, use the
# environment directive and list only the var keys you need.
# - As configured, only ports 80 and 443 are seen by the host; all other ports listed (with the expose directive) are
# only accessible to linked services (i.e. those listed in the depends_on directive). If a service should be publicly
# accessible, consider listing it in the proxy service instead of opening additional ports on the host.
# - In general, services should be started as non-root users. Here, we launch services as the classy user (configured on
# the host) using the user directive.
# - Services specified here can be extended (and additional services can be added) by creating additional
# docker-compose.yml files. See https://docs.docker.com/compose/extends/#example-use-case.
# NOTE: Do not change the container names. They are used to refer to the service throughout the codebase in http requests.
version: "3.5"
services:
autotest:
build:
context: ./
dockerfile: ./packages/autotest/Dockerfile
container_name: autotest
depends_on:
- db
env_file: .env
expose:
- ${AUTOTEST_PORT}
restart: always
user: "${UID}:${GID}"
volumes:
- "${HOST_DIR}:${PERSIST_DIR}"
- "/var/run/docker.sock:/var/run/docker.sock"
db:
command: --quiet --slowms 250
container_name: db
environment:
- MONGO_INITDB_ROOT_USERNAME
- MONGO_INITDB_ROOT_PASSWORD
ports:
- "27017:27017"
image: mongo:3-jessie
restart: always
user: "${UID}"
volumes:
- /var/opt/classy/db:/data/db
portal:
build:
args:
- GH_BOT_USERNAME
- GH_BOT_EMAIL
- NAME
- PLUGIN_CLONE_URL
context: ./
dockerfile: ./packages/portal/Dockerfile
container_name: portal
depends_on:
- db
- autotest
env_file: .env
expose:
- ${BACKEND_PORT}
restart: always
user: "${UID}"
volumes:
- "${HOST_SSL_CERT_PATH}:${SSL_CERT_PATH}"
- "${HOST_SSL_KEY_PATH}:${SSL_KEY_PATH}"
- "${HOST_DIR}:${PERSIST_DIR}:ro"
proxy:
build:
args:
- UID
- SSL_CERT_PATH
- SSL_KEY_PATH
- BACKEND_PORT
context: ./
dockerfile: ./packages/proxy/Dockerfile
container_name: proxy
depends_on:
- portal
ports:
- "80:8080"
- "443:8443"
restart: always
user: "${UID}"
volumes:
- "${HOST_SSL_CERT_PATH}:${SSL_CERT_PATH}"
- "${HOST_SSL_KEY_PATH}:${SSL_KEY_PATH}"