-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.cluster.yml
More file actions
219 lines (211 loc) · 6.5 KB
/
docker-compose.cluster.yml
File metadata and controls
219 lines (211 loc) · 6.5 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
services:
# Initialize volumes and extract configs from HyperCache image
volume-init:
image: rishabhverma17/hypercache:latest
user: root
entrypoint: ["sh", "-c"]
command:
- |
mkdir -p /app/logs /shared/configs /shared/filebeat /shared/grafana &&
cp /app/configs/docker/* /shared/configs/ 2>/dev/null || true &&
cp /app/filebeat-docker.yml /shared/filebeat/filebeat.yml 2>/dev/null || true &&
cp -r /app/grafana/provisioning/* /shared/grafana/ 2>/dev/null || true &&
sed -i 's|/etc/grafana/provisioning/dashboards|/shared/grafana/dashboards|' /shared/grafana/dashboards/dashboard.yml 2>/dev/null || true &&
chown -R 1000:1000 /app/logs &&
chmod -R 755 /app/logs &&
echo 'Volumes initialized and configs extracted'
volumes:
- hypercache_logs:/app/logs
- shared_configs:/shared
restart: "no"
# HyperCache Node 1 (Bootstrap node)
hypercache-node1:
image: rishabhverma17/hypercache:latest
container_name: hypercache-node1
hostname: hypercache-node1
user: "1000:1000"
command: ["--config", "/shared/configs/node1-config.yaml", "--protocol", "resp"]
environment:
- NODE_ID=node-1
- CLUSTER_SEEDS=hypercache-node1:7946,hypercache-node2:7946,hypercache-node3:7946
- DATA_DIR=/data
- LOG_LEVEL=info
volumes:
- shared_configs:/shared:ro
- hypercache_node1_data:/data
- hypercache_logs:/app/logs
ports:
- "8080:8080" # RESP Protocol
- "9080:9080" # HTTP API
- "7946:7946" # Gossip Protocol
networks:
hypercache-cluster:
ipv4_address: 172.20.0.10
logging:
depends_on:
volume-init:
condition: service_completed_successfully
elasticsearch:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# HyperCache Node 2
hypercache-node2:
image: rishabhverma17/hypercache:latest
container_name: hypercache-node2
hostname: hypercache-node2
user: "1000:1000"
command: ["--config", "/shared/configs/node2-config.yaml", "--protocol", "resp"]
environment:
- NODE_ID=node-2
- CLUSTER_SEEDS=hypercache-node1:7946,hypercache-node2:7946,hypercache-node3:7946
- DATA_DIR=/data
- LOG_LEVEL=info
volumes:
- shared_configs:/shared:ro
- hypercache_node2_data:/data
- hypercache_logs:/app/logs
ports:
- "8081:8080" # RESP Protocol
- "9081:9080" # HTTP API
- "7947:7946" # Gossip Protocol
networks:
hypercache-cluster:
ipv4_address: 172.20.0.11
logging:
depends_on:
volume-init:
condition: service_completed_successfully
hypercache-node1:
condition: service_healthy
elasticsearch:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
# HyperCache Node 3
hypercache-node3:
image: rishabhverma17/hypercache:latest
container_name: hypercache-node3
hostname: hypercache-node3
user: "1000:1000"
command: ["--config", "/shared/configs/node3-config.yaml", "--protocol", "resp"]
environment:
- NODE_ID=node-3
- CLUSTER_SEEDS=hypercache-node1:7946,hypercache-node2:7946,hypercache-node3:7946
- DATA_DIR=/data
- LOG_LEVEL=info
volumes:
- shared_configs:/shared:ro
- hypercache_node3_data:/data
- hypercache_logs:/app/logs
ports:
- "8082:8080" # RESP Protocol
- "9082:9080" # HTTP API
- "7948:7946" # Gossip Protocol
networks:
hypercache-cluster:
ipv4_address: 172.20.0.12
logging:
depends_on:
volume-init:
condition: service_completed_successfully
hypercache-node1:
condition: service_healthy
elasticsearch:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:9080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
# Include existing logging infrastructure
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.11.0
container_name: hypercache-elasticsearch
environment:
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
- xpack.security.enabled=false
- xpack.security.enrollment.enabled=false
- xpack.security.http.ssl.enabled=false
- xpack.security.transport.ssl.enabled=false
ports:
- "9200:9200"
- "9300:9300"
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
networks:
- logging
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:9200/_cluster/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
filebeat:
image: docker.elastic.co/beats/filebeat:8.11.0
container_name: hypercache-filebeat
user: root
volumes:
- shared_configs:/shared:ro
- hypercache_logs:/var/log/hypercache:ro
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
command: ["filebeat", "-e", "-c", "/shared/filebeat/filebeat.yml"]
depends_on:
volume-init:
condition: service_completed_successfully
elasticsearch:
condition: service_healthy
networks:
- logging
restart: unless-stopped
grafana:
image: grafana/grafana:10.2.0
container_name: hypercache-grafana
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin123
- GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource
- GF_PATHS_PROVISIONING=/shared/grafana
volumes:
- grafana_data:/var/lib/grafana
- shared_configs:/shared
depends_on:
elasticsearch:
condition: service_healthy
networks:
- logging
restart: unless-stopped
volumes:
hypercache_node1_data:
hypercache_node2_data:
hypercache_node3_data:
hypercache_logs:
shared_configs:
elasticsearch_data:
grafana_data:
networks:
hypercache-cluster:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16
logging:
driver: bridge
ipam:
config:
- subnet: 172.21.0.0/16