forked from OS2borgerPC/os2borgerpc-admin-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.yaml
84 lines (84 loc) · 3.57 KB
/
compose.yaml
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
services:
frontend:
build:
context: .
dockerfile: docker/Dockerfile
target: frontend
command:
npm run watch-sass
volumes:
- .:/code/
# NOTE: We do not want node_modules on the host machine, so we
# create an additional volume for it. It is important this anonymous
# volume comes after the above bind to work.
- /code/nodejs/node_modules/
os2borgerpc-admin:
# Defaults in case values aren't passed in via the environment, so 0 (root) isn't used. Justfile overrides them.
# NOTE: Keep in sync with the UID/GID in docker/Dockerfile
environment:
UID: 75030
GID: 75030
user: "${UID}:${GID}"
build:
context: .
dockerfile: docker/Dockerfile
target: os2borgerpc
image: os2borgerpcadmin
# NOTE: --workers 1 and --max-requests 1 makes gunicorn run with only
# one worker + respawn it after each request to reload on changes
# to templates/CSS + avoid issues where different workers have cached
# different versions of files so one cycles between seeing different
# codebase versions on browser refresh!
# --reload by itself only reloads on changes to python files
# Another option is reload-extra-file on every template and CSS file,
# but ATM it's apparently not recursive, so a solution like this would
# be needed:
# https://github.com/benoitc/gunicorn/pull/1846#issuecomment-1862496443
# Open PR to make --reload-extra-file recursive:
# https://github.com/benoitc/gunicorn/pull/1846
command:
sh -c "python manage.py initialize_database &&
python manage.py compilemessages &&
gunicorn --reload --workers 1 --max-requests 1
--reload-extra-file /code/admin_site/locale/da/LC_MESSAGES/django.mo
--reload-extra-file /code/admin_site/locale/da/LC_MESSAGES/djangojs.mo
--reload-extra-file /code/admin_site/locale/sv/LC_MESSAGES/django.mo
--reload-extra-file /code/admin_site/locale/sv/LC_MESSAGES/djangojs.mo
--timeout 0 --config /code/docker/gunicorn-settings.py os2borgerpc_admin.wsgi"
volumes:
- .:/code/
- ./dev-environment/dev-settings.ini:/user-settings.ini
- ./dev-environment/system_fixtures:/code/admin_site/system/fixtures/
- ./dev-environment/changelog_fixtures:/code/admin_site/changelog/fixtures/
depends_on:
- db
ports:
- 9999:9999
stdin_open: true
tty: true
container_name: bpc_admin_site_django
privileged: true
cron-service:
image: os2borgerpcadmin
volumes:
- .:/code/
- ./dev-environment/dev-settings.ini:/user-settings.ini
- ./dev-environment/system_fixtures:/code/admin_site/system/fixtures/
command: ["supercronic", "/crontab"]
entrypoint: []
depends_on:
- os2borgerpc-admin
db:
image: postgres:latest
restart: always
environment:
# NOTE: These values are only used in the local development
# environment, so it's not particularly important that
# they're secure
POSTGRES_USER: bpc
POSTGRES_PASSWORD: bpc
volumes:
- postgres-data:/var/lib/postgresql/data
container_name: bpc_admin_site_db
volumes:
postgres-data: