-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
114 lines (108 loc) · 3.35 KB
/
Copy pathdocker-compose.yml
File metadata and controls
114 lines (108 loc) · 3.35 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
110
111
112
113
114
services:
db:
image: postgres:18-alpine
restart: always
env_file: ".env"
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB" ]
interval: 10s
timeout: 5s
retries: 5
environment:
- POSTGRES_INITDB_ARGS=--locale=C --encoding=UTF8
fastapi:
container_name: fastapi
build:
context: .
dockerfile: backend/Dockerfile
restart: always
environment:
- POSTGRES_SERVER=db
- REDIS_HOST=redis
# SMTP_* come from .env (Mailcow in production)
- FALLOUT_WORKER=0
- OLLAMA_BASE_URL=http://host.containers.internal:11434/v1
env_file: ".env"
depends_on:
db:
condition: service_healthy
ports:
- "8000:8000"
working_dir: /app
command: [ "sh", "-c", "uv run alembic upgrade head && uv run uvicorn main:app --host 0.0.0.0 --port 8000" ]
volumes:
- ./backend/app:/app/app
vuejs:
container_name: vuejs
build:
context: ./frontend
restart: always
ports:
- "3000:3000"
volumes:
- ./frontend:/app
redis:
image: redis:alpine
restart: always
env_file: ".env"
ports:
- "6379:6379"
dramatiq_worker:
container_name: dramatiq_worker
build:
context: .
dockerfile: backend/Dockerfile
restart: always
environment:
- POSTGRES_SERVER=db
- REDIS_HOST=redis
# SMTP_* come from .env (Mailcow in production)
- FALLOUT_WORKER=1
- OLLAMA_BASE_URL=http://host.containers.internal:11434/v1
env_file: ".env"
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
working_dir: /app
command:
- sh
- -c
- >-
PERIODIQ_PID=; DRAMATIQ_PID=;
shutdown() { exit_code=$${1:-0}; trap - TERM INT; for pid in "$$PERIODIQ_PID" "$$DRAMATIQ_PID"; do [ -n "$$pid" ] && kill "$$pid" 2>/dev/null; done; elapsed=0; while [ "$$elapsed" -lt 30 ]; do alive=0; for pid in "$$PERIODIQ_PID" "$$DRAMATIQ_PID"; do if [ -n "$$pid" ] && kill -0 "$$pid" 2>/dev/null; then alive=1; fi; done; [ "$$alive" -eq 0 ] && break; sleep 1; elapsed=$$((elapsed + 1)); done; for pid in "$$PERIODIQ_PID" "$$DRAMATIQ_PID"; do [ -n "$$pid" ] && kill -KILL "$$pid" 2>/dev/null; done; wait; exit "$$exit_code"; };
trap 'shutdown 0' TERM INT;
uv run periodiq app.core.dramatiq app.api.tasks & PERIODIQ_PID=$$!;
uv run dramatiq --processes 1 app.api.tasks & DRAMATIQ_PID=$$!;
while [ -n "$$PERIODIQ_PID" ] && kill -0 "$$PERIODIQ_PID" 2>/dev/null && [ -n "$$DRAMATIQ_PID" ] && kill -0 "$$DRAMATIQ_PID" 2>/dev/null; do sleep 1; done;
shutdown 1
rustfs:
image: rustfs/rustfs:latest
container_name: rustfs
restart: always
env_file:
- .env
profiles:
- rustfs
ports:
- "9002:9000"
- "9003:9001"
volumes:
- rustfs_data:/data
environment:
- RUSTFS_ROOT_USER=${RUSTFS_ACCESS_KEY:?RUSTFS_ACCESS_KEY is required}
- RUSTFS_ROOT_PASSWORD=${RUSTFS_SECRET_KEY:?RUSTFS_SECRET_KEY is required}
healthcheck:
test: [ "CMD", "sh", "-c", "wget -qO- http://localhost:9000/health || exit 1" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
volumes:
postgres-data:
rustfs_data: