feat: Add Linux one-line validator installer

- Created automated installer script for Linux
- Handles system requirements check
- Downloads binaries and chain spec
- Generates validator keys automatically
- Creates systemd service for auto-restart
- Updated README with installation instructions
- Added GPL-3.0 license
This commit is contained in:
2025-10-27 08:36:05 +03:00
parent 7ddd960325
commit 965b0e8500
3 changed files with 340 additions and 2 deletions
+19
View File
@@ -0,0 +1,19 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
+125 -2
View File
@@ -1,2 +1,125 @@
# pezkuwi-validator-v1.0.0
One-click validator installer for Pezkuwi testnet. Cross-platform scripts (Linux/Mac/Windows) for automated node deployment.
# Pezkuwi Validator Installer
One-click validator installer for Pezkuwi testnet. Cross-platform scripts for automated node deployment.
## 🚀 Quick Start
### Linux / macOS (One-Line Install)
```bash
curl -sSf https://raw.githubusercontent.com/pezkuwichain/pezkuwi-validator-v1.0.0/main/scripts/linux/install-validator.sh | bash
```
### Windows (PowerShell)
```powershell
# Coming soon
```
## 📋 Prerequisites
- **OS**: Linux (Ubuntu 20.04+, Debian 11+, Fedora 35+)
- **CPU**: Minimum 2 cores (4+ recommended)
- **RAM**: Minimum 4GB (8GB+ recommended)
- **Storage**: 50GB+ free space
- **Network**: Public IP with ports 30333 (P2P) and 9944 (RPC) open
## 🔧 What Does the Installer Do?
1. ✅ Checks system requirements
2. ✅ Installs dependencies
3. ✅ Downloads Pezkuwi binaries from GitHub Releases
4. ✅ Downloads chain specification
5. ✅ Generates validator keys
6. ✅ Creates systemd service
7. ✅ Starts validator node
## 📊 Post-Installation
### Check Node Status
```bash
sudo systemctl status pezkuwi-validator
```
### View Live Logs
```bash
sudo journalctl -u pezkuwi-validator -f
```
### Stop Validator
```bash
sudo systemctl stop pezkuwi-validator
```
### Restart Validator
```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
cat ~/.pezkuwi/keys/node-id.txt
```
**⚠️ IMPORTANT**: Backup this file! You'll need it for testnet registration.
## 🌐 Connect to Your Node
- **RPC Endpoint**: `http://localhost:9944`
- **WebSocket**: `ws://localhost:9944`
Test connection:
```bash
curl -H "Content-Type: application/json" \
-d '{"id":1, "jsonrpc":"2.0", "method": "system_health"}' \
http://localhost:9944
```
## 🆘 Troubleshooting
### Node Not Starting
```bash
# Check logs
sudo journalctl -u pezkuwi-validator -n 100
# Check service status
sudo systemctl status pezkuwi-validator
```
### Firewall Issues
```bash
# Open required ports (Ubuntu/Debian)
sudo ufw allow 30333/tcp
sudo ufw allow 9944/tcp
```
## 📚 Documentation
- [Validator Guide](./docs/VALIDATOR-GUIDE.md)
- [Troubleshooting](./docs/TROUBLESHOOTING.md)
- [FAQ](./docs/FAQ.md)
## 🤝 Support
- GitHub Issues: https://github.com/pezkuwichain/pezkuwi-validator-v1.0.0/issues
- Telegram: https://t.me/pezkuwichain
- Discord: Coming soon
## 📜 License
GNU General Public License v3.0
---
**Made with ❤️ by Kurdistan Tech Ministry**
+196
View File
@@ -0,0 +1,196 @@
#!/bin/bash
# Pezkuwi Validator One-Line Installer
# Usage: curl -sSf https://raw.githubusercontent.com/pezkuwichain/pezkuwi-validator-v1.0.0/main/scripts/linux/install-validator.sh | bas
set -e
echo "🚀 Pezkuwi Validator Installer v1.0.0"
echo "======================================"
echo ""
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
# Configuration
PEZKUWI_VERSION="v1.0.0-local-testnet-success"
GITHUB_REPO="pezkuwichain/pezkuwi-sdk"
INSTALL_DIR="$HOME/.pezkuwi"
CHAIN_SPEC_URL="https://raw.githubusercontent.com/${GITHUB_REPO}/main/pezkuwi-local-raw.json"
# Functions
print_success() {
echo -e "${GREEN}${NC} $1"
}
print_error() {
echo -e "${RED}${NC} $1"
}
print_info() {
echo -e "${YELLOW}${NC} $1"
}
check_requirements() {
print_info "Checking system requirements..."
if [[ "$OSTYPE" != "linux-gnu"* ]]; then
print_error "This script only supports Linux"
exit 1
fi
CPU_CORES=$(nproc)
if [ "$CPU_CORES" -lt 2 ]; then
print_error "Minimum 2 CPU cores required (found: $CPU_CORES)"
exit 1
fi
TOTAL_RAM=$(free -g | awk '/^Mem:/{print $2}')
if [ "$TOTAL_RAM" -lt 4 ]; then
print_error "Minimum 4GB RAM required (found: ${TOTAL_RAM}GB)"
exit 1
fi
print_success "System requirements met"
}
install_dependencies() {
print_info "Installing dependencies..."
if command -v apt-get &> /dev/null; then
sudo apt-get update -qq
sudo apt-get install -y curl wget tar
elif command -v yum &> /dev/null; then
sudo yum install -y curl wget tar
else
print_error "Unsupported package manager"
exit 1
fi
print_success "Dependencies installed"
}
download_binaries() {
print_info "Downloading Pezkuwi binaries..."
mkdir -p "$INSTALL_DIR/bin"
RELEASE_URL="https://github.com/${GITHUB_REPO}/releases/download/${PEZKUWI_VERSION}"
wget -q --show-progress -O "$INSTALL_DIR/bin/pezkuwi" "${RELEASE_URL}/pezkuwi" || {
print_error "Failed to download binaries"
print_info "Please check if release exists: ${RELEASE_URL}"
exit 1
}
chmod +x "$INSTALL_DIR/bin/pezkuwi"
print_success "Binaries downloaded"
}
download_chain_spec() {
print_info "Downloading chain specification..."
mkdir -p "$INSTALL_DIR/config"
wget -q -O "$INSTALL_DIR/config/chain-spec.json" "$CHAIN_SPEC_URL" || {
print_error "Failed to download chain spec"
exit 1
}
print_success "Chain spec downloaded"
}
generate_keys() {
print_info "Generating validator keys..."
mkdir -p "$INSTALL_DIR/keys"
"$INSTALL_DIR/bin/pezkuwi" key generate-node-key \
--base-path "$INSTALL_DIR/data" \
--chain "$INSTALL_DIR/config/chain-spec.json" > "$INSTALL_DIR/keys/node-id.txt"
NODE_ID=$(cat "$INSTALL_DIR/keys/node-id.txt")
print_success "Keys generated"
print_info "Your Node ID: $NODE_ID"
}
create_systemd_service() {
print_info "Creating systemd service..."
sudo tee /etc/systemd/system/pezkuwi-validator.service > /dev/null << SERVICE
[Unit]
Description=Pezkuwi Validator Node
After=network.target
[Service]
Type=simple
User=$USER
WorkingDirectory=$INSTALL_DIR
ExecStart=$INSTALL_DIR/bin/pezkuwi \\
--chain $INSTALL_DIR/config/chain-spec.json \\
--base-path $INSTALL_DIR/data \\
--validator \\
--name "Validator-\$(hostname)" \\
--port 30333 \\
--rpc-port 9944 \\
--rpc-cors all \\
--rpc-methods=unsafe
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
SERVICE
sudo systemctl daemon-reload
sudo systemctl enable pezkuwi-validator
print_success "Systemd service created"
}
start_validator() {
print_info "Starting validator..."
sudo systemctl start pezkuwi-validator
sleep 3
if sudo systemctl is-active --quiet pezkuwi-validator; then
print_success "Validator started successfully!"
else
print_error "Failed to start validator"
print_info "Check logs: sudo journalctl -u pezkuwi-validator -f"
exit 1
fi
}
print_summary() {
echo ""
echo "======================================"
echo "🎉 Installation Complete!"
echo "======================================"
echo ""
echo "📍 Install Directory: $INSTALL_DIR"
echo "🔑 Node ID: $(cat $INSTALL_DIR/keys/node-id.txt)"
echo ""
echo "📊 Useful Commands:"
echo " • Check status: sudo systemctl status pezkuwi-validator"
echo " • View logs: sudo journalctl -u pezkuwi-validator -f"
echo " • Stop node: sudo systemctl stop pezkuwi-validator"
echo " • Restart node: sudo systemctl restart pezkuwi-validator"
echo ""
echo "🌐 RPC Endpoint: http://localhost:9944"
echo ""
}
main() {
check_requirements
install_dependencies
download_binaries
download_chain_spec
generate_keys
create_systemd_service
start_validator
print_summary
}
main