-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose-primary-replica.yml
More file actions
69 lines (64 loc) · 1.53 KB
/
docker-compose-primary-replica.yml
File metadata and controls
69 lines (64 loc) · 1.53 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
69
version: '1.0'
services:
primary:
container_name: primary
image: postgres:15.1
expose:
- 5432
env_file:
- ./primary-replica/db.env
restart: always
volumes:
- ./db_volumes/primary-replica/primary:/var/lib/postgresql/data
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgresql_user" , "-d", "postgresql_db"]
interval: 2s
timeout: 3s
retries: 5
networks:
my_network:
ipv4_address: 172.22.0.100
replica:
container_name: replica
image: postgres:15.1
expose:
- 5432
env_file:
- ./primary-replica/db.env
restart: always
volumes:
- ./db_volumes/primary-replica/replica:/var/lib/postgresql/data
- ./db_volumes/primary-replica/copy1:/var/lib/postgresql/primary_copy
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgresql_user" , "-d", "postgresql_db"]
interval: 2s
timeout: 3s
retries: 5
networks:
my_network:
ipv4_address: 172.22.0.101
backend:
build: ./backend
ports:
- 8000:8003
volumes:
- ./backend/:/usr/backend/
command: python3 run.py --primary_replica
env_file:
- ./backend/.env/.primary-replica.env
restart: always
depends_on:
primary:
condition: service_healthy
replica:
condition: service_healthy
networks:
my_network:
ipv4_address: 172.22.0.200
networks:
my_network:
driver: bridge
ipam:
config:
- subnet: 172.22.0.0/24
gateway: 172.22.0.1