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

system

package
v2.17.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: BSD-3-Clause Imports: 64 Imported by: 0

Documentation

Overview

Package system owns Docker system-wide operations — prune, disk usage, host info, self-upgrade, system backups — and the HTTP surface that exposes them.

Index

Constants

Variables

This section is empty.

Functions

func RegisterSystem

func RegisterSystem(api huma.API, h *SystemHandler)

RegisterSystem registers system management endpoints using Huma. WebSocket statistics endpoints live in api/ws.

Types

type ConvertDockerRunInput

type ConvertDockerRunInput struct {
	EnvironmentID string                         `path:"id" doc:"Environment ID"`
	Body          system.ConvertDockerRunRequest `doc:"Docker run command"`
}

type ConvertDockerRunOutput

type ConvertDockerRunOutput struct {
	Body system.ConvertDockerRunResponse
}

type GetDockerInfoInput

type GetDockerInfoInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
}

type GetDockerInfoOutput

type GetDockerInfoOutput struct {
	Body dockerinfo.Info
}

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module wires the system domain and mounts its routes.

func New

func New(
	service *SystemService,
	activityService *activity.ActivityService,
	cfg *config.Config,
) *Module

New wires system routes around an existing service.

func (*Module) RegisterRoutes

func (m *Module) RegisterRoutes(api huma.API, appCtx handlerutil.ActivityAppContext)

RegisterRoutes mounts the system endpoints. A nil module still registers, so OpenAPI spec generation can discover the routes without a service graph.

func (*Module) Service

func (m *Module) Service() *SystemService

Service exposes the system service to collaborators.

type StartAllContainersInput

type StartAllContainersInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
}

type StartAllStoppedContainersInput

type StartAllStoppedContainersInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
}

type StopAllContainersInput

type StopAllContainersInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
}

type SystemBackupPolicy added in v2.15.0

type SystemBackupPolicy struct {
	database.BaseModel

	Enabled         bool   `gorm:"column:enabled;not null;default:false"`
	Schedule        string `gorm:"column:schedule;type:text;not null"`
	RetentionCount  int    `gorm:"column:retention_count;not null;default:7"`
	LocalEnabled    bool   `gorm:"column:local_enabled;not null;default:true"`
	S3Enabled       bool   `gorm:"column:s3_enabled;not null;default:false"`
	S3DestinationID string `gorm:"column:s3_destination_id;type:text;index"`
}

func (SystemBackupPolicy) TableName added in v2.15.0

func (SystemBackupPolicy) TableName() string

func (SystemBackupPolicy) ToDTO added in v2.15.0

type SystemBackupRun added in v2.15.0

type SystemBackupRun struct {
	database.BaseModel

	Size              int64                          `json:"size" gorm:"column:size" sortable:"true"`
	CreatedAt         time.Time                      `json:"createdAt" gorm:"column:created_at" sortable:"true"`
	Status            SystemBackupStatus             `json:"status" gorm:"column:status;type:text;not null" sortable:"true"`
	Trigger           SystemBackupTrigger            `json:"trigger" gorm:"column:trigger;type:text;not null" sortable:"true"`
	Destination       backup.SystemBackupDestination `json:"destination" gorm:"column:destination;type:text;not null" sortable:"true"`
	LocalSnapshotID   string                         `json:"localSnapshotId,omitempty" gorm:"column:local_snapshot_id;type:text"`
	RemoteSnapshotID  string                         `json:"remoteSnapshotId,omitempty" gorm:"column:remote_snapshot_id;type:text"`
	S3DestinationID   string                         `json:"s3DestinationId,omitempty" gorm:"column:s3_destination_id;type:text;index"`
	S3DestinationName string                         `json:"s3DestinationName,omitempty" gorm:"-"`
	PolicyID          string                         `json:"policyId,omitempty" gorm:"column:policy_id;type:text;index"`
	Error             string                         `json:"error,omitempty" gorm:"column:error;type:text"`
}

func (SystemBackupRun) TableName added in v2.15.0

func (SystemBackupRun) TableName() string

func (SystemBackupRun) ToDTO added in v2.15.0

type SystemBackupStatus added in v2.15.0

type SystemBackupStatus string

type SystemBackupTrigger added in v2.15.0

type SystemBackupTrigger string

type SystemHandler

type SystemHandler struct {
	// contains filtered or unexported fields
}

SystemHandler handles system management endpoints.

func NewHandler added in v2.15.0

func NewHandler(systemService *SystemService, appCtx context.Context) *SystemHandler

func (*SystemHandler) ConvertDockerRun

func (h *SystemHandler) ConvertDockerRun(ctx context.Context, input *ConvertDockerRunInput) (*ConvertDockerRunOutput, error)

ConvertDockerRun converts a docker run command to docker-compose format.

func (*SystemHandler) GetDockerInfo

func (h *SystemHandler) GetDockerInfo(ctx context.Context, input *GetDockerInfoInput) (*GetDockerInfoOutput, error)

GetDockerInfo returns Docker daemon version and system information.

func (*SystemHandler) Health

func (h *SystemHandler) Health(ctx context.Context, input *SystemHealthInput) (*struct{}, error)

Health checks if the Docker daemon is responsive.

func (*SystemHandler) StartAllContainers

StartAllContainers starts all Docker containers.

func (*SystemHandler) StartAllStoppedContainers

StartAllStoppedContainers starts all stopped Docker containers.

func (*SystemHandler) StopAllContainers

StopAllContainers stops all running Docker containers.

type SystemHealthInput

type SystemHealthInput struct {
	EnvironmentID string `path:"id" doc:"Environment ID"`
}

type SystemService

type SystemService struct {
	// contains filtered or unexported fields
}

SystemService owns Docker system-wide operations and coordinates the prune and self-upgrade features.

func NewSystemService

func NewSystemService(
	db *database.DB,
	dockerService *dockerInternal.DockerClientService,
	containerService *container.ContainerService,
	imageUpdateService *imageupdate.ImageUpdateService,
	volumeService *volume.VolumeService,
	networkService *network.NetworkService,
	settingsService *settings.SettingsService,
	activityService *activity.ActivityService,
	versionService *version.VersionService,
	eventService *event.EventService,
	projectService *project.ProjectService,
	registryService *registry.ContainerRegistryService,
	backupEngine *backup.Engine,
	s3Destinations *s3.S3DestinationService,
	recoveryKeys *backup.RecoveryKeyStore,
	actors *francis.Runtime,
	cfg *config.Config,
) *SystemService

func (*SystemService) GetDiskUsagePath

func (s *SystemService) GetDiskUsagePath(ctx context.Context) string

func (*SystemService) GetDockerHostMemory added in v2.10.2

func (s *SystemService) GetDockerHostMemory(ctx context.Context) (uint64, uint64, bool)

GetDockerHostMemory reports enclosing guest memory when Docker shares its host's cgroup namespace. A false result leaves the caller's baseline intact.

func (*SystemService) GetDockerInfo added in v2.17.0

func (s *SystemService) GetDockerInfo(ctx context.Context) (dockerinfo.Info, error)

GetDockerInfo returns Docker daemon version and system information.

func (*SystemService) PingDocker added in v2.17.0

func (s *SystemService) PingDocker(ctx context.Context) error

PingDocker checks that the Docker daemon is responsive.

func (*SystemService) PruneLocalBackupRepository added in v2.16.0

func (s *SystemService) PruneLocalBackupRepository(ctx context.Context) error

PruneLocalBackupRepository frees the space of deleted local system backups.

func (*SystemService) PruneScheduled added in v2.15.0

func (s *SystemService) PruneScheduled(ctx context.Context, environmentID string, req system.PruneAllRequest) (*system.PruneAllResult, bool, error)

PruneScheduled runs the scheduled prune job.

func (*SystemService) PruneUpgradeLogs added in v2.15.0

func (s *SystemService) PruneUpgradeLogs(ctx context.Context, dataDir string, now time.Time) (int, error)

PruneUpgradeLogs removes expired upgrade logs.

func (*SystemService) ReconcileInterruptedBackups added in v2.15.0

func (s *SystemService) ReconcileInterruptedBackups(ctx context.Context, protectedIDs ...string) error

ReconcileInterruptedBackups fails system backup runs left running by the previous process and watches the manual backups that saved workflows resume.

func (*SystemService) ReconcileScheduledPrune added in v2.15.0

func (s *SystemService) ReconcileScheduledPrune(ctx context.Context, previous scheduler.Run) (scheduler.Outcome, error)

ReconcileScheduledPrune recovers an interrupted scheduled prune.

func (*SystemService) RegisterBackupJobOnStartup added in v2.15.0

func (s *SystemService) RegisterBackupJobOnStartup(ctx context.Context)

RegisterBackupJobOnStartup schedules every saved system and system-managed volume backup policy.

func (*SystemService) RegisterWorkflows added in v2.16.0

func (s *SystemService) RegisterWorkflows(engine *flow.Engine, environments *environment.EnvironmentService, roles *role.RoleService) error

RegisterWorkflows defines the backup workflows while the host is still unstarted.

func (*SystemService) ResumeUpdateAllOnStartup added in v2.15.0

func (s *SystemService) ResumeUpdateAllOnStartup(ctx context.Context)

ResumeUpdateAllOnStartup finalizes an update-all job interrupted by the manager restart.

func (*SystemService) SetBackupScheduler added in v2.15.0

func (s *SystemService) SetBackupScheduler(ctx context.Context, dynamicScheduler scheduler.DynamicScheduler, admissionGate *runs.Admission) error

SetBackupScheduler injects the dynamic scheduler and admission gate for per-policy system backup jobs. Agent mode leaves them unset.

func (*SystemService) StartAllContainers

func (s *SystemService) StartAllContainers(ctx context.Context, environmentID string) (*containertypes.ActionResult, error)

func (*SystemService) StartAllStoppedContainers

func (s *SystemService) StartAllStoppedContainers(ctx context.Context, environmentID string) (*containertypes.ActionResult, error)

func (*SystemService) StopAllContainers

func (s *SystemService) StopAllContainers(ctx context.Context, environmentID string) (*containertypes.ActionResult, error)

func (*SystemService) TriggerUpgradeViaCLI added in v2.15.0

func (s *SystemService) TriggerUpgradeViaCLI(ctx context.Context, user usertypes.Actor, target updater.SelfUpdateTarget) (string, error)

TriggerUpgradeViaCLI starts the self-upgrade for the updater engine.

Directories

Path Synopsis
children

Jump to

Keyboard shortcuts

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