Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
81 lines (76 loc) · 2.17 KB
/
Copy pathdocker-compose.yml
File metadata and controls
81 lines (76 loc) · 2.17 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
# Local and production: docker compose up -d --build. Everything binds to the host's loopback only:
# Postgres 5434, api on API_HOST_PORT (default 8000), the site (web: nginx + static build, /api proxied to api)
# on WEB_PORT (default 10600). APP_ENV, API_HOST_PORT and WEB_PORT come from .env. See README, Deploy.
services:
db:
image: postgres:16
container_name: muse-db
environment:
POSTGRES_USER: muse
POSTGRES_PASSWORD: muse
POSTGRES_DB: muse
ports:
- "127.0.0.1:5434:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U muse -d muse"]
interval: 5s
timeout: 3s
retries: 10
migrate:
build: .
container_name: muse-migrate
depends_on:
db:
condition: service_healthy
environment:
DATABASE_URL: postgresql+asyncpg://muse:muse@db:5432/muse
command: ["sh", "-c", "alembic upgrade head && python -m app.tasks.schema"]
api:
build: .
container_name: muse-api
depends_on:
migrate:
condition: service_completed_successfully
environment:
APP_ENV: ${APP_ENV:-local}
DATABASE_URL: postgresql+asyncpg://muse:muse@db:5432/muse
env_file:
- .env
ports:
- "127.0.0.1:${API_HOST_PORT:-8000}:8000"
volumes:
- sources:/app/var/sources
healthcheck:
test: [
"CMD-SHELL",
"python -c \"import urllib.request,sys;sys.exit(0 if urllib.request.urlopen('http://localhost:8000/api/v1/health',timeout=3).status==200 else 1)\"",
]
interval: 10s
timeout: 5s
retries: 5
worker:
build: .
container_name: muse-worker
depends_on:
migrate:
condition: service_completed_successfully
environment:
DATABASE_URL: postgresql+asyncpg://muse:muse@db:5432/muse
env_file:
- .env
volumes:
- sources:/app/var/sources
command: ["procrastinate", "--app", "app.tasks.worker.app", "worker", "--concurrency", "3"]
web:
build: ./frontend
container_name: muse-web
depends_on:
api:
condition: service_healthy
ports:
- "127.0.0.1:${WEB_PORT:-10600}:80"
volumes:
pgdata:
sources: