-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.multi-node.yml
More file actions
63 lines (60 loc) · 1.98 KB
/
Copy pathdocker-compose.multi-node.yml
File metadata and controls
63 lines (60 loc) · 1.98 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
# Multi-node demo: two scheduler nodes with disjoint static shard assignments.
# Node A owns shards 0-7; Node B owns shards 8-15 (of 16 total).
# Both share the same Postgres — SKIP LOCKED within each shard prevents double-dispatch.
#
# Usage:
# cp .env.example .env
# docker compose -f docker-compose.yml -f docker-compose.multi-node.yml up --build
#
# Submit jobs to localhost:8080 (node-a) or localhost:8081 (node-b).
# Jobs are hash-assigned to a shard; each node claims only its own partition.
services:
app:
deploy:
replicas: 0 # disable single-node service from docker-compose.yml
node-a:
build:
context: .
dockerfile: Dockerfile
depends_on:
postgres:
condition: service_healthy
environment:
DB_URL: jdbc:postgresql://postgres:5432/${DB_NAME:-kinetis}
DB_USER: ${DB_USER:-kinetis}
DB_PASSWORD: ${DB_PASSWORD:-kinetis}
SERVER_PORT: 8080
NODE_ID: node-a
SCHED_TOTAL_SHARDS: 16
SCHED_OWNED_SHARDS: "0-7"
LOG_LEVEL: ${LOG_LEVEL:-INFO}
ports:
- "8080:8080"
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:8080/actuator/health | grep -q UP || exit 1"]
interval: 5s
timeout: 3s
retries: 20
node-b:
build:
context: .
dockerfile: Dockerfile
depends_on:
postgres:
condition: service_healthy
environment:
DB_URL: jdbc:postgresql://postgres:5432/${DB_NAME:-kinetis}
DB_USER: ${DB_USER:-kinetis}
DB_PASSWORD: ${DB_PASSWORD:-kinetis}
SERVER_PORT: 8080
NODE_ID: node-b
SCHED_TOTAL_SHARDS: 16
SCHED_OWNED_SHARDS: "8-15"
LOG_LEVEL: ${LOG_LEVEL:-INFO}
ports:
- "8081:8080"
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:8080/actuator/health | grep -q UP || exit 1"]
interval: 5s
timeout: 3s
retries: 20