feat(setup): hub mode triggers setup wizard with infra backup restore
docker-setup.sh --hub-customer now generates a minimal controller.yaml (no customer.id) instead of installing full hub config, triggering the setup wizard on first run. Hub credentials are passed via env vars (FELHOM_SETUP_CUSTOMER_ID, FELHOM_SETUP_PASSWORD) so the wizard auto-fills and auto-processes Hub API calls. Welcome page shows three options in hub mode: restore from Hub (primary), restore from local drives, or fresh install. On error, falls back to manual form with error displayed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+28
-6
@@ -925,11 +925,11 @@ The hub service (separate Go app in the `felhom.eu` repo) provides:
|
||||
|
||||
### 9. First-Run Setup Wizard
|
||||
|
||||
When the controller starts with no valid customer configuration (`customer.id` empty or `"demo-felhom"`), it enters **setup mode** — a web-based wizard that handles all initial configuration. This replaces the old interactive shell wizard in `docker-setup.sh`.
|
||||
When the controller starts with no valid customer configuration (`customer.id` empty), it enters **setup mode** — a web-based wizard that handles all initial configuration. This replaces the old interactive shell wizard in `docker-setup.sh`.
|
||||
|
||||
#### Setup Mode Detection (`internal/setup/setup.go`)
|
||||
|
||||
`NeedsSetup(cfg)` returns true when `customer.id` is empty or `"demo-felhom"`. In setup mode, the controller skips normal startup (no scheduler, no backup, no stacks) and serves only the wizard UI on two listeners:
|
||||
`NeedsSetup(cfg)` returns true when `customer.id` is empty or a `.needs-setup` marker file exists. In setup mode, the controller skips normal startup (no scheduler, no backup, no stacks) and serves only the wizard UI on two listeners:
|
||||
- `:8080` — behind Traefik (accessible via domain, e.g. `https://felhom.example.com`)
|
||||
- `:8081` — direct HTTP (accessible via LAN IP, e.g. `http://192.168.0.100:8081`)
|
||||
|
||||
@@ -965,6 +965,24 @@ When the controller starts with no valid customer configuration (`customer.id` e
|
||||
→ normal mode
|
||||
```
|
||||
|
||||
#### Hub Pre-Seeding
|
||||
|
||||
When `docker-setup.sh` is run with `--hub-customer` / `--hub-password`, the controller receives
|
||||
pre-seeded credentials via environment variables:
|
||||
|
||||
| Env var | Purpose |
|
||||
|---------|---------|
|
||||
| `FELHOM_SETUP_CUSTOMER_ID` | Pre-fills customer ID in wizard forms |
|
||||
| `FELHOM_SETUP_PASSWORD` | Pre-fills retrieval password for auto-processing |
|
||||
|
||||
In hub mode, the welcome page shows three cards instead of two:
|
||||
1. **"Visszaállítás a Hub-ról"** — auto-calls `PullRecovery()`, shows infra backup details
|
||||
2. **"Visszaállítás helyi meghajtóról"** — standard drive scan
|
||||
3. **"Friss telepítés"** — auto-calls `PullConfig()`, downloads config only
|
||||
|
||||
Both hub paths auto-process when credentials are pre-seeded (no form entry needed).
|
||||
On error, the wizard falls back to the manual form with the error displayed.
|
||||
|
||||
#### Key Components
|
||||
|
||||
| File | Purpose |
|
||||
@@ -994,12 +1012,16 @@ Generates `recovery-info.txt` on the system data partition with customer ID, Hub
|
||||
When a system drive fails and is replaced, the recovery flow uses the setup wizard:
|
||||
|
||||
```
|
||||
1. docker-setup.sh deploys fresh controller with minimal config (domain + paths only)
|
||||
1. docker-setup.sh deploys fresh controller with minimal config
|
||||
- With --hub-customer: credentials pre-seeded via env vars
|
||||
- Without: user enters credentials manually in wizard
|
||||
2. Controller detects empty customer.id → enters setup mode
|
||||
3. User opens wizard at http://<LAN-IP>:8081
|
||||
4. Wizard scans all drives for .felhom-infra-backup/ directories
|
||||
5. If found: one-click restore (config, settings, passwords, disk layout)
|
||||
6. If not found: Hub recovery via customer ID + retrieval password
|
||||
4. Hub mode: welcome page shows Hub restore / local scan / fresh install
|
||||
Non-hub mode: welcome page shows restore / fresh install
|
||||
5. Hub restore: auto-connects to Hub, shows infra backup details
|
||||
Local restore: scans all drives for .felhom-infra-backup/ directories
|
||||
6. One-click restore: config, settings, passwords, disk layout
|
||||
7. Controller restarts into normal mode with full config
|
||||
8. Controller auto-mounts surviving drives by UUID from disk layout
|
||||
9. Dashboard shows "Visszaállítás" (Restore) page for app-level recovery
|
||||
|
||||
Reference in New Issue
Block a user