feat: Add Docker-based validator setup

- Created Dockerfile with multi-stage build
- Added docker-compose.yml with validator service
- Integrated Prometheus and Grafana monitoring (optional)
- Health checks and automatic restarts
- Volume management for data persistence
- Comprehensive Docker README with troubleshooting
- Updated main README with Docker instructions

Docker setup features:
- One-command deployment
- Auto-restart on failure
- Built-in monitoring stack
- Production-ready configuration
- Easy backup and restore
This commit is contained in:
2025-10-27 21:25:13 +03:00
parent 4e93995605
commit a5532af65f
5 changed files with 361 additions and 28 deletions
+82
View File
@@ -0,0 +1,82 @@
version: '3.8'
services:
pezkuwi-validator:
build:
context: .
dockerfile: Dockerfile
container_name: pezkuwi-validator
restart: unless-stopped
ports:
- "30333:30333" # P2P
- "9944:9944" # RPC
- "9615:9615" # Prometheus metrics
volumes:
- validator-data:/pezkuwi/data
- ./chain-spec.json:/pezkuwi/chain-spec.json:ro
environment:
- RUST_LOG=info
command: [
"--chain", "/pezkuwi/chain-spec.json",
"--base-path", "/pezkuwi/data",
"--validator",
"--name", "Docker-Validator",
"--port", "30333",
"--rpc-port", "9944",
"--rpc-cors", "all",
"--rpc-external",
"--rpc-methods=unsafe",
"--prometheus-external",
"--prometheus-port", "9615"
]
networks:
- pezkuwi-network
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Optional: Prometheus monitoring
prometheus:
image: prom/prometheus:latest
container_name: pezkuwi-prometheus
restart: unless-stopped
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
networks:
- pezkuwi-network
profiles:
- monitoring
# Optional: Grafana dashboard
grafana:
image: grafana/grafana:latest
container_name: pezkuwi-grafana
restart: unless-stopped
ports:
- "3000:3000"
volumes:
- grafana-data:/var/lib/grafana
environment:
- GF_SECURITY_ADMIN_PASSWORD=pezkuwi123
- GF_USERS_ALLOW_SIGN_UP=false
networks:
- pezkuwi-network
profiles:
- monitoring
volumes:
validator-data:
prometheus-data:
grafana-data:
networks:
pezkuwi-network:
driver: bridge