Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- 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>
120 lines
3.9 KiB
Bash
120 lines
3.9 KiB
Bash
#!/usr/bin/env bash
|
|
# Run ON the Proxmox host (or via: ssh root@192.168.11.10 'bash -s' < scripts/fix-besu-services-on-host.sh)
|
|
# Creates besu-sentry.service in CT 1504 and besu-rpc.service in CT 2301 if Besu is installed but service missing.
|
|
# If /opt/besu or /etc/besu are missing, those CTs need Besu installed first (see docs/03-deployment/MISSING_CONTAINERS_LIST.md).
|
|
# Usage: run from project root, or on host: bash fix-besu-services-on-host.sh
|
|
|
|
set -euo pipefail
|
|
|
|
BESU_HOME="${BESU_HOME:-/opt/besu}"
|
|
BESU_CONFIG="${BESU_CONFIG:-/etc/besu}"
|
|
BESU_USER="${BESU_USER:-besu}"
|
|
BESU_GROUP="${BESU_GROUP:-besu}"
|
|
|
|
create_sentry_service() {
|
|
local vmid=1504
|
|
pct exec "$vmid" -- bash -c "cat > /etc/systemd/system/besu-sentry.service << 'SVCEOF'
|
|
[Unit]
|
|
Description=Hyperledger Besu Sentry Node
|
|
After=network.target
|
|
Wants=network-online.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=$BESU_USER
|
|
Group=$BESU_GROUP
|
|
WorkingDirectory=$BESU_HOME
|
|
Environment=\"BESU_OPTS=-Xmx2g -Xms1g\"
|
|
ExecStart=$BESU_HOME/bin/besu --config-file=$BESU_CONFIG/config-sentry.toml
|
|
Restart=always
|
|
RestartSec=10
|
|
LimitNOFILE=65536
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
SyslogIdentifier=besu-sentry
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
SVCEOF"
|
|
pct exec "$vmid" -- systemctl daemon-reload
|
|
pct exec "$vmid" -- systemctl enable besu-sentry.service
|
|
pct exec "$vmid" -- systemctl start besu-sentry.service
|
|
echo "Started besu-sentry in $vmid"
|
|
}
|
|
|
|
create_rpc_service() {
|
|
local vmid=2301
|
|
local config=""
|
|
for c in config-rpc-private.toml config-rpc.toml; do
|
|
if pct exec "$vmid" -- test -f "/etc/besu/$c" 2>/dev/null; then config="$c"; break; fi
|
|
done
|
|
[[ -z "$config" ]] && { echo "2301: No config-rpc*.toml in /etc/besu"; return 1; }
|
|
pct exec "$vmid" -- bash -c "cat > /etc/systemd/system/besu-rpc.service << SVCEOF
|
|
[Unit]
|
|
Description=Hyperledger Besu RPC Node
|
|
After=network.target
|
|
Wants=network-online.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=$BESU_USER
|
|
Group=$BESU_GROUP
|
|
WorkingDirectory=$BESU_HOME
|
|
Environment=\"BESU_OPTS=-Xmx2g -Xms1g\"
|
|
ExecStart=$BESU_HOME/bin/besu --config-file=$BESU_CONFIG/$config
|
|
Restart=always
|
|
RestartSec=10
|
|
LimitNOFILE=65536
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
SyslogIdentifier=besu-rpc
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
SVCEOF"
|
|
pct exec "$vmid" -- systemctl daemon-reload
|
|
pct exec "$vmid" -- systemctl enable besu-rpc.service
|
|
pct exec "$vmid" -- systemctl start besu-rpc.service
|
|
echo "Started besu-rpc in $vmid (config: $config)"
|
|
}
|
|
|
|
# Detect if we're inside a container (pct not available) or on host
|
|
if ! command -v pct &>/dev/null; then
|
|
echo "Not on Proxmox host (pct not found). Run this script on the host or via: ssh root@192.168.11.10 'bash -s' < scripts/fix-besu-services-on-host.sh"
|
|
exit 1
|
|
fi
|
|
|
|
ML110_VMS="1504 2301"
|
|
for v in $ML110_VMS; do
|
|
status=$(pct status "$v" 2>/dev/null | awk '{print $2}' || echo "unknown")
|
|
if [[ "$status" != "running" ]]; then
|
|
echo "CT $v not running (status: $status), skip"
|
|
continue
|
|
fi
|
|
if [[ "$v" == "1504" ]]; then
|
|
if pct exec "$v" -- test -f /opt/besu/bin/besu 2>/dev/null && pct exec "$v" -- test -f /etc/besu/config-sentry.toml 2>/dev/null; then
|
|
if ! pct exec "$v" -- systemctl cat besu-sentry.service &>/dev/null; then
|
|
create_sentry_service
|
|
else
|
|
pct exec "$v" -- systemctl start besu-sentry.service 2>/dev/null || true
|
|
echo "1504: besu-sentry already had unit, started"
|
|
fi
|
|
else
|
|
echo "1504: Besu or config-sentry.toml missing, skip"
|
|
fi
|
|
elif [[ "$v" == "2301" ]]; then
|
|
if pct exec "$v" -- test -f /opt/besu/bin/besu 2>/dev/null; then
|
|
if ! pct exec "$v" -- systemctl cat besu-rpc.service &>/dev/null; then
|
|
create_rpc_service
|
|
else
|
|
pct exec "$v" -- systemctl start besu-rpc.service 2>/dev/null || true
|
|
echo "2301: besu-rpc already had unit, started"
|
|
fi
|
|
else
|
|
echo "2301: Besu binary missing, skip"
|
|
fi
|
|
fi
|
|
done
|
|
|
|
echo "Done. Check: pct exec 1504 -- systemctl status besu-sentry; pct exec 2301 -- systemctl status besu-rpc"
|