Skip to content

Commit 2e38a1d

Browse files
authored
Merge pull request #26 from EventAccess/move-compose
Move docker compose file from Registrering
2 parents 493c084 + 3899def commit 2e38a1d

2 files changed

Lines changed: 152 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.env

compose.yaml

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
services:
2+
django:
3+
build:
4+
context: ./Registrering
5+
target: server
6+
pull: true
7+
pull_policy: build
8+
#volumes:
9+
# - django_media:/app/media:rw
10+
11+
command: daphne config.asgi:application -b 0.0.0.0
12+
13+
depends_on:
14+
- database
15+
profiles:
16+
- prod
17+
env_file:
18+
- .env
19+
environment:
20+
REGISTRATION_HOSTNAME: ${REGISTRATION_HOSTNAME:-registration.eventaccess.localhost}
21+
labels:
22+
- traefik.enable=true
23+
- traefik.http.routers.registration-backend.rule=Host(`${REGISTRATION_HOSTNAME:-registration.eventaccess.localhost}`) && PathRegexp(`^/(api|admin)`)
24+
- traefik.http.services.registration-backend.loadbalancer.server.port=8000
25+
#- traefik.http.routers.registration-backend.entrypoints=web,websecure
26+
27+
django-staticfiles:
28+
build:
29+
context: ./Registrering
30+
target: static-server
31+
pull: true
32+
pull_policy: build
33+
34+
# TODO: Set up Django media dir
35+
# Do we need this?
36+
# I'm not sure if it is needed yet; low pri backlog
37+
#volumes:
38+
# - django_media:/srv/http/media:ro
39+
profiles:
40+
- prod
41+
env_file:
42+
- .env
43+
environment:
44+
REGISTRATION_HOSTNAME: ${REGISTRATION_HOSTNAME:-registration.eventaccess.localhost}
45+
SERVER_LOG_LEVEL: warn
46+
labels:
47+
- traefik.enable=true
48+
- traefik.http.routers.registration-backend-staticfiles.rule=Host(`${REGISTRATION_HOSTNAME:-registration.eventaccess.localhost}`) && PathRegexp(`^/(static)`)
49+
- traefik.http.services.registration-backend-staticfiles.loadbalancer.server.port=80
50+
#- traefik.http.routers.registration-backend-staticfiles.entrypoints=web,websecure
51+
52+
django-dev:
53+
build:
54+
context: ./Registrering
55+
target: dev
56+
pull: true
57+
pull_policy: build
58+
59+
command: python manage.py runserver 0.0.0.0:8000
60+
61+
volumes:
62+
- ./Registrering:/app:rw
63+
64+
ports:
65+
- "8000:8000"
66+
env_file:
67+
- .env
68+
depends_on:
69+
- database
70+
profiles:
71+
- dev
72+
environment:
73+
REGISTRATION_HOSTNAME: ${REGISTRATION_HOSTNAME:-registration.eventaccess.localhost}
74+
labels:
75+
- traefik.enable=true
76+
- traefik.http.routers.registration-backend.rule=Host(`${REGISTRATION_HOSTNAME:-registration.eventaccess.localhost}`) && PathRegexp(`^/(api|admin|static)`)
77+
#- traefik.http.routers.registration-backend.entrypoints=web,websecure
78+
79+
database:
80+
image: postgres:17
81+
env_file:
82+
- .env
83+
shm_size: 256MB
84+
volumes:
85+
- postgres_data:/var/lib/postgresql/data/
86+
profiles:
87+
- prod
88+
- dev
89+
90+
nextjs:
91+
build:
92+
context: ./Registrering/registration-frontend-react/
93+
target: static-server
94+
pull: true
95+
pull_policy: build
96+
97+
profiles:
98+
- prod
99+
environment:
100+
REGISTRATION_HOSTNAME: ${REGISTRATION_HOSTNAME:-registration.eventaccess.localhost}
101+
labels:
102+
- traefik.enable=true
103+
- traefik.http.routers.registration-frontend.rule=Host(`${REGISTRATION_HOSTNAME:-registration.eventaccess.localhost}`)
104+
- traefik.http.services.registration-frontend.loadbalancer.server.port=80
105+
#- traefik.http.routers.registration-frontend.entrypoints=web,websecure
106+
107+
nextjs-dev:
108+
build:
109+
context: ./Registrering/registration-frontend-react/
110+
target: dev-server
111+
pull: true
112+
pull_policy: build
113+
114+
volumes:
115+
- ./Registrering/registration-frontend-react:/app:rw
116+
ports:
117+
- 3000:3000/tcp
118+
profiles:
119+
- dev
120+
environment:
121+
REGISTRATION_HOSTNAME: ${REGISTRATION_HOSTNAME:-registration.eventaccess.localhost}
122+
labels:
123+
- traefik.enable=true
124+
- traefik.http.routers.registration-frontend.rule=Host(`${REGISTRATION_HOSTNAME:-registration.eventaccess.localhost}`)
125+
#- traefik.http.routers.registration-frontend.entrypoints=web,websecure
126+
127+
reverse-proxy:
128+
image: traefik:v3.2.0
129+
pull_policy: always
130+
command:
131+
- --api.insecure=true
132+
- --providers.docker
133+
- --entryPoints.web.address=:80
134+
#- --entryPoints.websecure.address=:443
135+
- --providers.docker.exposedbydefault=false
136+
ports:
137+
- 80:80/tcp
138+
# TODO: Add https configuration
139+
#- 443:443/tcp
140+
# The Web UI (enabled by --api.insecure=true)
141+
- 8080:8080
142+
profiles:
143+
- dev
144+
- prod
145+
volumes:
146+
# So that Traefik can listen to the Docker events
147+
- /var/run/docker.sock:/var/run/docker.sock:ro
148+
149+
volumes:
150+
postgres_data:
151+
#django_media:

0 commit comments

Comments
 (0)