-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose-app.yml
125 lines (115 loc) · 2.6 KB
/
docker-compose-app.yml
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
version: '3.8'
services:
db-app:
image: postgres:15.1-alpine
container_name: db-app
ports:
- 5433:5432
environment:
POSTGRES_USER: ylab
POSTGRES_PASSWORD: ylab
POSTGRES_DB: menuapp
networks:
- default
healthcheck:
test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
interval: 5s
timeout: 5s
retries: 3
cache-app:
image: redis:6.2-alpine
container_name: cache-app
volumes:
- ./redis-conf:/conf
environment:
REDIS_HOST: cache-app
REDIS_PORT: 6379
REDIS_DB: 0
command: redis-server /conf/default.conf
networks:
- netcache
ports:
- 6381:6379
healthcheck:
test: redis-cli ping
interval: 5s
timeout: 5s
retries: 10
api-app:
build:
context: ./src
dockerfile: Dockerfile.app
container_name: api-app
command: |
bash -c 'alembic upgrade head && uvicorn app.main:app --reload --workers 1 --host 0.0.0.0 --port 8000'
volumes:
- ./src:/src
- xls:/xls
ports:
- 8000:8000
environment:
DB_USER: ylab
DB_PASS: ylab
DB_NAME: menuapp
DB_HOST: db-app
REDIS_HOST: cache-app
REDIS_PORT: 6379
REDIS_DB: 0
RABBITMQ_USER: ylab
RABBITMQ_PASSWORD: ylab
RABBITMQ_HOST: broker-app
RABBITMQ_PORT: 5672
networks:
- default
- netcache
- netqueue
depends_on:
db-app:
condition: service_healthy
cache-app:
condition: service_healthy
broker-app:
image: rabbitmq:3.11-alpine
container_name: broker-app
networks:
- netqueue
ports:
- 5672:5672
- 15672:15672
environment:
RABBITMQ_DEFAULT_USER: ylab
RABBITMQ_DEFAULT_PASS: ylab
healthcheck:
test: ["CMD-SHELL", "rabbitmq-diagnostics -q ping"]
interval: 30s
timeout: 30s
retries: 3
worker-app:
build:
context: ./src
dockerfile: Dockerfile.app
container_name: worker-app
networks:
- netqueue
environment:
CELERY_BROKER_URL: amqp://ylab:ylab@broker-app:5672//
CELERY_BACKEND_URL: rpc://
command: celery --app=app:celeryapp worker --loglevel=INFO
volumes:
- xls:/xls
healthcheck:
test: ["CMD-SHELL", "celery inspect ping -A tasks.add -d celery@worker-app"]
interval: 1m30s
timeout: 30s
retries: 5
start_period: 30s
depends_on:
broker-app:
condition: service_healthy
api-app:
condition: service_started
networks:
netcache: {}
netqueue: {}
volumes:
xls: