This repository was archived by the owner on Jun 15, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathdocker-compose.separated.yml
More file actions
396 lines (374 loc) · 12.7 KB
/
Copy pathdocker-compose.separated.yml
File metadata and controls
396 lines (374 loc) · 12.7 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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
services:
redis:
image: redis:8-alpine
volumes:
- redis-data:/data
command: redis-server --appendonly yes --maxmemory 2gb
ports:
# defaulting to expose on 6380 to avoid conflicts with existing redis which is the most common scenario
- "127.0.0.1:${REDIS_EXTERNAL_PORT:-6380}:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
networks:
- sequencer-net
# P2P Gateway - Singleton for ALL P2P communication
p2p-gateway:
build:
context: .
dockerfile: Dockerfile.p2p-gateway
environment:
- SEQUENCER_ID=${SEQUENCER_ID:-validator1}
- P2P_PORT=${P2P_PORT:-9001}
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_DB=${REDIS_DB:-0}
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
- BOOTSTRAP_PEERS=${BOOTSTRAP_PEERS}
- BOOTSTRAP_MULTIADDR=${BOOTSTRAP_MULTIADDR}
- RENDEZVOUS_POINT=${RENDEZVOUS_POINT:-powerloom-snapshot-sequencer-network}
- PRIVATE_KEY=${PRIVATE_KEY}
- PUBLIC_IP=${PUBLIC_IP}
- DEBUG_MODE=${DEBUG_MODE:-false}
# Protocol/Market config
- PROTOCOL_STATE_CONTRACT=${PROTOCOL_STATE_CONTRACT}
- DATA_MARKET_ADDRESSES=${DATA_MARKET_ADDRESSES}
# Gossipsub topic configuration
- GOSSIPSUB_SNAPSHOT_SUBMISSION_PREFIX=${GOSSIPSUB_SNAPSHOT_SUBMISSION_PREFIX:-/powerloom/snapshot-submissions}
- GOSSIPSUB_FINALIZED_BATCH_PREFIX=${GOSSIPSUB_FINALIZED_BATCH_PREFIX:-/powerloom/finalized-batches}
- GOSSIPSUB_VALIDATOR_PRESENCE_TOPIC=${GOSSIPSUB_VALIDATOR_PRESENCE_TOPIC:-/powerloom/validator/presence}
- GOSSIPSUB_CONSENSUS_VOTES_TOPIC=${GOSSIPSUB_CONSENSUS_VOTES_TOPIC:-/powerloom/consensus/votes}
- GOSSIPSUB_CONSENSUS_PROPOSALS_TOPIC=${GOSSIPSUB_CONSENSUS_PROPOSALS_TOPIC:-/powerloom/consensus/proposals}
depends_on:
redis:
condition: service_healthy
ports:
- "${P2P_PORT:-9001}:${P2P_PORT:-9001}"
networks:
- sequencer-net
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Dequeuer - Processes submissions from Redis queue (scalable)
dequeuer:
build:
context: .
dockerfile: Dockerfile.snapshot-sequencer
environment:
- SEQUENCER_ID=${SEQUENCER_ID:-validator1}
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_DB=${REDIS_DB:-0}
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
- DEBUG_MODE=${DEBUG_MODE:-false}
# Component toggles - ONLY DEQUEUER
- ENABLE_LISTENER=false
- ENABLE_DEQUEUER=true
- ENABLE_FINALIZER=false
- ENABLE_BATCH_AGGREGATION=false
- ENABLE_EVENT_MONITOR=false
# Dequeuer specific
- DEQUEUER_WORKERS=${DEQUEUER_WORKERS:-5}
- MAX_SUBMISSIONS_PER_EPOCH=${MAX_SUBMISSIONS_PER_EPOCH:-100}
# Identity verification
- SKIP_IDENTITY_VERIFICATION=${SKIP_IDENTITY_VERIFICATION:-false}
- CHECK_FLAGGED_SNAPSHOTTERS=${CHECK_FLAGGED_SNAPSHOTTERS:-true}
- VERIFICATION_CACHE_TTL=${VERIFICATION_CACHE_TTL:-600}
# Protocol/Market config
- PROTOCOL_STATE_CONTRACT=${PROTOCOL_STATE_CONTRACT}
- DATA_MARKET_ADDRESSES=${DATA_MARKET_ADDRESSES}
- POWERLOOM_RPC_NODES=${POWERLOOM_RPC_NODES}
depends_on:
redis:
condition: service_healthy
networks:
- sequencer-net
restart: unless-stopped
deploy:
replicas: ${DEQUEUER_REPLICAS:-2}
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Event Monitor - Watches for EpochReleased events
event-monitor:
build:
context: .
dockerfile: Dockerfile.snapshot-sequencer
environment:
- SEQUENCER_ID=${SEQUENCER_ID:-validator1}
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_DB=${REDIS_DB:-0}
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
- DEBUG_MODE=${DEBUG_MODE:-false}
# Component toggles - ONLY EVENT MONITOR
- ENABLE_LISTENER=false
- ENABLE_DEQUEUER=false
- ENABLE_FINALIZER=false
- ENABLE_BATCH_AGGREGATION=false
- ENABLE_EVENT_MONITOR=true
# RPC Configuration
- POWERLOOM_RPC_NODES=${POWERLOOM_RPC_NODES}
- POWERLOOM_ARCHIVE_RPC_NODES=${POWERLOOM_ARCHIVE_RPC_NODES:-[]}
# Contract addresses
- PROTOCOL_STATE_CONTRACT=${PROTOCOL_STATE_CONTRACT}
- DATA_MARKET_ADDRESSES=${DATA_MARKET_ADDRESSES}
# Contract ABI path
- CONTRACT_ABI_PATH=${CONTRACT_ABI_PATH:-./abi/ProtocolContract.json}
# Event monitoring config
- EVENT_POLL_INTERVAL=${EVENT_POLL_INTERVAL:-12}
- EVENT_START_BLOCK=${EVENT_START_BLOCK:-0}
- EVENT_BLOCK_BATCH_SIZE=${EVENT_BLOCK_BATCH_SIZE:-1000}
- MAX_CONCURRENT_WINDOWS=${MAX_CONCURRENT_WINDOWS:-100}
- SUBMISSION_WINDOW_DURATION=${SUBMISSION_WINDOW_DURATION:-60}
depends_on:
redis:
condition: service_healthy
networks:
- sequencer-net
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Finalizer - Creates batches, stores in IPFS (scalable)
finalizer:
build:
context: .
dockerfile: Dockerfile.snapshot-sequencer
environment:
- SEQUENCER_ID=${SEQUENCER_ID:-validator1}
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_DB=${REDIS_DB:-0}
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
- DEBUG_MODE=${DEBUG_MODE:-false}
# Component toggles - ONLY FINALIZER (NO AGGREGATION)
- ENABLE_LISTENER=false
- ENABLE_DEQUEUER=false
- ENABLE_FINALIZER=true
- ENABLE_BATCH_AGGREGATION=false # Aggregation is separate now
- ENABLE_EVENT_MONITOR=false
# Storage configuration
- STORAGE_PROVIDER=${STORAGE_PROVIDER:-ipfs}
- IPFS_HOST=${IPFS_HOST:-localhost:5001}
- DA_PROVIDER=${DA_PROVIDER:-none}
# Protocol/Market config
- PROTOCOL_STATE_CONTRACT=${PROTOCOL_STATE_CONTRACT}
- DATA_MARKET_ADDRESSES=${DATA_MARKET_ADDRESSES}
- SUBMISSION_WINDOW_DURATION=${SUBMISSION_WINDOW_DURATION:-60}
# Finalizer specific
- FINALIZER_WORKERS=${FINALIZER_WORKERS:-5}
- FINALIZATION_BATCH_SIZE=${FINALIZATION_BATCH_SIZE:-20}
depends_on:
redis:
condition: service_healthy
networks:
- sequencer-net
restart: unless-stopped
deploy:
replicas: ${FINALIZER_REPLICAS:-2}
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Aggregator - Singleton for consensus/batch aggregation
aggregator:
build:
context: .
dockerfile: Dockerfile.aggregator
environment:
- SEQUENCER_ID=${SEQUENCER_ID:-validator1}
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_DB=${REDIS_DB:-0}
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
- DEBUG_MODE=${DEBUG_MODE:-false}
# Storage configuration for aggregated results
- IPFS_HOST=${IPFS_HOST:-localhost:5001}
# Protocol/Market config
- PROTOCOL_STATE_CONTRACT=${PROTOCOL_STATE_CONTRACT}
- DATA_MARKET_ADDRESSES=${DATA_MARKET_ADDRESSES}
- POWERLOOM_RPC_NODES=${POWERLOOM_RPC_NODES}
depends_on:
redis:
condition: service_healthy
p2p-gateway:
condition: service_started
networks:
- sequencer-net
restart: unless-stopped
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# State Tracker - Background worker for data aggregation
state-tracker:
build:
context: .
dockerfile: Dockerfile.state-tracker
container_name: dsv-state-tracker
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=
- REDIS_DB=0
- PROTOCOL_STATE_CONTRACT=${PROTOCOL_STATE_CONTRACT}
- DATA_MARKET_ADDRESSES=${DATA_MARKET_ADDRESSES}
- STATE_TRACKER_RETENTION_DAYS=7
- LOG_LEVEL=${LOG_LEVEL:-info}
depends_on:
redis:
condition: service_healthy
networks:
- sequencer-net
restart: unless-stopped
profiles:
- monitoring
# Monitor API - REST API for pipeline monitoring
monitor-api:
build:
context: .
dockerfile: docker/Dockerfile.monitor-api
container_name: dsv-monitor-api
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_DB=${REDIS_DB:-0}
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
- MONITOR_API_PORT=${MONITOR_API_PORT:-9091}
- VALIDATOR_ID=${SEQUENCER_ID:-validator-001}
- PROTOCOL_STATE_CONTRACT=${PROTOCOL_STATE_CONTRACT}
- DATA_MARKET_ADDRESSES=${DATA_MARKET_ADDRESSES}
ports:
- "127.0.0.1:${MONITOR_API_PORT:-9091}:${MONITOR_API_PORT:-9091}"
depends_on:
redis:
condition: service_healthy
networks:
- sequencer-net
restart: unless-stopped
profiles:
- monitoring
# Optional: Monitoring with Prometheus + Grafana
prometheus:
image: prom/prometheus:latest
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
ports:
- "9090:9090"
networks:
- sequencer-net
profiles:
- monitoring
grafana:
image: grafana/grafana:latest
volumes:
- grafana-data:/var/lib/grafana
- ./monitoring/grafana/dashboards:/etc/grafana/provisioning/dashboards
ports:
- "${GRAFANA_PORT:-3000}:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin}
- GF_USERS_ALLOW_SIGN_UP=false
networks:
- sequencer-net
profiles:
- monitoring
# IPFS Node - Optional local IPFS service for reduced latency
ipfs:
image: ipfs/kubo:master-latest
container_name: dsv-ipfs
volumes:
- ${IPFS_DATA_DIR:-/data/ipfs}:/data/ipfs
ports:
- "127.0.0.1:${IPFS_API_PORT:-5001}:5001" # IPFS API port (required for DSV)
- "127.0.0.1:${IPFS_SWARM_PORT:-4001}:4001" # IPFS Swarm port for P2P communication
environment:
- IPFS_PROFILE=server
- IPFS_PATH=/data/ipfs
# Cleanup configuration
- DATA_CLEANUP_DAYS=${IPFS_CLEANUP_MAX_AGE_DAYS:-7}
- CLEANUP_SCHEDULE=0 */${IPFS_CLEANUP_INTERVAL_HOURS:-72} * * *
entrypoint: >
sh -c '
echo "Setting up data cleanup cron job..."
mkdir -p /var/spool/cron/crontabs
cleanup_cmd="date && echo Starting IPFS cleanup process... && find /data/ipfs -type f -mtime +$${DATA_CLEANUP_DAYS} -name *.data -print -delete && echo Cleanup process completed."
echo "$${CLEANUP_SCHEDULE} $${cleanup_cmd} >> /proc/1/fd/1 2>&1" > /var/spool/cron/crontabs/root
chmod 0644 /var/spool/cron/crontabs/root
echo "Cron job set up. Will clean files older than $${DATA_CLEANUP_DAYS} days every $${IPFS_CLEANUP_INTERVAL_HOURS:-72} hours ($${CLEANUP_SCHEDULE})"
# Initialize IPFS repository if not exists
if [ ! -f /data/ipfs/config ]; then
echo "Initializing IPFS repository..."
ipfs init --profile server
# Configure for server deployment
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
ipfs config Addresses.Swarm /ip4/0.0.0.0/tcp/4001
ipfs config Swarm.ConnMgr.HighWater 2000
ipfs config Swarm.ConnMgr.LowWater 500
ipfs config Datastore.StorageMax "200GB"
# Enable pubsub for P2P messaging
ipfs config Pubsub.Enabled true
# Set up CORS for API access
ipfs config API.HTTPHeaders.Access-Control-Allow-Origin "[*]"
ipfs config API.HTTPHeaders.Access-Control-Allow-Methods "[\"PUT\", \"POST\", \"GET\"]"
# Optimize for performance
ipfs config --json Experimental.FilestoreEnabled true
echo "IPFS configuration completed"
fi
echo "Starting cron daemon..."
crond
echo "Starting IPFS daemon..."
exec /sbin/tini -- ipfs daemon --migrate=true --enable-pubsub-experiment
'
# System resource limits for optimal IPFS performance
ulimits:
nofile:
soft: 1000000
hard: 1000000
memlock:
soft: -1 # Unlimited memory lock
hard: -1
nproc:
soft: 32768 # High process limit for concurrent connections
hard: 32768
healthcheck:
test: ["CMD", "ipfs", "id"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s # Allow time for initialization
networks:
- sequencer-net
restart: unless-stopped
profiles:
- ipfs
logging:
driver: "json-file"
options:
max-size: "50m" # Increased log size for IPFS debugging
max-file: "5"
volumes:
redis-data:
ipfs-data:
prometheus-data:
grafana-data:
networks:
sequencer-net:
driver: bridge