Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
107 lines (98 loc) · 2.56 KB
/
Copy pathdocker-compose.yml
File metadata and controls
107 lines (98 loc) · 2.56 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
# This is a sample of what can a docker-compose.yml be. I know it not makes sense here.
# But hey, this is a boilerplate after all.
name: fastapi-kit
services:
app:
container_name: fastapi_kit_backend
build:
context: .
dockerfile: Dockerfile
env_file:
- .env.production
ports:
- "${APP_HOST_PORT}:8000"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
restart: unless-stopped
db:
image: postgres:14-alpine
container_name: fastapi_kit_db
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
ports:
- "${POSTGRES_HOST_PORT}:5432"
volumes:
- pg_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
redis:
image: redis:6-alpine
container_name: fastapi_kit_redis
command: redis-server --requirepass ${REDIS_PASSWORD}
environment:
- REDIS_USERNAME=default
- REDIS_PASSWORD=${REDIS_PASSWORD}
ports:
- "${REDIS_HOST_PORT}:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
restart: unless-stopped
rabbitmq:
image: rabbitmq:4-management-alpine
container_name: fastapi_kit_rabbitmq
environment:
- RABBITMQ_HOST_PORT=${RABBITMQ_HOST_PORT}
- RABBITMQ_MANAGEMENT_HOST_PORT=${RABBITMQ_MANAGEMENT_HOST_PORT}
ports:
- "${RABBITMQ_HOST_PORT}:5672"
- "${RABBITMQ_MANAGEMENT_HOST_PORT}:15672"
volumes:
- rabbitmq_data:/var/lib/rabbitmq
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "ping"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
celery:
container_name: fastapi_kit_celery
build:
context: .
dockerfile: Dockerfile
env_file:
- .env.production
entrypoint: []
command: celery -A config.base:celery_app worker --loglevel=INFO -Q celery,otp_email
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
healthcheck:
test: ["CMD", "celery", "-A", "config.base:celery_app", "status"]
interval: 30s
timeout: 10s
retries: 5
restart: unless-stopped
volumes:
pg_data:
redis_data:
rabbitmq_data: