-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yaml
110 lines (102 loc) · 2.58 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
98
99
100
101
102
103
104
105
106
107
108
109
110
version: '3.8'
name: database-synchronization-app
services:
rabbitmq:
image: rabbitmq:management
restart: on-failure
ports:
- "15672:15672" # RabbitMQ management UI
networks:
- app_network
head_office_db:
image: postgres:16
restart: on-failure
environment:
- POSTGRES_PASSWORD=/run/secrets/db_password
- POSTGRES_USER=/run/secrets/db_username
- POSTGRES_DB=${DB_NAME:-db}
entrypoint: /usr/local/bin/database_entrypoint.sh
volumes:
- ${SSL_DIR:?}:/ssl
- ./scripts/database_entrypoint.sh:/usr/local/bin/database_entrypoint.sh
secrets:
- db_username
- db_password
networks:
- head_network
head_office:
image: omarbesbes/database-synchronization-app:head-office
build:
context: .
args:
OFFICE_TYPE: head
restart: on-failure
env_file:
- apps/head/.env.example
environment:
- RABBITMQ_URL=amqp://guest:guest@rabbitmq:5672
- DB_TYPE=postgres
- DB_HOST=head_office_db
- DB_PORT=5432
- DB_NAME=${DB_NAME:-db}
- DB_PASSWORD=/run/secrets/db_password
- DB_USERNAME=/run/secrets/db_username
secrets:
- db_username
- db_password
depends_on:
- rabbitmq
networks:
- app_network
- head_network
branch_office_db:
image: postgres:16
restart: on-failure
environment:
- POSTGRES_PASSWORD=/run/secrets/db_password
- POSTGRES_USER=/run/secrets/db_username
- POSTGRES_DB=${DB_NAME:-db}
entrypoint: /usr/local/bin/database_entrypoint.sh
volumes:
- ${SSL_DIR:?}:/ssl
- ./scripts/database_entrypoint.sh:/usr/local/bin/database_entrypoint.sh
secrets:
- db_username
- db_password
networks:
- branch_network
branch_office:
image: omarbesbes/database-synchronization-app:branch-office
build:
context: .
args:
OFFICE_TYPE: branch
restart: on-failure
env_file:
- apps/branch/.env.example
environment:
- RABBITMQ_URL=amqp://guest:guest@rabbitmq:5672
- DB_TYPE=postgres
- DB_HOST=branch_office_db
- DB_PORT=5432
- DB_NAME=${DB_NAME:-db}
- DB_PASSWORD=/run/secrets/db_password
- DB_USERNAME=/run/secrets/db_username
secrets:
- db_username
- db_password
depends_on:
- rabbitmq
- head_office
networks:
- app_network
- branch_network
secrets:
db_password:
file: ${SECRETS_DIR:?}/db_password.txt
db_username:
file: ${SECRETS_DIR:?}/db_username.txt
networks:
app_network:
head_network:
branch_network: