forked from corruptmane/aiogram_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
80 lines (76 loc) · 2.11 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
version: "3.3"
services:
bot:
container_name: "${BOT_NAME}-bot"
image: ${BOT_IMAGE_NAME}
build:
context: .
stop_signal: SIGINT
command: python -O bot.py
restart: unless-stopped
expose:
- 8443
env_file:
- ".env"
environment:
DB_HOST: database
REDIS_HOST: redis
depends_on:
database:
condition: service_healthy
redis:
condition: service_healthy
networks:
- botnet
database:
container_name: "${BOT_NAME}-database"
image: postgres:14-alpine
ports:
- "127.0.0.1:${DB_PORT}:${DB_PORT}"
restart: unless-stopped
volumes:
- ./pgdata:/var/lib/postgresql/data
command: "postgres -c max_connections=150 -c shared_buffers=512MB -c effective_cache_size=1536MB
-c maintenance_work_mem=128MB -c checkpoint_completion_target=0.9 -c wal_buffers=16MB
-c default_statistics_target=100 -c random_page_cost=1.1 -c effective_io_concurrency=200
-c work_mem=3495kB -c min_wal_size=1GB -c max_wal_size=4GB -c max_worker_processes=2
-c max_parallel_workers_per_gather=1 -c max_parallel_workers=2 -c max_parallel_maintenance_workers=1"
env_file:
- ".env"
environment:
POSTGRES_USER: $DB_USER
POSTGRES_PASSWORD: $DB_PASS
POSTGRES_DB: $DB_NAME
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"
healthcheck:
test: "pg_isready -d ${DB_NAME} -U ${DB_USER}"
interval: 3s
retries: 5
timeout: 15s
networks:
- botnet
redis:
container_name: "${BOT_NAME}-redis"
image: redis:7-alpine
env_file:
- ".env"
command: "redis-server --requirepass ${REDIS_PASS} --port ${REDIS_PORT}"
ports:
- "127.0.0.1:${REDIS_PORT}:${REDIS_PORT}"
volumes:
- ./redisdata:/var/lib/redis
restart: unless-stopped
healthcheck:
test: "[ $$(redis-cli -h redis -p ${REDIS_PORT} -a ${REDIS_PASS} ping) = 'PONG' ] || exit 1"
interval: 3s
retries: 5
timeout: 15s
networks:
- botnet
networks:
botnet:
driver: bridge