v0.22.0: First-run setup wizard, local infra backup, hub verification
New controller features:
- Web-based setup wizard replaces docker-setup.sh interactive config
- Dual listener: :8080 (Traefik) + :8081 (direct HTTP for LAN)
- Drive scanner finds .felhom-infra-backup/ on all block devices
- Hub recovery pull (GET /api/v1/recovery/{id}) with retrieval password
- Fresh install: Hub config download or manual wizard
- CSRF protection, state persistence, Hungarian UI
- Local infra backup written to all connected drives after each backup cycle
- .felhom-infra-backup/backup.json + metadata.json with SHA256 checksum
- Hub verification: parse customer_blocked from report push response
- Limited mode after 7 days without verification
- Recovery info page on Settings + recovery-info.txt file generation
- Pending events queue: DR events sent to Hub on next report push
- docker-setup.sh v6.0.0: removed interactive wizard, minimal controller.yaml only
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
package recovery
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Info holds the data needed for the recovery info file and settings UI.
|
||||
type Info struct {
|
||||
CustomerID string
|
||||
RetrievalPassword string
|
||||
HubURL string
|
||||
SupportEmail string
|
||||
SupportURL string
|
||||
}
|
||||
|
||||
// GenerateRecoveryFile writes a plain text recovery-info.txt to the given directory.
|
||||
func GenerateRecoveryFile(info Info, version, outputDir string) error {
|
||||
if err := os.MkdirAll(outputDir, 0755); err != nil {
|
||||
return fmt.Errorf("creating recovery info directory: %w", err)
|
||||
}
|
||||
|
||||
content := fmt.Sprintf(`Felhom Controller — Vészhelyzeti információk
|
||||
=============================================
|
||||
|
||||
Ügyfél azonosító: %s
|
||||
Hub URL: %s
|
||||
Visszaállítási jelszó: %s
|
||||
|
||||
Támogatás:
|
||||
Email: %s
|
||||
Web: %s
|
||||
|
||||
Visszaállítási útmutató:
|
||||
1. Telepítse az operációs rendszert (Debian 13)
|
||||
2. Futtassa a docker-setup.sh szkriptet:
|
||||
sudo ./docker-setup.sh --domain <domain>
|
||||
3. Nyissa meg a böngészőben: http://<ip>:8081
|
||||
4. Válassza a "Visszaállítás mentésből" opciót
|
||||
5. Adja meg az ügyfél azonosítót és a visszaállítási jelszót
|
||||
6. Kövesse a varázsló utasításait
|
||||
|
||||
Generálva: %s
|
||||
Controller verzió: %s
|
||||
`,
|
||||
info.CustomerID,
|
||||
info.HubURL,
|
||||
info.RetrievalPassword,
|
||||
info.SupportEmail,
|
||||
info.SupportURL,
|
||||
time.Now().Format("2006-01-02 15:04:05"),
|
||||
version,
|
||||
)
|
||||
|
||||
path := filepath.Join(outputDir, "recovery-info.txt")
|
||||
tmp := path + ".tmp"
|
||||
if err := os.WriteFile(tmp, []byte(content), 0600); err != nil {
|
||||
os.Remove(tmp)
|
||||
return err
|
||||
}
|
||||
if err := os.Rename(tmp, path); err != nil {
|
||||
os.Remove(tmp)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user