-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
133 lines (127 loc) · 3.4 KB
/
Copy pathdocker-compose.yml
File metadata and controls
133 lines (127 loc) · 3.4 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
services:
# PostgreSQL Database
db:
image: postgres:15-alpine
container_name: webhook_db
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-webhook_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-webhook_password}
POSTGRES_DB: ${POSTGRES_DB:-webhook_db}
TZ: Asia/Taipei
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-webhook_user} -d ${POSTGRES_DB:-webhook_db}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- webhook-network
# RabbitMQ Message Broker
rabbitmq:
image: rabbitmq:3-management-alpine
container_name: webhook_rabbitmq
restart: unless-stopped
ports:
- "5672:5672" # AMQP port
- "15672:15672" # Management UI
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER:-admin}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD:-admin}
TZ: Asia/Taipei
volumes:
- rabbitmq_data:/var/lib/rabbitmq
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "ping"]
interval: 30s
timeout: 10s
retries: 3
networks:
- webhook-network
# API Server (Backend)
api:
build:
context: .
dockerfile: Dockerfile
target: production
container_name: webhook_api
restart: unless-stopped
ports:
- "8000:8000"
depends_on:
db:
condition: service_healthy
rabbitmq:
condition: service_healthy
environment:
- DATABASE_URL=postgresql+asyncpg://${POSTGRES_USER:-webhook_user}:${POSTGRES_PASSWORD:-webhook_password}@db:5432/${POSTGRES_DB:-webhook_db}
- RABBITMQ_URL=amqp://${RABBITMQ_USER:-admin}:${RABBITMQ_PASSWORD:-admin}@rabbitmq:5672/
- USE_SQLITE=false
- USE_MEMORY_BROKER=false
- DEVELOPMENT=false
- API_KEY=${API_KEY:-change-me-in-production}
- CORS_ORIGINS=["*"]
- TZ=Asia/Taipei
env_file:
- .env
volumes:
- ./logs:/app/logs
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
networks:
- webhook-network
# TaskIQ Worker
worker:
build:
context: .
dockerfile: Dockerfile
target: production
container_name: webhook_worker
restart: unless-stopped
command: taskiq worker app.taskiq.broker_manager:broker
depends_on:
db:
condition: service_healthy
rabbitmq:
condition: service_healthy
environment:
- DATABASE_URL=postgresql+asyncpg://${POSTGRES_USER:-webhook_user}:${POSTGRES_PASSWORD:-webhook_password}@db:5432/${POSTGRES_DB:-webhook_db}
- RABBITMQ_URL=amqp://${RABBITMQ_USER:-admin}:${RABBITMQ_PASSWORD:-admin}@rabbitmq:5672/
- USE_SQLITE=false
- USE_MEMORY_BROKER=false
- DEVELOPMENT=false
- TZ=Asia/Taipei
env_file:
- .env
volumes:
- ./logs:/app/logs
networks:
- webhook-network
# Frontend (Nginx + React App)
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: webhook_frontend
restart: unless-stopped
ports:
- "80:80"
environment:
- TZ=Asia/Taipei
depends_on:
api:
condition: service_healthy
networks:
- webhook-network
networks:
webhook-network:
driver: bridge
volumes:
postgres_data:
rabbitmq_data: