Files
proxmox/scripts/start-blockscout-on-proxmox.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

95 lines
3.3 KiB
Bash

#!/bin/bash
# Start Blockscout Service - Run this script ON the Proxmox host
# Usage: Run directly on Proxmox host or via: ssh root@${PROXMOX_HOST_ML110:-192.168.11.10} 'bash -s' < start-blockscout-on-proxmox.sh
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
VMID=5000
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
RED='\033[0;31m'
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"; }
echo ""
log_info "Starting Blockscout Service in Container $VMID"
echo ""
# Find container node
CONTAINER_NODE=""
for node in ml110 r630-01 r630-02; do
if pvesh get /nodes/$node/lxc/$VMID/status/current --output-format json >/dev/null 2>&1; then
CONTAINER_NODE="$node"
break
fi
done
if [ -z "$CONTAINER_NODE" ]; then
log_error "Container $VMID not found on any node"
exit 1
fi
log_success "Container found on node: $CONTAINER_NODE"
# Check if we need to SSH to the node
if [ "$CONTAINER_NODE" != "$(hostname -s)" ]; then
log_info "Container is on node $CONTAINER_NODE, executing commands via SSH..."
NODE_IP=$(pvesh get /nodes/$CONTAINER_NODE --output-format json | grep -o '"ip":"[^"]*"' | head -1 | cut -d'"' -f4 || echo "")
if [ -n "$NODE_IP" ]; then
ssh root@$NODE_IP "pct exec $VMID -- bash -c 'systemctl start blockscout && sleep 5 && systemctl status blockscout --no-pager -l | head -10'"
else
# Try direct hostname
ssh root@$CONTAINER_NODE "pct exec $VMID -- bash -c 'systemctl start blockscout && sleep 5 && systemctl status blockscout --no-pager -l | head -10'"
fi
else
# Running on same node
log_info "Executing commands directly..."
pct exec $VMID -- bash -c "systemctl start blockscout && sleep 5 && systemctl status blockscout --no-pager -l | head -10"
fi
# Wait and check
log_info "Waiting for Blockscout to start..."
sleep 15
# Check status
log_info "Checking Blockscout status..."
if [ "$CONTAINER_NODE" != "$(hostname -s)" ]; then
NODE_IP=$(pvesh get /nodes/$CONTAINER_NODE --output-format json | grep -o '"ip":"[^"]*"' | head -1 | cut -d'"' -f4 || echo "")
if [ -n "$NODE_IP" ]; then
API_RESPONSE=$(ssh root@$NODE_IP "pct exec $VMID -- timeout 10 curl -s http://127.0.0.1:4000/api/v2/status 2>&1" || echo "FAILED")
else
API_RESPONSE=$(ssh root@$CONTAINER_NODE "pct exec $VMID -- timeout 10 curl -s http://127.0.0.1:4000/api/v2/status 2>&1" || echo "FAILED")
fi
else
API_RESPONSE=$(pct exec $VMID -- timeout 10 curl -s http://127.0.0.1:4000/api/v2/status 2>&1 || echo "FAILED")
fi
if echo "$API_RESPONSE" | grep -q "chain_id\|success"; then
log_success "Blockscout is responding!"
echo "$API_RESPONSE" | head -10
else
log_warn "Blockscout may still be starting or has issues"
echo "Response: $API_RESPONSE"
echo ""
log_info "Try checking logs:"
echo " pct exec $VMID -- journalctl -u blockscout -n 50"
echo " pct exec $VMID -- docker-compose -f /opt/blockscout/docker-compose.yml logs"
fi
echo ""
log_info "Script complete!"