-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
97 lines (85 loc) · 2 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
services:
readreplica:
build: postgresreplica
env_file:
- .env
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
PG_REP_USER: ${PG_REP_USER}
PG_REP_PASSWORD: ${PG_REP_PASSWORD}
PG_MAS_HOST: ${PG_MAS_HOST}
ports:
- ${PG_S_PORT}:${PG_MAS_PORT}
depends_on:
postgresmaster:
condition: service_healthy
restart: always
logging:
options:
max-size: '10m'
max-file: '5'
labels: 'replica'
networks:
default:
aliases:
- pgreplica
- pgbouncer
postgresmaster:
build: postgresmaster
env_file:
- .env
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
PG_REP_USER: ${PG_REP_USER}
PG_REP_PASSWORD: ${PG_REP_PASSWORD}
ports:
- ${PG_MAS_PORT}:${PG_MAS_PORT}
restart: always
logging:
options:
max-size: '10m'
max-file: '5'
labels: 'production'
volumes:
- pg_data:/var/lib/postgresql/data
- pg_logs:/var/log/postgresql
command: postgres -c config_file='/etc/postgresql/postgresql.conf' -c hba_file='/etc/postgresql/pg_hba.conf'
networks:
default:
aliases:
- pgreplica
- pgbouncer
healthcheck:
test: pg_isready -d $POSTGRES_DB -U $POSTGRES_USER
interval: 15s
timeout: 15s
retries: 3
start_period: 10s
pgbouncer:
build: pgbouncer
env_file:
- .env
ports:
- ${PG_BOUNCER_PORT}:${PGBOUNCER_LISTEN_PORT}
restart: always
logging:
options:
max-size: '10m'
max-file: '5'
labels: 'pgbouncer'
depends_on:
postgresmaster:
condition: service_healthy
volumes:
- ./pgbouncer/pgbouncer.log:/var/log/pgbouncer.log:rw
networks:
default:
aliases:
- pgreplica
- pgbouncer
volumes:
pg_data:
pg_logs: