-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
70 lines (64 loc) · 1.93 KB
/
Copy pathdocker-compose.yml
File metadata and controls
70 lines (64 loc) · 1.93 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
services:
db:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${POSTGRES_USER:-hisse}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-hisse}
POSTGRES_DB: ${POSTGRES_DB:-hisse_analizi}
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U hisse -d hisse_analizi"]
interval: 5s
timeout: 5s
retries: 5
app:
build: .
command: uvicorn src.api.app:app --host 0.0.0.0 --port 8000
ports:
- "8000:8000"
env_file: .env
environment:
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-hisse}:${POSTGRES_PASSWORD:-hisse}@db:5432/${POSTGRES_DB:-hisse_analizi}
DATABASE_URL_SYNC: postgresql://${POSTGRES_USER:-hisse}:${POSTGRES_PASSWORD:-hisse}@db:5432/${POSTGRES_DB:-hisse_analizi}
depends_on:
db:
condition: service_healthy
# Worker process — separate from API.
# IMPORTANT: Deploy with exactly 1 replica unless WORKER_SINGLE_REPLICA=false.
# With WORKER_SINGLE_REPLICA=false, multiple replicas are safe (advisory locks + outbox claiming).
worker:
build: .
command: python -m src.workers.run_workers
env_file: .env
environment:
DATABASE_URL: postgresql+asyncpg://${POSTGRES_USER:-hisse}:${POSTGRES_PASSWORD:-hisse}@db:5432/${POSTGRES_DB:-hisse_analizi}
DATABASE_URL_SYNC: postgresql://${POSTGRES_USER:-hisse}:${POSTGRES_PASSWORD:-hisse}@db:5432/${POSTGRES_DB:-hisse_analizi}
WORKER_SINGLE_REPLICA: "true"
depends_on:
db:
condition: service_healthy
deploy:
replicas: 1
dashboard:
build:
context: ./dashboard
dockerfile: Dockerfile
ports:
- "3000:3000"
environment:
API_URL: http://app:8000
depends_on:
- app
restart: unless-stopped
mailhog:
image: mailhog/mailhog:latest
ports:
- "1025:1025"
- "8025:8025"
profiles:
- mail
volumes:
pgdata: