Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
65 lines (62 loc) · 1.96 KB
/
Copy pathdocker-compose.yml
File metadata and controls
65 lines (62 loc) · 1.96 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
services:
postgres:
image: postgres:16
container_name: webhook_postgres
environment:
POSTGRES_USER: webhook
POSTGRES_PASSWORD: webhook
POSTGRES_DB: webhookdb
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U webhook -d webhookdb"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:7
container_name: webhook_redis
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
# ---------------------------------------------------------------------------
# Phase 3: Celery worker
#
# Runs the background delivery worker. The worker:
# - Subscribes to the Redis task queue
# - Executes deliver_webhook_task for each event
# - Writes DeliveryAttempt rows and updates Event.status in Postgres
#
# To run the worker LOCALLY (outside Docker) on Windows:
# celery -A app.core.celery_app worker --loglevel=info -P solo
#
# The -P solo flag is required on Windows because the default prefork pool
# uses os.fork(), which is unavailable on that platform.
# ---------------------------------------------------------------------------
celery_worker:
build:
context: .
dockerfile: Dockerfile
container_name: webhook_celery_worker
command: celery -A app.core.celery_app worker --loglevel=info --concurrency=2
environment:
- DATABASE_URL=postgresql+psycopg2://webhook:webhook@postgres:5432/webhookdb
- REDIS_URL=redis://redis:6379/0
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
profiles:
# Only start the celery_worker when explicitly requested:
# docker compose --profile celery up
# This keeps the default `docker compose up` lightweight (just Postgres + Redis).
- celery
volumes:
postgres_data: