Files
proxmox/scripts/archive/consolidated/deploy/deploy-enhanced-systemd.sh
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands
- CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround
- CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check
- NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere
- MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates
- LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 15:46:57 -08:00

157 lines
5.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Deploy Enhanced Systemd Services
# Deploys enhanced Besu validator services with health checks
set -euo pipefail
# Load IP configuration
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
VALIDATOR_VMIDS=(1000 1001 1002 1003 1004)
PROXMOX_HOSTS=("${PROXMOX_HOST_R630_01:-192.168.11.11}" "${PROXMOX_HOST_R630_01:-192.168.11.11}" "${PROXMOX_HOST_R630_01:-192.168.11.11}" "${PROXMOX_HOST_ML110:-192.168.11.10}" "${PROXMOX_HOST_ML110:-192.168.11.10}")
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[⚠]${NC} $1"; }
log_error() { echo -e "${RED}[✗]${NC} $1"; }
deploy_prerequisites_script() {
local vmid=$1
local host=$2
log_info "Deploying prerequisites script to Validator-$vmid..."
# Copy prerequisites script
if [ -f "$SCRIPT_DIR/check-validator-prerequisites.sh" ]; then
scp "$SCRIPT_DIR/check-validator-prerequisites.sh" "root@$host:/tmp/check-validator-prerequisites.sh" 2>&1 || return 1
ssh root@$host "pct push $vmid /tmp/check-validator-prerequisites.sh /usr/local/bin/check-validator-prerequisites.sh && pct exec $vmid -- chmod +x /usr/local/bin/check-validator-prerequisites.sh" 2>&1 || return 1
log_success "Prerequisites script deployed to Validator-$vmid"
return 0
else
log_error "Prerequisites script not found"
return 1
fi
}
deploy_verification_script() {
local vmid=$1
local host=$2
log_info "Deploying verification script to Validator-$vmid..."
# Copy verification script
if [ -f "$SCRIPT_DIR/verify-validator-started.sh" ]; then
scp "$SCRIPT_DIR/verify-validator-started.sh" "root@$host:/tmp/verify-validator-started.sh" 2>&1 || return 1
ssh root@$host "pct push $vmid /tmp/verify-validator-started.sh /usr/local/bin/verify-validator-started.sh && pct exec $vmid -- chmod +x /usr/local/bin/verify-validator-started.sh" 2>&1 || return 1
log_success "Verification script deployed to Validator-$vmid"
return 0
else
log_error "Verification script not found"
return 1
fi
}
update_systemd_service() {
local vmid=$1
local host=$2
log_info "Updating systemd service for Validator-$vmid..."
# Check if enhanced service file exists
if [ ! -f "$SCRIPT_DIR/enhanced-besu-validator.service" ]; then
log_error "Enhanced service file not found"
return 1
fi
# Get current service configuration to understand the setup
local current_service=$(ssh root@$host "pct exec $vmid -- systemctl list-units --type=service | grep besu | awk '{print \$1}' | head -1" 2>&1)
if [ -z "$current_service" ]; then
log_warn "No Besu service found on Validator-$vmid"
log_info "You may need to manually update the service file"
return 0
fi
log_info "Current service: $current_service"
log_warn "Note: Systemd service update requires manual configuration"
log_warn "Review enhanced-besu-validator.service and update manually if needed"
return 0
}
deploy_to_validator() {
local vmid=$1
local host=$2
log_info "Deploying enhanced systemd components to Validator-$vmid..."
# Deploy prerequisites script
if ! deploy_prerequisites_script "$vmid" "$host"; then
log_error "Failed to deploy prerequisites script"
return 1
fi
# Deploy verification script
if ! deploy_verification_script "$vmid" "$host"; then
log_error "Failed to deploy verification script"
return 1
fi
# Note about systemd service update
update_systemd_service "$vmid" "$host"
log_success "Enhanced components deployed to Validator-$vmid"
return 0
}
main() {
log_info "Deploying enhanced systemd services..."
echo ""
local success=0
local failed=0
for i in "${!VALIDATOR_VMIDS[@]}"; do
local vmid=${VALIDATOR_VMIDS[$i]}
local host=${PROXMOX_HOSTS[$i]}
if deploy_to_validator "$vmid" "$host"; then
((success++))
else
((failed++))
fi
echo ""
done
log_info "Deployment Summary:"
log_info " Successful: $success/5"
log_info " Failed: $failed/5"
echo ""
if [ "$failed" -eq 0 ]; then
log_success "All enhanced components deployed successfully!"
log_warn "Next steps:"
log_warn " 1. Review enhanced-besu-validator.service template"
log_warn " 2. Manually update systemd service files if needed"
log_warn " 3. Reload systemd: sudo systemctl daemon-reload"
log_warn " 4. Restart services: sudo systemctl restart besu-validator.service"
else
log_error "Some deployments failed. Review errors above."
fi
}
main "$@"