Help us shape the future of Go! Take the 2026 Go Developer Survey

immich

package
v1.60.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand added in v1.53.0

func NewCommand() *cobra.Command

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

func NewManager(basePath string) *Manager

NewManager creates an Immich manager targeting the user container setup.

func (*Manager) EnsureHostEnvironment

func (m *Manager) EnsureHostEnvironment(action string) error

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) HasDocker

func (m *Manager) HasDocker() bool

HasDocker checks if Docker CLI is available.

func (*Manager) HasSystemd

func (m *Manager) HasSystemd() bool

HasSystemd checks if systemctl user session is available.

func (*Manager) IsConfigured

func (m *Manager) IsConfigured() bool

IsConfigured checks if Immich configuration files exist on this machine.

func (*Manager) Logs

func (m *Manager) Logs(ctx context.Context, service string, follow bool, tail int) error

Logs streams logs from journalctl or docker compose.

func (*Manager) Restart

func (m *Manager) Restart(ctx context.Context) error

Restart restarts the service via systemd or docker compose fallback.

func (*Manager) RunBackup

func (m *Manager) RunBackup(ctx context.Context, retention int) (*BackupResult, error)

RunBackup executes backup-immich.sh with environment validation.

func (*Manager) RunRestore

func (m *Manager) RunRestore(ctx context.Context, backupFile string, autoConfirm bool) error

RunRestore executes restore-immich.sh with environment validation.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start brings up the service via systemd or docker compose fallback.

func (*Manager) Stop

func (m *Manager) Stop(ctx context.Context) error

Stop stops the service gracefully via systemd or docker compose fallback.

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.

type SystemdUnitStatus

type SystemdUnitStatus struct {
	Name          string `json:"name"`
	ActiveState   string `json:"activeState"`
	SubState      string `json:"subState"`
	UnitFileState string `json:"unitFileState"`
	Description   string `json:"description"`
}

SystemdUnitStatus represents systemd unit health.

type TimerStatus

type TimerStatus struct {
	Name        string `json:"name"`
	NextTrigger string `json:"nextTrigger"`
	LastTrigger string `json:"lastTrigger"`
	Passed      string `json:"passed"`
	Left        string `json:"left"`
}

TimerStatus represents systemd timer scheduling.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL