forked from RiyaluxInnovates/PaksaFinancialSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
77 lines (71 loc) · 1.94 KB
/
Copy pathdocker-compose.yml
File metadata and controls
77 lines (71 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
69
70
71
72
73
74
75
76
77
version: '3.8'
services:
db:
image: postgres:15
environment:
POSTGRES_DB: paksa_financial
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_REPLICATION_USER: replicator
POSTGRES_REPLICATION_PASSWORD: replicator_password
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./postgres/postgresql.conf:/etc/postgresql/postgresql.conf
- ./postgres/pg_hba.conf:/etc/postgresql/pg_hba.conf
command: postgres -c config_file=/etc/postgresql/postgresql.conf
db_replica:
image: postgres:15
environment:
POSTGRES_DB: paksa_financial
POSTGRES_USER: user
POSTGRES_PASSWORD: password
PGUSER: postgres
ports:
- "5433:5432"
volumes:
- postgres_replica_data:/var/lib/postgresql/data
depends_on:
- db
command: |
bash -c '
until pg_basebackup --pgdata=/var/lib/postgresql/data --format=p --write-recovery-conf --checkpoint=fast --label=myclone --host=db --port=5432 --username=replicator --verbose --progress --wal-method=stream; do
echo "Waiting for master to connect..."
sleep 1s
done
echo "Backup done, starting replica..."
chmod 0700 /var/lib/postgresql/data
postgres
'
redis:
image: redis:7-alpine
ports:
- "6379:6379"
backend:
build: ./backend
ports:
- "8000:8000"
environment:
DATABASE_URL: postgresql+asyncpg://user:password@db/paksa_financial
DATABASE_READ_REPLICA_URL: postgresql+asyncpg://user:password@db_replica/paksa_financial
USE_READ_REPLICA: "true"
REDIS_URL: redis://redis:6379
ENVIRONMENT: development
DEBUG: "true"
depends_on:
- db
- redis
volumes:
- ./backend:/app
frontend:
build: ./frontend
ports:
- "3000:3000"
volumes:
- ./frontend:/app
depends_on:
- backend
volumes:
postgres_data:
postgres_replica_data: