-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
94 lines (88 loc) · 2.38 KB
/
Copy pathdocker-compose.yml
File metadata and controls
94 lines (88 loc) · 2.38 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
services:
mongo1:
image: mongo:7
command: ["mongod", "--replSet", "rs0", "--bind_ip_all"]
restart: unless-stopped
volumes:
- mongo1_data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
mongo2:
image: mongo:7
command: ["mongod", "--replSet", "rs0", "--bind_ip_all"]
restart: unless-stopped
volumes:
- mongo2_data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
mongo3:
image: mongo:7
command: ["mongod", "--replSet", "rs0", "--bind_ip_all"]
restart: unless-stopped
volumes:
- mongo3_data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
mongo-rs-init:
image: mongo:7
restart: "no"
volumes:
- ./docker/mongo-rs-init.js:/init.js:ro
depends_on:
mongo1:
condition: service_healthy
mongo2:
condition: service_healthy
mongo3:
condition: service_healthy
command: ["mongosh", "--host", "mongo1", "--port", "27017", "--file", "/init.js"]
app:
build: .
restart: unless-stopped
ports:
- "3000:3000"
environment:
PORT: 3000
MONGO_URI: mongodb://mongo1:27017,mongo2:27017,mongo3:27017/?replicaSet=rs0
DB_NAME: test_filter_service
depends_on:
mongo-rs-init:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:3000/health"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
# Локальная Mongo для разработки на хосте (npm run dev). Не поднимается при обычном `docker compose up`.
mongo-dev:
profiles: ["local-mongo"]
image: mongo:7
container_name: test-filter-mongo-dev
ports:
- "${MONGO_DEV_PORT:-27017}:27017"
volumes:
- mongo_dev_data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 5s
timeout: 5s
retries: 5
start_period: 10s
volumes:
mongo1_data:
mongo2_data:
mongo3_data:
mongo_dev_data: