fix: overhaul container lifecycle — recovery, health, uninstall, UI state
Container recovery: - Health monitor: MAX_RESTART_ATTEMPTS 3→10, interval 60s→120s - Dependency-aware restarts: won't restart services before their deps - Reset dependent counters when a dependency recovers - Handle "created" state containers (were invisible to health monitor) - Added IndeedHub, mempool-api, mysql to tier system - Crash recovery: podman start timeout 30s→120s with retry - Podman client: socket timeout 5s→30s, added restart policy UI state representation: - Exit code 0 shows "stopped" (gray), not "crashed" (red) - Exit code 137 shows "killed (OOM)" - Non-zero exit shows "crashed" (red) - Added exit_code field to PackageDataEntry Install/uninstall fixes: - Install returns error when container doesn't start (was silent success) - Post-install hooks awaited instead of fire-and-forget tokio::spawn - Uninstall: graceful rm before force, volume prune, network cleanup - Uninstall returns error on partial failure (was 200 OK) Config consistency: - DB passwords read from /var/lib/archipelago/secrets/ (was hardcoded) - Bitcoin: added ZMQ ports 28332/28333 for LND block notifications - IndeedHub port 7777→8190 (was conflicting with strfry) - Marketplace versions: LND 0.17.4→0.18.4, Mempool 2.5.0→3.0.0 Performance: - Metrics collector interval 60s→300s (was duplicating health monitor) - Podman client: proper error propagation instead of unwrap_or_default Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1165,10 +1165,11 @@ cat > "$WORK_DIR/setup-tor.sh" <<'TORSCRIPT'
|
||||
# Prefers system Tor (apt package) over container
|
||||
|
||||
ARCHY_TOR_DIR="/var/lib/archipelago/tor"
|
||||
TOR_CONFIG_DIR="/var/lib/archipelago/tor-config"
|
||||
TOR_DIR="/var/lib/tor"
|
||||
LOG="/var/log/archipelago-tor.log"
|
||||
|
||||
mkdir -p "$ARCHY_TOR_DIR"
|
||||
mkdir -p "$ARCHY_TOR_DIR" "$TOR_CONFIG_DIR"
|
||||
|
||||
# Write services.json for the backend to read
|
||||
cat > "$ARCHY_TOR_DIR/services.json" <<TORJSON
|
||||
@@ -1185,11 +1186,17 @@ cat > "$ARCHY_TOR_DIR/services.json" <<TORJSON
|
||||
}
|
||||
TORJSON
|
||||
echo "services.json created"
|
||||
# Backend reads from tor-config/, not tor/
|
||||
cp "$ARCHY_TOR_DIR/services.json" "$TOR_CONFIG_DIR/services.json"
|
||||
chown -R archipelago:archipelago "$TOR_CONFIG_DIR" 2>/dev/null || true
|
||||
|
||||
# Generate torrc — use /var/lib/tor/ for hidden services (AppArmor-safe)
|
||||
cat > /etc/tor/torrc <<TORRC
|
||||
SocksPort 9050
|
||||
ControlPort 0
|
||||
SocksPort 0.0.0.0:9050
|
||||
SocksPolicy accept 10.89.0.0/16
|
||||
SocksPolicy accept 127.0.0.0/8
|
||||
SocksPolicy reject *
|
||||
# ControlPort disabled for security
|
||||
|
||||
HiddenServiceDir $TOR_DIR/hidden_service_archipelago
|
||||
HiddenServicePort 80 127.0.0.1:80
|
||||
@@ -1257,6 +1264,18 @@ for i in 1 2 3 4 5 6 7 8 9 10; do
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Sync hostnames to backend-readable directory
|
||||
HOSTNAMES_DIR="/var/lib/archipelago/tor-hostnames"
|
||||
mkdir -p "$HOSTNAMES_DIR"
|
||||
for svc in archipelago bitcoin electrumx lnd btcpay mempool fedimint; do
|
||||
if [ -f "$TOR_DIR/hidden_service_${svc}/hostname" ]; then
|
||||
cp "$TOR_DIR/hidden_service_${svc}/hostname" "$HOSTNAMES_DIR/$svc"
|
||||
echo "$(date): Synced hostname: $svc" >> "$LOG"
|
||||
fi
|
||||
done
|
||||
chown -R archipelago:archipelago "$HOSTNAMES_DIR" 2>/dev/null || true
|
||||
echo "$(date): Hostnames synced: $(ls $HOSTNAMES_DIR 2>/dev/null | tr '\n' ' ')" >> "$LOG"
|
||||
TORSCRIPT
|
||||
|
||||
chmod +x "$WORK_DIR/setup-tor.sh"
|
||||
|
||||
Reference in New Issue
Block a user