Repository navigation
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
109 lines (103 loc) · 3.32 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
109 lines (103 loc) · 3.32 KB
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
services:
backend:
build:
context: .
dockerfile: backend/Dockerfile
env_file:
- backend/.env.example
environment:
DATABASE_URL: postgres://openzev:openzev@db:5432/openzev
ALLOWED_HOSTS: localhost,127.0.0.1,backend
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-http://localhost:5173,http://localhost:8080}
CSRF_TRUSTED_ORIGINS: ${CSRF_TRUSTED_ORIGINS:-${CORS_ALLOWED_ORIGINS:-http://localhost:5173,http://localhost:8080}}
CELERY_BROKER_URL: redis://valkey:6379/0
CACHE_URL: redis://valkey:6379/1
# Backend remains directly reachable in dev; do not trust client-supplied XFF.
NUM_PROXIES: 0
# runserver is threaded and leaks one persistent connection per request thread.
DB_CONN_MAX_AGE: 0
volumes:
- ./backend:/app
- backend_media:/app/media
ports:
- "8001:8000"
depends_on:
- db
- valkey
command: sh -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
worker:
build:
context: .
dockerfile: backend/Dockerfile
command: celery -A config worker -l info
env_file:
- backend/.env.example
environment:
DATABASE_URL: postgres://openzev:openzev@db:5432/openzev
CELERY_BROKER_URL: redis://valkey:6379/0
CACHE_URL: redis://valkey:6379/1
volumes:
- ./backend:/app
- backend_media:/app/media
depends_on:
- backend
- valkey
beat:
build:
context: .
dockerfile: backend/Dockerfile
command: celery -A config beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
env_file:
- backend/.env.example
environment:
DATABASE_URL: postgres://openzev:openzev@db:5432/openzev
CELERY_BROKER_URL: redis://valkey:6379/0
CACHE_URL: redis://valkey:6379/1
volumes:
- ./backend:/app
depends_on:
- backend
- valkey
# On a fresh stack, migrations run inside the backend container's own
# startup command and this container can win the race and start before
# they land — django_celery_beat's scheduler tables won't exist yet and
# it exits. Unlike every other service here, that first failure is
# expected rather than a bug, so unlike them beat gets a restart policy.
restart: on-failure
frontend:
image: node:26-alpine
working_dir: /app
environment:
VITE_API_BASE_URL: /api/v1
CHOKIDAR_USEPOLLING: "true"
WATCHPACK_POLLING: "true"
volumes:
- ./frontend:/app
- frontend_node_modules:/app/node_modules
command: sh -c "[ -x node_modules/.bin/vite ] || npm ci; npm run dev -- --host 0.0.0.0 --port 5173"
ports:
- "5173:5173"
depends_on:
- backend
db:
image: postgres:18-alpine
environment:
POSTGRES_DB: openzev
POSTGRES_USER: openzev
POSTGRES_PASSWORD: openzev
# Keep in step with docker-compose.yml — see the note there.
PGDATA: /var/lib/postgresql/data/pgdata
ports:
- "5432:5432"
volumes:
# Same mount path as docker-compose.yml: the volume is shared, and a
# differing path silently gives this stack its own cluster (#492).
- postgres_data:/var/lib/postgresql/data
valkey:
image: valkey/valkey:9-alpine
ports:
- "6379:6379"
volumes:
postgres_data:
backend_media:
frontend_node_modules: