-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.prod.yml
139 lines (131 loc) · 4.39 KB
/
docker-compose.prod.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
version: '3.8'
services:
database:
container_name: pigeonhole-database
image: postgres:13.0-alpine
restart: always
volumes:
- postgres_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=${SQL_USER}
- POSTGRES_PASSWORD=${SQL_PASSWORD}
- POSTGRES_DB=${SQL_DATABASE}
env_file:
- ${ENV_LOCATION}
backend:
container_name: pigeonhole-backend
build:
dockerfile: Dockerfile.prod
context: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- static_volume:/home/app/web/backend/static
- media_volume:/home/app/web/uploads
- /var/run/docker.sock:/var/run/docker.sock
- ${SUBMISSIONS_PATH}:/home/app/web/backend/static/submissions
- ${ARTIFACTS_PATH}:/home/app/web/backend/static/artifacts/
expose:
- 8000
env_file:
- ${ENV_LOCATION}
depends_on:
- database
- registry
restart: always
labels:
- "traefik.enable=true"
- "traefik.http.routers.backend.rule=Host(`sel2-1.ugent.be`) && PathPrefix(`/api`)"
- "traefik.http.routers.backend.middlewares=backend-stripprefix"
- "traefik.http.middlewares.backend-stripprefix.stripprefix.prefixes=/api"
- "traefik.http.routers.backend.entrypoints=websecure"
- "traefik.http.routers.backend.tls.certresolver=myresolver"
static:
container_name: statics
image: httpd:latest
restart: always
volumes:
- static_volume:/usr/local/apache2/htdocs/
depends_on:
- backend
expose:
- 5000
labels:
- "traefik.enable=true"
- "traefik.http.routers.static.rule=Host(`sel2-1.ugent.be`) && PathPrefix(`/static`)"
- "traefik.http.routers.static.middlewares=static-stripprefix"
- "traefik.http.middlewares.static-stripprefix.stripprefix.prefixes=/static"
- "traefik.http.routers.static.entrypoints=websecure"
- "traefik.http.routers.static.tls.certresolver=myresolver"
frontend:
container_name: pigeonhole-frontend
build:
dockerfile: Dockerfile.prod
context: ./frontend
target: runner
command: npm run start
restart: always
ports:
- 3000:3000
depends_on:
- backend
env_file:
- ${ENV_LOCATION}
labels:
- "traefik.enable=true"
- "traefik.http.routers.frontend.rule=Host(`sel2-1.ugent.be`)"
- "traefik.http.routers.frontend.entrypoints=websecure"
- "traefik.http.routers.frontend.tls.certresolver=myresolver"
registry:
image: "registry:latest"
restart: always
container_name: registry
ports:
- "5000:5000"
environment:
REGISTRY_AUTH: htpasswd
REGISTRY_AUTH_HTPASSWD_REALM: Registry-Realm
REGISTRY_AUTH_HTPASSWD_PATH: /auth/registry.passwd
REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data
volumes:
- registrydata:/data
- ${PASSWD_FOLDER_PATH}:/auth
labels:
- "traefik.enable=true"
- "traefik.address=:2002"
- "traefik.http.routers.registry.rule=Host(`sel2-1.ugent.be`)"
- "traefik.http.routers.registry.entrypoints=otherport"
- "traefik.http.routers.registry.tls.certresolver=myresolver"
traefik:
image: "traefik:v2.11"
container_name: "traefik"
restart: always
command:
- "--log.level=DEBUG"
- "--api.insecure=false"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.otherport.address=:2002"
- "--entrypoints.otherport.http.tls=myresolver"
- "--certificatesresolvers.myresolver.acme.tlschallenge=true"
#- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory" #for testing
- "--certificatesresolvers.myresolver.acme.email=robin.paret@ugent.be"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
- "--entrypoints.web.http.redirections.entryPoint.to=websecure"
- "--entrypoints.web.http.redirections.entryPoint.scheme=https"
- "--entrypoints.web.http.redirections.entrypoint.permanent=true"
ports:
- "80:80"
- "443:443"
- "8080:8080"
- "2002:2002"
volumes:
- certificate_volume:/letsencrypt
- "/var/run/docker.sock:/var/run/docker.sock:ro"
volumes:
postgres_data:
static_volume:
media_volume:
certificate_volume:
registrydata: