-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
73 lines (69 loc) · 2.11 KB
/
Copy pathdocker-compose.yml
File metadata and controls
73 lines (69 loc) · 2.11 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
services:
db:
image: pgvector/pgvector:pg16
container_name: market-research-db
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: market_research
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data # persist data outside the container so it survives restarts
healthcheck:
# depends_on only waits for the container to START, not for postgres to accept
# connections. without this, celery boots first and dies on connection refused.
test: ["CMD-SHELL", "pg_isready -U postgres -d market_research"]
interval: 5s
timeout: 3s
retries: 10
redis:
image: redis:8-alpine
container_name: market-research-redis
restart: always
ports:
- "6379:6379"
# no volume: redis is only the celery broker here, not a system of record.
# if it loses its queue on restart, we re-run ingestion. nothing durable lives here.
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 10
app:
build: .
container_name: market-research-app
restart: unless-stopped
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
env_file:
- .env
environment:
# override the .env values, which point at localhost for running natively.
# inside compose, "localhost" is THIS container — postgres and redis are reachable
# by their service names on the shared compose network.
DATABASE_URL: postgresql://postgres:postgres@db:5432/market_research
REDIS_URL: redis://redis:6379/0
ports:
- "8501:8501"
celery:
build: .
container_name: market-research-worker
restart: unless-stopped
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
env_file:
- .env
environment:
DATABASE_URL: postgresql://postgres:postgres@db:5432/market_research
REDIS_URL: redis://redis:6379/0
command: celery -A app.celery_app worker --loglevel=info
volumes:
pgdata: