feat: add tiered startup ordering to first-boot containers

- Tier 1: Databases & Core Infrastructure (Bitcoin, MariaDB, Postgres)
- Tier 2: Core Services (LND, Fedimint) with 5s stabilization delay
- Tier 3: Applications (Home Assistant, Grafana, etc.) with 5s delay
- Matches health_monitor.rs StartupTier approach

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-14 03:06:20 +00:00
parent c0d5034e56
commit 85343ab481
2 changed files with 12 additions and 1 deletions

View File

@@ -305,7 +305,7 @@ Every test must pass **10 consecutive times** from BOTH .228→.198 AND .198→.
- [x] **ISO-02** — Added swap creation to first-boot-containers.sh. Calculates 50% of RAM (min 2GB, max 8GB), creates /swapfile, sets permissions 600, mkswap + swapon, adds to /etc/fstab. Skips if swap already exists. Runs before container creation so apps have swap available.
- [ ] **ISO-03** — Add container dependency ordering to first-boot. Same startup ordering as CONT-02 but for the first-boot-containers.sh script. **Acceptance**: Fresh install starts containers in dependency order with zero crash loops.
- [x] **ISO-03** — Added tiered startup ordering to first-boot-containers.sh. Tier 1: Databases & Core Infrastructure (Bitcoin, MariaDB, Postgres, Electrs). Tier 2: Core Services (LND, Fedimint) with 5s stabilization delay. Tier 3: Applications (Home Assistant, Grafana, etc.) with 5s delay. Matches CONT-02's StartupTier approach.
---

View File

@@ -62,6 +62,9 @@ fi
# Ensure network exists (matches deploy)
$DOCKER network create archy-net 2>/dev/null || true
# ── Tier 1: Databases & Core Infrastructure ──────────────────────────────
log "=== Tier 1: Databases & Core Infrastructure ==="
# 1. Bitcoin Knots (matches deploy exactly)
if ! $DOCKER ps --format '{{.Names}}' 2>/dev/null | grep -qE 'bitcoin-knots|archy-bitcoin-knots'; then
log "Creating Bitcoin Knots..."
@@ -202,6 +205,10 @@ if ! $DOCKER ps --format '{{.Names}}' 2>/dev/null | grep -q btcpay-server; then
docker.io/btcpayserver/btcpayserver:1.13.5 2>>"$LOG" || true
fi
# ── Tier 2: Core Services ─────────────────────────────────────────────────
log "=== Tier 2: Core Services ==="
sleep 5 # Let databases stabilize
# 4. LND
if ! $DOCKER ps --format '{{.Names}}' 2>/dev/null | grep -qE '^lnd$'; then
log "Creating LND..."
@@ -296,6 +303,10 @@ if ! $DOCKER ps --format '{{.Names}}' 2>/dev/null | grep -q fedimint-gateway; th
fi
fi
# ── Tier 3: Applications ──────────────────────────────────────────────────
log "=== Tier 3: Applications ==="
sleep 5 # Let core services stabilize
# 6. Home Assistant
if ! $DOCKER ps --format '{{.Names}}' 2>/dev/null | grep -qE 'homeassistant|home-assistant'; then
log "Creating Home Assistant..."