-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
140 lines (133 loc) · 3.91 KB
/
docker-compose.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
version: "3.8"
services:
api:
build: .
container_name: newsletter_api
depends_on:
- broker
- db
env_file:
- .env
environment:
- CELERY_BROKER_URL=redis://newsletter_broker:6379/0
- CELERY_RESULT_BACKEND_URL=redis://newsletter_broker:6379/1
- DATABASE_URL=postgresql://postgres:iUFXkPr7_!nm98EY@newsletter_db:5432/newsletter
healthcheck:
interval: 20s
retries: 3
start_period: 10s
test: ["CMD", "curl", "-f", "http://0.0.0.0:8000/v1/health"]
timeout: 5s
image: newsletter_api:1.0
networks:
newsletter_net:
aliases:
- newsletter_api
ports:
- "8000:8000"
volumes:
- ./app/:/opt/api/app/
- ./utils/:/opt/api/utils/
- ./manage.py:/opt/api/manage.py
- ./Pipfile:/opt/api/Pipfile
- ./Pipfile.lock:/opt/api/Pipfile.lock
db:
container_name: newsletter_db
environment:
- PG_DATA=/var/lib/postgresql/data/pgdata
- POSTGRES_DB=newsletter
- POSTGRES_PASSWORD=iUFXkPr7_!nm98EY
- POSTGRES_USER=postgres
healthcheck:
interval: 20s
retries: 3
start_period: 10s
test:
[
"CMD-SHELL",
"sh -c 'pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}'",
]
timeout: 5s
image: postgres:15
networks:
newsletter_net:
aliases:
- newsletter_db
ports:
- "5432:5432"
volumes:
- newsletter_db:/var/lib/postgresql/data
broker:
command: ["redis-server", "--save", "60", "1", "--loglevel", "warning"]
container_name: newsletter_broker
healthcheck:
interval: 20s
retries: 3
start_period: 10s
test: ["CMD", "redis-cli", "ping"]
timeout: 5s
image: redis:6.2
networks:
newsletter_net:
aliases:
- newsletter_broker
ports:
- "6379:6379"
volumes:
- newsletter_broker:/data
tasks:
command: ["pipenv", "run", "tasks"]
container_name: newsletter_tasks
depends_on:
- api
- broker
- db
- smtp
env_file:
- .env
environment:
- CELERY_BROKER_URL=redis://newsletter_broker:6379/0
- CELERY_RESULT_BACKEND_URL=redis://newsletter_broker:6379/1
- DATABASE_URL=postgresql://postgres:iUFXkPr7_!nm98EY@newsletter_db:5432/newsletter
- MAIL_PORT=1025
- MAIL_SERVER=newsletter_smtp
- MAIL_USE_TLS=False
healthcheck:
interval: 20s
retries: 3
start_period: 10s
test: ["CMD", "pipenv", "run", "celery", "inspect", "ping"]
timeout: 5s
image: newsletter_api:1.0
networks:
newsletter_net:
aliases:
- newsletter_tasks
smtp:
container_name: newsletter_smtp
healthcheck:
interval: 20s
retries: 3
start_period: 10s
test: ["CMD", "echo | telnet 127.0.0.1 8025"]
timeout: 5s
image: mailhog/mailhog
networks:
newsletter_net:
aliases:
- newsletter_smtp
ports:
- "1025:1025"
- "8025:8025"
networks:
newsletter_net:
driver: bridge
ipam:
config:
- subnet: 192.20.20.0/24
name: newsletter_net
volumes:
newsletter_db:
name: newsletter_db
newsletter_broker:
name: newsletter_broker