-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathdocker-compose.yaml
133 lines (122 loc) · 2.48 KB
/
docker-compose.yaml
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
version: '3.9'
services:
api:
build: .
environment:
WORKERS: ${WORKERS:-2}
THREADS: ${THREADS:-2}
command: make migrate run.server.prod
ports:
- "${API_PORT}:80"
depends_on:
- pgbouncer
- migrations
- collectstatic
- redis
- rabbitmq
restart: always
volumes:
- .:/application
networks:
- main
bot:
build: .
command: make run.bot.prod
depends_on:
- api
restart: always
volumes:
- .:/application
networks:
- main
db:
image: postgres:latest
restart: unless-stopped
env_file:
- .env
environment:
POSTGRES_INITDB_ARGS: --auth=md5
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- main
pgbouncer:
image: edoburu/pgbouncer:latest
restart: unless-stopped
depends_on:
- db
environment:
- DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
- POOL_MODE=transaction
- MAX_CLIENT_CONN=1000
- DEFAULT_POOL_SIZE=20
- MIN_POOL_SIZE=5
- RESERVE_POOL_SIZE=5
- RESERVE_POOL_TIMEOUT=5
- SERVER_RESET_QUERY=DISCARD ALL
- SERVER_CHECK_QUERY=select 1
- LOG_CONNECTIONS=1
- LOG_DISCONNECTIONS=1
- LOG_POOLER_ERRORS=1
- STATS_PERIOD=60
- AUTH_TYPE=md5
volumes:
- pgbouncer-data:/var/lib/pgbouncer
networks:
- main
redis:
image: redis:latest
restart: unless-stopped
volumes:
- redis-data:/data
networks:
- main
rabbitmq:
image: rabbitmq:3-management
restart: unless-stopped
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER:-guest}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS:-guest}
volumes:
- rabbitmq-data:/var/lib/rabbitmq
ports:
- "${RABBITMQ_DASHBOARD_PORT:-15672}:15672"
networks:
- main
celery:
build: .
command: make run.celery.prod
restart: unless-stopped
depends_on:
- api
volumes:
- .:/application
networks:
- main
migrations:
build: .
command: make migrate
depends_on:
- db
volumes:
- .:/application
networks:
- main
collectstatic:
build: .
command: make collectstatic
depends_on:
- db
volumes:
- .:/application
networks:
- main
networks:
main:
ipam:
driver: default
volumes:
postgres-data:
pgbouncer-data:
redis-data:
rabbitmq-data: