-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
177 lines (168 loc) · 4.41 KB
/
docker-compose.yml
File metadata and controls
177 lines (168 loc) · 4.41 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
version: "3.9"
services:
db:
image: postgres:16
container_name: postgres-db
restart: always
env_file:
- .env
environment:
POSTGRES_USER: ${POSTGRES_USER:?POSTGRES_USER not set}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD not set}
POSTGRES_DB: ${POSTGRES_DB:?POSTGRES_DB not set}
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- kaapi-postgres:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 10s
retries: 5
start_period: 30s
ports:
- "5432:5432"
redis:
image: redis:7
container_name: redis
restart: always
env_file:
- .env
command: >
sh -c "if [ -n \"${REDIS_PASSWORD}\" ]; then
redis-server --requirepass \"${REDIS_PASSWORD}\";
else
redis-server;
fi"
volumes:
- kaapi-redis:/data
ports:
- "6379:6379"
healthcheck:
test: ["CMD-SHELL", "if [ -n \"${REDIS_PASSWORD}\" ]; then redis-cli -a \"${REDIS_PASSWORD}\" ping; else redis-cli ping; fi"]
interval: 10s
timeout: 10s
retries: 5
start_period: 10s
rabbitmq:
image: rabbitmq:3-management
container_name: rabbitmq
restart: always
env_file:
- .env
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER:?RABBITMQ_USER not set}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD:?RABBITMQ_PASSWORD not set}
RABBITMQ_DEFAULT_VHOST: ${RABBITMQ_VHOST:?RABBITMQ_VHOST not set}
volumes:
- kaapi-rabbitmq:/var/lib/rabbitmq
ports:
- "5672:5672"
- "15672:15672"
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "check_port_connectivity"]
interval: 10s
timeout: 10s
retries: 5
start_period: 20s
adminer:
image: adminer
container_name: adminer
restart: always
depends_on:
- db
environment:
- ADMINER_DESIGN=pepa-linha-dark
ports:
- "8080:8080"
prestart:
image: "${DOCKER_IMAGE_BACKEND?Variable not set}:${TAG-latest}"
container_name: prestart
build:
context: ./backend
depends_on:
db:
condition: service_healthy
restart: true
command: bash scripts/prestart.sh
env_file:
- .env
environment:
POSTGRES_SERVER: db
profiles: ["prestart"]
backend:
image: "${DOCKER_IMAGE_BACKEND?Variable not set}:${TAG:-latest}"
container_name: backend
restart: always
build:
context: ./backend
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
env_file:
- .env
environment:
POSTGRES_SERVER: db
REDIS_HOST: redis
RABBITMQ_HOST: rabbitmq
ports:
- "8000:80"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80/api/v1/utils/health/"]
interval: 10s
timeout: 5s
retries: 5
command: >
uv run uvicorn app.main:app --host 0.0.0.0 --port 80 --reload
develop:
watch:
# Sync backend source code into container immediately on change
- action: sync
path: ./backend/app
target: /app/app
# Rebuild image if dependencies change
- action: rebuild
path: ./backend/pyproject.toml
- action: rebuild
path: ./backend/uv.lock
celery_worker:
image: "${DOCKER_IMAGE_BACKEND?Variable not set}:${TAG:-latest}"
container_name: celery-worker
restart: always
build:
context: ./backend
depends_on:
backend:
condition: service_healthy
env_file:
- .env
environment:
POSTGRES_SERVER: db
REDIS_HOST: redis
RABBITMQ_HOST: rabbitmq
command: ["uv", "run", "celery", "-A", "app.celery.celery_app", "worker", "--loglevel=info"]
celery_flower:
image: "${DOCKER_IMAGE_BACKEND?Variable not set}:${TAG:-latest}"
container_name: celery-flower
restart: always
build:
context: ./backend
depends_on:
backend:
condition: service_healthy
env_file:
- .env
ports:
- "5555:5555"
environment:
POSTGRES_SERVER: db
REDIS_HOST: redis
RABBITMQ_HOST: rabbitmq
command: ["uv", "run", "celery", "-A", "app.celery.celery_app", "flower", "--port=5555"]
volumes:
kaapi-postgres:
kaapi-redis:
kaapi-rabbitmq: