-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
65 lines (59 loc) · 1.27 KB
/
docker-compose.yml
File metadata and controls
65 lines (59 loc) · 1.27 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
services:
# --- Feature 1: Legacy API ---
legacy_api:
build:
context: .
dockerfile: Dockerfile.legacy
container_name: legacy_api
ports:
- "8001:8001"
networks:
- cache-net
# --- Feature 2: PostgreSQL Database ---
db:
image: postgres:15-alpine
container_name: postgres_db
environment:
POSTGRES_USER: admin
POSTGRES_PASSWORD: password123
POSTGRES_DB: cache_db
ports:
- "5432:5432"
networks:
- cache-net
volumes:
- ./init_db.sql:/docker-entrypoint-initdb.d/init_db.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U admin -d cache_db"]
interval: 5s
timeout: 5s
retries: 5
# --- Cache Cluster ---
base-node: &base-node
build: .
depends_on:
db:
condition: service_healthy
networks:
- cache-net
node1:
<<: *base-node
container_name: node1
command: python server.py node1:50051
ports:
- "50051:50051"
node2:
<<: *base-node
container_name: node2
command: python server.py node2:50052
ports:
- "50052:50052"
node3:
<<: *base-node
container_name: node3
command: python server.py node3:50053
ports:
- "50053:50053"
networks:
cache-net:
driver: bridge