-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
132 lines (124 loc) · 3.48 KB
/
docker-compose.yml
File metadata and controls
132 lines (124 loc) · 3.48 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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
x-flowker-mongodb-common:
&flowker-mongodb-common
build:
context: ./mongodb
dockerfile: Dockerfile
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_ROOT_USER}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_ROOT_PASSWORD}
MONGO_REPLICA_SET: ${MONGO_REPLICA_SET:-rs0}
command: >
bash -c "mongod --replSet $${MONGO_REPLICA_SET:-rs0} --bind_ip_all --keyFile /etc/mongodb/keyfile"
healthcheck:
test: ["CMD-SHELL", "mongosh \"mongodb://$$MONGO_INITDB_ROOT_USERNAME:$$MONGO_INITDB_ROOT_PASSWORD@localhost:27017/?authSource=admin\" --quiet --eval \"db.adminCommand('ping')\""]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
networks:
- flowker-network
services:
flowker:
container_name: flowker
restart: always
build:
context: .
dockerfile: Dockerfile
env_file:
- .env
ports:
- ${SERVER_PORT}:${SERVER_PORT}
healthcheck:
test: ["CMD", "/app", "--health"]
interval: 10s
timeout: 5s
retries: 3
start_period: 15s
depends_on:
flowker-mongodb-primary:
condition: service_healthy
flowker-audit-postgres:
condition: service_healthy
networks:
- flowker-network
# MongoDB Replica Set (Primary + 2 Secondaries)
flowker-mongodb-primary:
<<: *flowker-mongodb-common
container_name: flowker-mongodb-primary
ports:
- ${MONGO_PORT}:27017
volumes:
- mongodb-primary-data:/data/db
flowker-mongodb-secondary1:
<<: *flowker-mongodb-common
container_name: flowker-mongodb-secondary1
ports:
- ${MONGO_SECONDARY1_PORT}:27017
volumes:
- mongodb-secondary1-data:/data/db
depends_on:
flowker-mongodb-primary:
condition: service_healthy
flowker-mongodb-secondary2:
<<: *flowker-mongodb-common
container_name: flowker-mongodb-secondary2
ports:
- ${MONGO_SECONDARY2_PORT}:27017
volumes:
- mongodb-secondary2-data:/data/db
depends_on:
flowker-mongodb-primary:
condition: service_healthy
flowker-mongodb-init:
image: mongo:7.0
container_name: flowker-mongodb-init
env_file:
- .env
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_ROOT_USER}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_ROOT_PASSWORD}
MONGO_APP_USER: ${MONGO_APP_USER}
MONGO_APP_PASSWORD: ${MONGO_APP_PASSWORD}
MONGO_DB_NAME: ${MONGO_DB_NAME}
volumes:
- ./mongodb/init-replica.sh:/scripts/init-replica.sh:ro
command: ["bash", "/scripts/init-replica.sh"]
depends_on:
flowker-mongodb-primary:
condition: service_healthy
flowker-mongodb-secondary1:
condition: service_healthy
flowker-mongodb-secondary2:
condition: service_healthy
networks:
- flowker-network
restart: "no"
flowker-audit-postgres:
image: postgres:16-alpine
container_name: flowker-audit-postgres
restart: always
environment:
POSTGRES_USER: ${AUDIT_DB_USER}
POSTGRES_PASSWORD: ${AUDIT_DB_PASSWORD}
POSTGRES_DB: ${AUDIT_DB_NAME}
ports:
- "${AUDIT_DB_PORT}:5432"
volumes:
- audit-postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${AUDIT_DB_USER}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
networks:
- flowker-network
volumes:
mongodb-primary-data:
mongodb-secondary1-data:
mongodb-secondary2-data:
audit-postgres-data:
networks:
flowker-network:
driver: bridge