2958946517
${IMPORT_PATH} = <system namespace root>/userdata/import — ONE drop-zone per box,
on the system drive, injected at BOTH compose-env builders with NO per-drive
fallback (unresolvable leaves it unset so compose fails loudly rather than
quietly building a second, dead drop-zone).
Third BindRoot (RootImport) + Import list in BackupSpec, extended through
ValidateBackupSpec/ClassifyBinds. Load-bearing: a stale `userdata: import/<app>`
entry against the moved bind would be a WHOLE-BLOCK reject, taking the app's
mandatory hdd classification with it.
Exhaustive-root audit: resolveAbs/structuralGuard/ComputeCaptureSet/
ComputeFabBuckets now take importRoot explicitly (an import bind resolved
against hddPath would name a directory on the wrong drive); unresolvable is
refused loudly into Skipped. GetImportRoot added to both provider interfaces.
Catalog-derived skeleton: UserdataSkeleton() -> UserdataSkeletonCarry() +
BuildUserdataSkeleton(), SORTED. The carry-list makes zero-removals true by
construction (`documents` is in no catalog app but on both boxes) and is the
fresh-box floor. The sort is not tidiness: the naive map-order derivation
measured 20 distinct outputs from 20 identical runs, which with fbNeedsRecreate
is a fleet-wide FileBrowser restart loop.
One authoritative compose parser: ParseComposeUserdataMounts now delegates to
ParseComposeClassifiableBinds. Import root excluded from per-app migration.
Surfaces: FileBrowser /srv/beolvasas source; app-page "Hova tegyem a fajlokat?"
with PathEscape deep links (never QueryEscape) and class-driven copy;
data_paths: annotation with the Fork-3 asymmetry; system-owned beolvasas SMB
share refused server-side at handler AND store, button omitted in template.
Caught on the way: the sharing template's row struct was function-local, so
adding {{if .System}} would have 500'd every share row. ShareRow is now
package-level and the render test uses the handler's own type.
Tests 915 -> 949, all green. MinAgent unchanged.
62 lines
3.0 KiB
Go
62 lines
3.0 KiB
Go
// Package appexport provides per-app export/import via .fab bundles.
|
|
// A .fab file is a tar.gz (optionally password-encrypted) containing an app's
|
|
// config, database dump, and all user data — everything needed to restore
|
|
// the app to its current state.
|
|
package appexport
|
|
|
|
import "gitea.dooplex.hu/admin/felhom-controller/internal/appbackup"
|
|
|
|
// ExportStackProvider provides stack data without circular imports.
|
|
// Implemented by exportAdapter in main.go (same pattern as backup.StackDataProvider).
|
|
type ExportStackProvider interface {
|
|
// GetStackDir returns the stack's directory path (e.g., /opt/docker/stacks/nextcloud).
|
|
GetStackDir(name string) (string, bool)
|
|
// GetStackComposePath returns the compose file path.
|
|
GetStackComposePath(name string) (string, bool)
|
|
// GetStackHDDMounts returns resolved HDD bind mount host paths for the stack.
|
|
GetStackHDDMounts(name string) []string
|
|
// GetStackHDDPath returns the raw HDD_PATH env var from app.yaml.
|
|
GetStackHDDPath(name string) string
|
|
// GetImportRoot returns the CANONICAL drop-zone root (R-75), on the SYSTEM drive. ${IMPORT_PATH}
|
|
// binds resolve against THIS, never against GetStackHDDPath. Empty when unresolvable.
|
|
GetImportRoot() string
|
|
// GetStackClassifiedBinds returns the app's backup-classified compose binds + whether it carries a
|
|
// (valid) backup block (Task 2). Drives the `.fab` class-scoped export plan (Task 4); a legacy app
|
|
// (false) exports the v0.130.0 full-root capture unchanged.
|
|
GetStackClassifiedBinds(name string) ([]appbackup.ClassifiedBind, bool)
|
|
// IsStackRunning returns true if the stack has running containers.
|
|
IsStackRunning(name string) bool
|
|
// StopStack stops the stack via docker compose down.
|
|
StopStack(name string) error
|
|
// StartStack starts the stack via docker compose up -d.
|
|
StartStack(name string) error
|
|
// GetStackDisplayName returns the human-readable name from .felhom.yml.
|
|
GetStackDisplayName(name string) string
|
|
// GetStackNeedsHDD returns true if the app requires HDD storage.
|
|
GetStackNeedsHDD(name string) bool
|
|
// GetDockerVolumes returns named Docker volume names from the compose file.
|
|
GetDockerVolumes(name string) []string
|
|
// IsStackDeployed returns true if the stack has a saved app.yaml config.
|
|
IsStackDeployed(name string) bool
|
|
// GetDecryptedEnv returns the decrypted env var map from app.yaml.
|
|
GetDecryptedEnv(name string) map[string]string
|
|
|
|
// --- Import-specific methods ---
|
|
|
|
// GetStacksBaseDir returns the base directory where stacks live (e.g., /opt/docker/stacks).
|
|
GetStacksBaseDir() string
|
|
// SaveEncryptedAppConfig saves app.yaml with re-encrypted sensitive fields.
|
|
// env is the plaintext env map from the bundle; encryption uses the current server key.
|
|
SaveEncryptedAppConfig(stackDir string, env map[string]string) error
|
|
// RefreshStacks rescans all stacks and refreshes container state.
|
|
RefreshStacks() error
|
|
// RemoveStackVolumes stops the stack and removes its named Docker volumes.
|
|
RemoveStackVolumes(name string) error
|
|
}
|
|
|
|
// DrivePathInfo holds a registered storage path and its label.
|
|
type DrivePathInfo struct {
|
|
Path string
|
|
Label string
|
|
}
|