Documentation
¶
Index ¶
- func NewCommand() *cobra.Command
- func RenderStatus(s *StatusResult, termWidth int) string
- type APIStatus
- type BackupResult
- type BackupSummary
- type DatabaseStats
- type Manager
- func (m *Manager) EnsureHostEnvironment(action string) error
- func (m *Manager) GetStatus(ctx context.Context) (*StatusResult, error)
- func (m *Manager) HasDocker() bool
- func (m *Manager) HasSystemd() bool
- func (m *Manager) IsConfigured() bool
- func (m *Manager) Logs(ctx context.Context, service string, follow bool, tail int) error
- func (m *Manager) Restart(ctx context.Context) error
- func (m *Manager) RunBackup(ctx context.Context, retention int) (*BackupResult, error)
- func (m *Manager) RunRestore(ctx context.Context, backupFile string, autoConfirm bool) error
- func (m *Manager) Start(ctx context.Context) error
- func (m *Manager) Stop(ctx context.Context) error
- type StatusResult
- type SystemdUnitStatus
- type TimerStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCommand ¶ added in v1.53.0
NewCommand builds the Immich command tree (status, backup, restore, start, stop, restart, logs). Callers in cmd/ attach the returned root to their own parent command. All runtime behavior lives here against the Manager in this package, so no command package needs to import another.
func RenderStatus ¶
func RenderStatus(s *StatusResult, termWidth int) string
RenderStatus renders a comprehensive formatted status card.
Types ¶
type APIStatus ¶
type APIStatus struct {
Reachable bool `json:"reachable"`
Response string `json:"response"`
LatencyMs float64 `json:"latencyMs"`
URL string `json:"url"`
}
APIStatus represents the REST API ping health.
type BackupResult ¶
type BackupResult struct {
BackupFile string `json:"backupFile"`
Size string `json:"size"`
ChecksumFile string `json:"checksumFile"`
ConfigArchive string `json:"configArchive"`
Duration time.Duration `json:"duration"`
Output string `json:"output"`
}
BackupResult holds results from executing backup-immich.sh.
type BackupSummary ¶
type BackupSummary struct {
Destination string `json:"destination"`
LatestDB string `json:"latestDb"`
LatestSize string `json:"latestSize"`
LatestTime string `json:"latestTime"`
TotalBackups int `json:"totalBackups"`
LatestConfig string `json:"latestConfig"`
}
BackupSummary represents information about local and NAS backups.
type DatabaseStats ¶
type DatabaseStats struct {
Users int `json:"users"`
Assets int `json:"assets"`
Albums int `json:"albums"`
Tables int `json:"tables"`
StorageDir string `json:"storageDir"`
}
DatabaseStats represents record statistics from PostgreSQL.
type Manager ¶
type Manager struct {
BasePath string
BackupDir string
PostgresData string
ComposeFile string
ServiceUnit string
BackupTimer string
BackupScript string
RestoreScript string
HTTPClient *http.Client
}
Manager handles Immich stack operations and health inspection.
func NewManager ¶
NewManager creates an Immich manager targeting the user container setup.
func (*Manager) EnsureHostEnvironment ¶
EnsureHostEnvironment performs pre-flight checks before running host-level actions.
func (*Manager) GetStatus ¶
func (m *Manager) GetStatus(ctx context.Context) (*StatusResult, error)
GetStatus probes systemd, docker, API, database, and backups gracefully across all machines.
func (*Manager) HasSystemd ¶
HasSystemd checks if systemctl user session is available.
func (*Manager) IsConfigured ¶
IsConfigured checks if Immich configuration files exist on this machine.
func (*Manager) RunRestore ¶
RunRestore executes restore-immich.sh with environment validation.
type StatusResult ¶
type StatusResult struct {
IsHostHostable bool `json:"isHostHostable"`
HostOS string `json:"hostOs"`
Service SystemdUnitStatus `json:"service"`
Timer TimerStatus `json:"timer"`
Containers []containers.ContainerDetail `json:"containers"`
API APIStatus `json:"api"`
Database DatabaseStats `json:"database"`
Backup BackupSummary `json:"backup"`
}
StatusResult aggregates full system state.