-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yml
More file actions
68 lines (65 loc) · 1.94 KB
/
compose.yml
File metadata and controls
68 lines (65 loc) · 1.94 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
name: "db-service"
services:
postgres-master:
container_name: postgres-master
image: postgres:17-alpine
restart: always
env_file:
- ./db/master/.env
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
PGDATA: /var/lib/postgresql/data/pgdata
ports:
- "5432:5432"
volumes:
- postgres_master_data:/var/lib/postgresql/data
- ./db/master/postgresql.conf:/etc/postgresql/postgresql.conf:ro
- ./db/master/pg_hba.conf:/etc/postgresql/pg_hba.conf:ro
command:
- "postgres"
- "-c"
- "config_file=/etc/postgresql/postgresql.conf"
- "-c"
- "hba_file=/etc/postgresql/pg_hba.conf"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
postgres-replica:
container_name: postgres-replica
image: postgres:17-alpine
restart: always
env_file:
- ./db/replica/.env
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
PGDATA: /var/lib/postgresql/data/pgdata
ports:
- "5433:5432"
depends_on:
postgres-master:
condition: service_healthy
volumes:
- postgres_replica_data:/var/lib/postgresql/data
- ./db/replica/postgresql.conf:/etc/postgresql/postgresql.conf:ro
- ./db/replica/pg_hba.conf:/etc/postgresql/pg_hba.conf:ro
- ./db/replica/init-replica.sh:/docker-entrypoint-initdb.d/init-replica.sh:ro
command:
- "postgres"
- "-c"
- "config_file=/etc/postgresql/postgresql.conf"
- "-c"
- "hba_file=/etc/postgresql/pg_hba.conf"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
volumes:
postgres_master_data:
postgres_replica_data: