diff --git a/README.md b/README.md index 989916a..4d9de92 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ One-click validator installer for Pezkuwi testnet. Cross-platform scripts for au ## 🚀 Quick Start ### Linux / macOS (One-Line Install) -```bash +bash curl -sSf https://raw.githubusercontent.com/pezkuwichain/pezkuwi-validator-v1.0.0/main/scripts/linux/install-validator.sh | bash -``` + **⚠️ Note:** This will install Pezkuwi validator to `~/.pezkuwi/` directory. @@ -19,19 +19,19 @@ curl -sSf https://raw.githubusercontent.com/pezkuwichain/pezkuwi-validator-v1.0. - **Validator Keys**: Automatically generated ### Test Installation (Dry Run) -```bash +bash # Download script and review it first wget https://raw.githubusercontent.com/pezkuwichain/pezkuwi-validator-v1.0.0/main/scripts/linux/install-validator.sh less install-validator.sh bash install-validator.sh -``` + ### Windows (PowerShell) **⚠️ Run as Administrator** -```powershell +powershell iwr -useb https://raw.githubusercontent.com/pezkuwichain/pezkuwi-validator-v1.0.0/main/scripts/windows/install-validator.ps1 | iex -``` + **What Gets Installed?** @@ -41,7 +41,7 @@ iwr -useb https://raw.githubusercontent.com/pezkuwichain/pezkuwi-validator-v1.0. - **Firewall**: Ports 30333 and 9944 (manual configuration may be required) **Manual Installation (if one-liner fails):** -```powershell +powershell # Download script Invoke-WebRequest -Uri "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-validator-v1.0.0/main/scripts/windows/install-validator.ps1" -OutFile "install-validator.ps1" @@ -50,12 +50,39 @@ notepad install-validator.ps1 # Run as Administrator .\install-validator.ps1 -``` + **Check Service Status:** -```powershell +powershell Get-Service PezkuwiValidator -``` + + +### Docker (Recommended for Production) + +**Prerequisites:** Docker 20.10+ and Docker Compose 2.0+ +bash +# Clone repository +git clone https://github.com/pezkuwichain/pezkuwi-validator-v1.0.0.git +cd pezkuwi-validator-v1.0.0/docker + +# Start validator +docker-compose up -d + +# View logs +docker-compose logs -f pezkuwi-validator + + +**With Monitoring (Prometheus + Grafana):** +bash +docker-compose --profile monitoring up -d + + +**Access:** +- Validator RPC: http://localhost:9944 +- Prometheus: http://localhost:9090 +- Grafana: http://localhost:3000 (admin/pezkuwi123) + +📚 **Full Docker documentation:** [docker/README.md](./docker/README.md) ## 📋 Prerequisites @@ -80,42 +107,42 @@ Get-Service PezkuwiValidator ## 📊 Post-Installation ### Check Node Status -```bash +bash sudo systemctl status pezkuwi-validator -``` + ### View Live Logs -```bash +bash sudo journalctl -u pezkuwi-validator -f -``` + ### Stop Validator -```bash +bash sudo systemctl stop pezkuwi-validator -``` + ### Restart Validator -```bash +bash sudo systemctl restart pezkuwi-validator -``` + ## 📁 Installation Directory All files are installed to: `~/.pezkuwi/` -``` + ~/.pezkuwi/ ├── bin/ # Binaries ├── config/ # Chain spec ├── data/ # Blockchain data └── keys/ # Validator keys -``` + ## 🔑 Your Validator Keys After installation, your node ID is saved in: -```bash +bash cat ~/.pezkuwi/keys/node-id.txt -``` + **⚠️ IMPORTANT**: Backup this file! You'll need it for testnet registration. @@ -125,29 +152,29 @@ cat ~/.pezkuwi/keys/node-id.txt - **WebSocket**: `ws://localhost:9944` Test connection: -```bash +bash curl -H "Content-Type: application/json" \ -d '{"id":1, "jsonrpc":"2.0", "method": "system_health"}' \ http://localhost:9944 -``` + ## 🆘 Troubleshooting ### Node Not Starting -```bash +bash # Check logs sudo journalctl -u pezkuwi-validator -n 100 # Check service status sudo systemctl status pezkuwi-validator -``` + ### Firewall Issues -```bash +bash # Open required ports (Ubuntu/Debian) sudo ufw allow 30333/tcp sudo ufw allow 9944/tcp -``` + ## 📚 Documentation diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..9260c07 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,56 @@ +# Pezkuwi Validator Docker Image +FROM ubuntu:22.04 + +LABEL maintainer="pezkuwichain" +LABEL description="Pezkuwi blockchain validator node" +LABEL version="1.0.0" + +# Install dependencies +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + && rm -rf /var/lib/apt/lists/* + +# Create pezkuwi user +RUN useradd -m -u 1000 -U -s /bin/sh -d /pezkuwi pezkuwi + +# Set working directory +WORKDIR /pezkuwi + +# Download and extract binaries +ARG PEZKUWI_VERSION=v1.0.0-local-testnet-success +RUN curl -L "https://github.com/pezkuwichain/pezkuwi-sdk/releases/download/${PEZKUWI_VERSION}/pezkuwi-binaries-linux-x86_64.tar.gz" \ + | tar xz -C /usr/local/bin/ && \ + chmod +x /usr/local/bin/pezkuwi && \ + chmod +x /usr/local/bin/pezkuwi-prepare-worker && \ + chmod +x /usr/local/bin/pezkuwi-execute-worker + +# Download chain spec +RUN curl -o /pezkuwi/chain-spec.json \ + https://raw.githubusercontent.com/pezkuwichain/pezkuwi-sdk/main/pezkuwi-local-raw.json + +# Create data directory +RUN mkdir -p /pezkuwi/data && \ + chown -R pezkuwi:pezkuwi /pezkuwi + +# Switch to pezkuwi user +USER pezkuwi + +# Expose ports +EXPOSE 30333 9944 9615 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ + CMD curl -f http://localhost:9944 || exit 1 + +# Default command +ENTRYPOINT ["/usr/local/bin/pezkuwi"] +CMD ["--chain", "/pezkuwi/chain-spec.json", \ + "--base-path", "/pezkuwi/data", \ + "--validator", \ + "--port", "30333", \ + "--rpc-port", "9944", \ + "--rpc-cors", "all", \ + "--rpc-external", \ + "--prometheus-external"] diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..fb23f29 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,157 @@ +# Pezkuwi Validator - Docker Setup + +Run Pezkuwi validator node using Docker and Docker Compose. + +## 🚀 Quick Start + +### Prerequisites + +- Docker 20.10+ +- Docker Compose 2.0+ + +**Install Docker:** +```bash +# Linux +curl -fsSL https://get.docker.com | sh +sudo usermod -aG docker $USER + +# Verify +docker --version +docker-compose --version +``` + +### Run Validator +```bash +# Clone repository +git clone https://github.com/pezkuwichain/pezkuwi-validator-v1.0.0.git +cd pezkuwi-validator-v1.0.0/docker + +# Start validator +docker-compose up -d + +# Check logs +docker-compose logs -f pezkuwi-validator + +# Check status +docker-compose ps +``` + +## 📊 Monitoring (Optional) + +Start with Prometheus and Grafana: +```bash +docker-compose --profile monitoring up -d +``` + +**Access:** +- Prometheus: http://localhost:9090 +- Grafana: http://localhost:3000 (admin/pezkuwi123) + +## 🔧 Management Commands +```bash +# Stop validator +docker-compose stop + +# Restart validator +docker-compose restart + +# View logs +docker-compose logs -f + +# Remove everything (including data) +docker-compose down -v + +# Update to latest version +docker-compose pull +docker-compose up -d +``` + +## 📁 Data Persistence + +Blockchain data is stored in Docker volume: `validator-data` + +**Backup data:** +```bash +docker run --rm -v validator-data:/data -v $(pwd):/backup ubuntu tar czf /backup/validator-backup.tar.gz /data +``` + +**Restore data:** +```bash +docker run --rm -v validator-data:/data -v $(pwd):/backup ubuntu tar xzf /backup/validator-backup.tar.gz -C / +``` + +## 🔑 Validator Keys + +Keys are generated automatically on first start in `/pezkuwi/data/chains/` + +**Extract your Node ID:** +```bash +docker-compose exec pezkuwi-validator cat /pezkuwi/data/chains/pezkuwi_testnet/network/secret_ed25519 +``` + +## 🌐 Network Ports + +- **30333**: P2P port (required for validators) +- **9944**: RPC/WebSocket (for local access) +- **9615**: Prometheus metrics + +## 🐛 Troubleshooting + +### Container won't start +```bash +# Check logs +docker-compose logs pezkuwi-validator + +# Rebuild image +docker-compose build --no-cache +docker-compose up -d +``` + +### Out of disk space +```bash +# Check disk usage +docker system df + +# Prune unused data +docker system prune -a +``` + +### Performance issues +```bash +# Check resource usage +docker stats pezkuwi-validator + +# Increase resources in Docker Desktop settings +``` + +## 🔄 Updates +```bash +# Pull latest image +docker-compose pull + +# Restart with new image +docker-compose up -d +``` + +## 📝 Custom Configuration + +Edit `docker-compose.yml` to customize: +- Node name +- Ports +- Resource limits +- Logging options + +Example resource limits: +```yaml +services: + pezkuwi-validator: + # ... other config + deploy: + resources: + limits: + cpus: '2' + memory: 4G + reservations: + cpus: '1' + memory: 2G +``` diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..ae5ea98 --- /dev/null +++ b/docker/docker-compose.yml @@ -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 diff --git a/docker/prometheus.yml b/docker/prometheus.yml new file mode 100644 index 0000000..ae12b83 --- /dev/null +++ b/docker/prometheus.yml @@ -0,0 +1,11 @@ +global: + scrape_interval: 15s + evaluation_interval: 15s + +scrape_configs: + - job_name: 'pezkuwi-validator' + static_configs: + - targets: ['pezkuwi-validator:9615'] + labels: + instance: 'validator-1' + network: 'pezkuwi-testnet'