-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yaml
More file actions
147 lines (140 loc) · 3.76 KB
/
Copy pathcompose.yaml
File metadata and controls
147 lines (140 loc) · 3.76 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Unirust Cluster Compose Configuration
#
# Deploy a 3-shard cluster with router:
#
# podman-compose up -d
# podman-compose logs -f router
#
# Run loadtest:
# podman-compose run --rm loadtest --router http://router:50060 --count 100000
#
# Stop cluster while preserving data:
# podman-compose down
#
# Explicitly delete all shard data:
# podman-compose down -v
services:
# Shard nodes - horizontal scaling units
shard-0:
image: unirust:latest
build:
context: .
dockerfile: Containerfile
volumes:
- shard-0-data:/data
- shard-0-backup:/backup
- ./examples/loadtest-ontology.json:/etc/unirust/ontology.json:ro
command:
["shard", "--shard-id", "0", "--data-dir", "/data", "--backup-dir", "/backup", "--ontology", "/etc/unirust/ontology.json"]
environment:
UNIRUST_PROFILE: high-throughput
networks:
- unirust-net
healthcheck:
test: ["CMD", "unirust_healthcheck", "--shard", "http://127.0.0.1:50061"]
interval: 5s
timeout: 3s
retries: 5
start_period: 10s
shard-1:
image: unirust:latest
build:
context: .
dockerfile: Containerfile
command:
["shard", "--shard-id", "1", "--data-dir", "/data", "--backup-dir", "/backup", "--ontology", "/etc/unirust/ontology.json"]
volumes:
- shard-1-data:/data
- shard-1-backup:/backup
- ./examples/loadtest-ontology.json:/etc/unirust/ontology.json:ro
environment:
UNIRUST_PROFILE: high-throughput
networks:
- unirust-net
healthcheck:
test: ["CMD", "unirust_healthcheck", "--shard", "http://127.0.0.1:50061"]
interval: 5s
timeout: 3s
retries: 5
start_period: 10s
shard-2:
image: unirust:latest
build:
context: .
dockerfile: Containerfile
command:
["shard", "--shard-id", "2", "--data-dir", "/data", "--backup-dir", "/backup", "--ontology", "/etc/unirust/ontology.json"]
volumes:
- shard-2-data:/data
- shard-2-backup:/backup
- ./examples/loadtest-ontology.json:/etc/unirust/ontology.json:ro
environment:
UNIRUST_PROFILE: high-throughput
networks:
- unirust-net
healthcheck:
test: ["CMD", "unirust_healthcheck", "--shard", "http://127.0.0.1:50061"]
interval: 5s
timeout: 3s
retries: 5
start_period: 10s
# Router - client-facing entry point
router:
image: unirust:latest
build:
context: .
dockerfile: Containerfile
command:
[
"router",
"--shards",
"shard-0:50061,shard-1:50061,shard-2:50061",
"--ontology",
"/etc/unirust/ontology.json",
"--checkpoint-interval-secs",
"${UNIRUST_CHECKPOINT_INTERVAL_SECS:-3600}",
]
volumes:
- ./examples/loadtest-ontology.json:/etc/unirust/ontology.json:ro
ports:
- "127.0.0.1:50060:50060"
depends_on:
shard-0:
condition: service_healthy
shard-1:
condition: service_healthy
shard-2:
condition: service_healthy
networks:
- unirust-net
healthcheck:
test: ["CMD", "unirust_healthcheck", "--router", "http://127.0.0.1:50060"]
interval: 5s
timeout: 3s
retries: 5
start_period: 5s
# Loadtest runner (optional, run with: podman-compose run loadtest)
loadtest:
image: unirust:latest
build:
context: .
dockerfile: Containerfile
command:
["loadtest", "--router", "http://router:50060", "--count", "100000", "--streams", "8", "--headless"]
depends_on:
router:
condition: service_healthy
networks:
- unirust-net
profiles:
- tools
networks:
unirust-net:
driver: bridge
volumes:
shard-0-data:
shard-0-backup:
shard-1-data:
shard-1-backup:
shard-2-data:
shard-2-backup: