network/docker-compose.yml

130 lines
3.4 KiB
YAML

# Docker Compose file for DeBros Network
services:
# Bootstrap Node - First node in the network
bootstrap-node:
build: .
container_name: debros-bootstrap
hostname: bootstrap-node
command: ["./bin/node", "--config", "/app/configs/bootstrap.docker.yaml"]
ports:
- "4001:4001" # LibP2P P2P
- "5001:5001" # RQLite HTTP API
- "7001:7001" # RQLite Raft
volumes:
- bootstrap_data:/app/data
- ./configs:/app/configs:ro
- bootstrap_logs:/app/logs
networks:
- debros-network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:5001/status", "||", "exit", "1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 45s
# Second Node - Joins the bootstrap node
node-2:
build: .
container_name: debros-node-2
hostname: node-2
command: ["./bin/node", "--config", "/app/configs/node-2.docker.yaml"]
ports:
- "4002:4001" # LibP2P P2P (mapped to different host port)
- "5002:5001" # RQLite HTTP API
- "7002:7001" # RQLite Raft
volumes:
- node2_data:/app/data
- ./configs:/app/configs:ro
- node2_logs:/app/logs
networks:
- debros-network
depends_on:
bootstrap-node:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:5001/status", "||", "exit", "1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 45s
# Third Node - Additional network participant
node-3:
build: .
container_name: debros-node-3
hostname: node-3
command: ["./bin/node", "--config", "/app/configs/node-3.docker.yaml"]
ports:
- "4003:4001" # LibP2P P2P
- "5003:5001" # RQLite HTTP API
- "7003:7001" # RQLite Raft
volumes:
- node3_data:/app/data
- ./configs:/app/configs:ro
- node3_logs:/app/logs
networks:
- debros-network
depends_on:
bootstrap-node:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:5001/status", "||", "exit", "1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 45s
# HTTP Gateway - Provides REST API and WebSocket interface
gateway:
build: .
container_name: debros-gateway
hostname: gateway
command: ["./bin/gateway", "--config", "/app/configs/gateway.docker.yaml"]
ports:
- "6001:6001" # Gateway HTTP/WebSocket
volumes:
- ./configs:/app/configs:ro
- gateway_logs:/app/logs
networks:
- debros-network
depends_on:
bootstrap-node:
condition: service_healthy
node-2:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:6001/health", "||", "exit", "1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
networks:
debros-network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16
volumes:
bootstrap_data:
driver: local
bootstrap_logs:
driver: local
node2_data:
driver: local
node2_logs:
driver: local
node3_data:
driver: local
node3_logs:
driver: local
gateway_logs:
driver: local