-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
126 lines (118 loc) · 2.9 KB
/
Copy pathdocker-compose.yml
File metadata and controls
126 lines (118 loc) · 2.9 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
x-common: &common
env_file:
- .env
environment:
PYTHONUNBUFFERED: "1"
restart: unless-stopped
networks:
- taskqueue-net
services:
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
container_name: tq-mssql
environment:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: ${MSSQL_PASSWORD}
MSSQL_PID: Developer
ports:
- "1433:1433"
volumes:
- mssql_data:/var/opt/mssql
- ./docker/mssql/init.sql:/init/init.sql:ro
- ./docker/mssql/entrypoint.sh:/init/entrypoint.sh:ro
command: ["/bin/bash", "/init/entrypoint.sh"]
healthcheck:
test: /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "${MSSQL_PASSWORD}" -d "${MSSQL_DATABASE}" -C -Q "SELECT 1" || exit 1
interval: 15s
timeout: 5s
retries: 10
start_period: 60s
<<: *common
redis:
image: redis:7-alpine
container_name: tq-redis
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
<<: *common
rabbitmq:
image: rabbitmq:3.13-management-alpine
container_name: tq-rabbitmq
ports:
- "5672:5672"
- "15672:15672"
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "check_port_connectivity"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
<<: *common
api:
build: .
container_name: tq-api
ports:
- "8000:8000"
depends_on:
rabbitmq:
condition: service_healthy
redis:
condition: service_healthy
mssql:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
command: >
sh -c "uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload"
<<: *common
job_worker:
build: .
container_name: tq-job-worker
depends_on:
rabbitmq:
condition: service_healthy
redis:
condition: service_healthy
mssql:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "docker/healthcheck.py", "rabbitmq:5672", "redis:6379", "mssql:1433"]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
command: >
sh -c "python -m app.workers.job_worker"
<<: *common
webhook_worker:
build: .
container_name: tq-webhook-worker
depends_on:
rabbitmq:
condition: service_healthy
redis:
condition: service_healthy
mssql:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "docker/healthcheck.py", "rabbitmq:5672", "redis:6379", "mssql:1433"]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
command: >
sh -c "python -m app.workers.webhook_worker"
<<: *common
volumes:
mssql_data:
networks:
taskqueue-net:
driver: bridge