dogeboxd

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATE_INSTALLING   string = "installing"
	STATE_UPGRADING    string = "upgrading"
	STATE_READY        string = "ready"
	STATE_UNREADY      string = "unready"
	STATE_UNINSTALLING string = "uninstalling"
	STATE_UNINSTALLED  string = "uninstalled"
	STATE_PURGING      string = "purging"
	STATE_BROKEN       string = "broken"
	STATE_STOPPED      string = "stopped"
	STATE_STARTING     string = "starting"
	STATE_RUNNING      string = "running"
	STATE_STOPPING     string = "stopping"
)

Pup states

View Source
const (
	BROKEN_REASON_STATE_UPDATE_FAILED          string = "state_update_failed"
	BROKEN_REASON_DOWNLOAD_FAILED              string = "download_failed"
	BROKEN_REASON_NIX_FILE_MISSING             string = "nix_file_missing"
	BROKEN_REASON_NIX_HASH_MISMATCH            string = "nix_hash_mismatch"
	BROKEN_REASON_STORAGE_CREATION_FAILED      string = "storage_creation_failed"
	BROKEN_REASON_DELEGATE_KEY_CREATION_FAILED string = "delegate_key_creation_failed"
	BROKEN_REASON_DELEGATE_KEY_WRITE_FAILED    string = "delegate_key_write_failed"
	BROKEN_REASON_ENABLE_FAILED                string = "enable_failed"
	BROKEN_REASON_NIX_APPLY_FAILED             string = "nix_apply_failed"
)

Pup broken reasons

View Source
const (
	PUP_CHANGED_INSTALLATION int = iota
	PUP_ADOPTED                  = iota
	PUP_PURGED                   = iota
)

Variables

View Source
var (
	ErrPupNotFound      = errors.New("pup not found")
	ErrPupAlreadyExists = errors.New("pup already exists")
)

PupManager Errors

Functions

func CoerceConfigPayload added in v0.9.0

func CoerceConfigPayload(cfg PupManifestConfigFields, payload map[string]any) (map[string]string, error)

CoerceConfigPayload normalizes incoming configuration payloads into string representations.

func ExtractManifestConfigDefaults added in v0.9.0

func ExtractManifestConfigDefaults(cfg PupManifestConfigFields) (map[string]string, error)

ExtractManifestConfigDefaults converts configured defaults into the string representation used for storage.

func GetSystemEnvironmentVariablesForContainer

func GetSystemEnvironmentVariablesForContainer() map[string]string

func ManifestConfigFieldIndex added in v0.9.0

func ManifestConfigFieldIndex(cfg PupManifestConfigFields) map[string]PupManifestConfigField

ManifestConfigFieldIndex returns a map of field name to field definition.

func ManifestConfigNeedsValues added in v0.9.0

func ManifestConfigNeedsValues(cfg PupManifestConfigFields, values map[string]string) bool

ManifestConfigNeedsValues determines if any required configuration values are missing.

func NewActionLogger

func NewActionLogger(j Job, pupID string, dbx Dogeboxd) *actionLogger

func PupEnabled

func PupEnabled(b bool) func(*PupState, *[]Pupdate)

func ServeUI

func ServeUI(config ServerConfig) conductor.Service

func SetPupBrokenReason

func SetPupBrokenReason(reason string) func(*PupState, *[]Pupdate)

func SetPupConfig

func SetPupConfig(newFields map[string]string) func(*PupState, *[]Pupdate)

func SetPupHooks

func SetPupHooks(newHooks []PupHook) func(*PupState, *[]Pupdate)

func SetPupInstallation

func SetPupInstallation(state string) func(*PupState, *[]Pupdate)

func SetPupManifest added in v0.9.0

func SetPupManifest(manifest PupManifest) func(*PupState, *[]Pupdate)

func SetPupProviders

func SetPupProviders(newProviders map[string]string) func(*PupState, *[]Pupdate)

func SetPupSkippedVersion added in v0.9.0

func SetPupSkippedVersion(version string) func(*PupState, *[]Pupdate)

func SetPupVersion added in v0.9.0

func SetPupVersion(version string) func(*PupState, *[]Pupdate)

func WritePupConfigToStorage added in v0.9.0

func WritePupConfigToStorage(dataDir string, pupID string, config map[string]string, log SubLogger) error

WritePupConfigToStorage writes the pup's user configuration to a secure file in the pup's storage directory. This file is loaded by systemd via EnvironmentFile directive, keeping sensitive config values (like passwords) out of the nix files.

Types

type Action

type Action interface {
	ActionName() string
}

Actions are passed to the dogeboxd service via its * AddAction method, and represent tasks that need to * be done such as installing a package, starting or * stopping a service etc. * * All Actions must implement ActionName() to provide * a string identifier for the action type.

type ActionLogger

type ActionLogger interface {
	Progress(p int)
	Step(step string) SubLogger
}

type ActionProgress

type ActionProgress struct {
	ActionID  string        `json:"actionID"`
	PupID     string        `json:"pupID"`      // optional, only if a pup action
	Progress  int           `json:"progress"`   // 0-100
	Step      string        `json:"step"`       // a unique name for the step we're up to, ie: installing
	Msg       string        `json:"msg"`        // the message line
	Error     bool          `json:"error"`      // if this represents an error or not
	StepTaken time.Duration `json:"step_taken"` // time taken from previous step
}

Represents some information about an action underway

type AddBinaryCache

type AddBinaryCache struct {
	Host string
	Key  string
}

func (AddBinaryCache) ActionName added in v0.9.0

func (AddBinaryCache) ActionName() string

type AddSSHKey

type AddSSHKey struct {
	Key string
}

func (AddSSHKey) ActionName added in v0.9.0

func (AddSSHKey) ActionName() string

type AdoptPupOptions

type AdoptPupOptions struct {
	/// Install pup with development features enabled
	DevMode bool
}

type BootstrapInstallationBootMedia

type BootstrapInstallationBootMedia string
const (
	BootstrapInstallationMediaReadOnly  BootstrapInstallationBootMedia = "ro" // SD or ISO
	BootstrapInstallationMediaReadWrite BootstrapInstallationBootMedia = "rw" // installed to eMMC or other permanent storage in a VM
)

type BootstrapInstallationState

type BootstrapInstallationState string
const (
	BootstrapInstallationStateUnconfigured BootstrapInstallationState = "unconfigured"
	BootstrapInstallationStateNotInstalled BootstrapInstallationState = "notInstalled"
	BootstrapInstallationStateConfigured   BootstrapInstallationState = "configured"
)

type Buffer

type Buffer[T any] struct {
	Values []T
	Tail   int
}

func NewBuffer

func NewBuffer[T any](size int) *Buffer[T]

func (*Buffer[T]) Add

func (b *Buffer[T]) Add(value T)

func (*Buffer[T]) GetValues

func (b *Buffer[T]) GetValues() []T

func (*Buffer[T]) MarshalJSON

func (b *Buffer[T]) MarshalJSON() ([]byte, error)

type Change

type Change struct {
	ID string `json:"id"`
	// Seq is a monotonically increasing sequence number for ordering changes on the client.
	// It is assigned server-side when the Change is emitted.
	Seq uint64 `json:"seq"`
	// TS is the server timestamp in milliseconds since epoch, assigned when emitted.
	TS     int64  `json:"ts"`
	Error  string `json:"error"`
	Type   string `json:"type"`
	Update Update `json:"update"`
}

A Change can be the result of a Job (same ID) or represent an internal system change originating from elsewhere.

A Change encodes an 'update' (see below) A Change as the result of an Action may carry an 'error' to the frontend for the same Job ID

type CheckPupUpdates added in v0.9.0

type CheckPupUpdates struct {
	PupID string // Empty string = check all pups
}

Pup update actions

func (CheckPupUpdates) ActionName added in v0.9.0

func (CheckPupUpdates) ActionName() string

type ConsoleSubLogger

type ConsoleSubLogger struct {
	PupID string
	// contains filtered or unexported fields
}

func NewConsoleSubLogger

func NewConsoleSubLogger(pupID string, step string) *ConsoleSubLogger

func (*ConsoleSubLogger) Err

func (t *ConsoleSubLogger) Err(msg string)

func (*ConsoleSubLogger) Errf

func (t *ConsoleSubLogger) Errf(msg string, a ...any)

func (*ConsoleSubLogger) Log

func (t *ConsoleSubLogger) Log(msg string)

func (*ConsoleSubLogger) LogCmd

func (t *ConsoleSubLogger) LogCmd(cmd *exec.Cmd)

func (*ConsoleSubLogger) Logf

func (t *ConsoleSubLogger) Logf(msg string, a ...any)

func (*ConsoleSubLogger) Progress

func (t *ConsoleSubLogger) Progress(p int) SubLogger

type DKMErrorResponse

type DKMErrorResponse struct {
	Error  string `json:"error"`
	Reason string `json:"reason"`
}

type DKMErrorResponseMakeDelegate

type DKMErrorResponseMakeDelegate struct {
	Error  string `json:"error"`
	Reason string `json:"reason"`
}

type DKMManager

type DKMManager interface {
	CreateKey(password string) ([]string, error)
	// Returns "" as a token if the password supplied is invalid.
	Authenticate(password string) (string, error, error)
	RefreshToken(old string) (string, bool, error)
	InvalidateToken(token string) (bool, error)
	MakeDelegate(id string, token string) (DKMResponseMakeDelegate, error)
	// ChangePassword changes the master key password. Requires either current_password or seedphrase, and new_password.
	ChangePassword(currentPassword string, seedphrase string, newPassword string) error
}

func NewDKMManager

func NewDKMManager() DKMManager

type DKMRequestMakeDelegate

type DKMRequestMakeDelegate struct {
	ID    string `json:"id"`
	Token string `json:"token"`
}

type DKMResponseAuthenticate

type DKMResponseAuthenticate struct {
	AuthenticationToken string `json:"token"`
	ValidFor            int    `json:"valid_for"`
}

type DKMResponseChangePassword

type DKMResponseChangePassword struct {
	Changed bool `json:"changed"`
}

type DKMResponseCreateKey

type DKMResponseCreateKey struct {
	SeedPhrase []string `json:"seedphrase"`
}

type DKMResponseInvalidateToken

type DKMResponseInvalidateToken struct{}

type DKMResponseMakeDelegate

type DKMResponseMakeDelegate struct {
	Pub  string `json:"pub"`
	Priv string `json:"priv"`
	Wif  string `json:"wif"`
}

type DisablePup

type DisablePup struct {
	PupID string
}

Disable (stop) a running pup

func (DisablePup) ActionName added in v0.9.0

func (DisablePup) ActionName() string

type DisableSSH

type DisableSSH struct{}

func (DisableSSH) ActionName added in v0.9.0

func (DisableSSH) ActionName() string

type DogeboxFlags

type DogeboxFlags struct {
	IsFirstTimeWelcomeComplete bool `json:"isFirstTimeWelcomeComplete"`
	IsDeveloperMode            bool `json:"isDeveloperMode"`
}

type DogeboxState

type DogeboxState struct {
	InitialState  DogeboxStateInitialSetup
	Hostname      string
	KeyMap        string
	Timezone      string
	SSH           DogeboxStateSSHConfig
	StorageDevice string
	Flags         DogeboxFlags
	BinaryCaches  []DogeboxStateBinaryCache
	SidebarPups   []string `json:"sidebarPups"` // Pup IDs pinned to dpanel sidebar
}

type DogeboxStateBinaryCache

type DogeboxStateBinaryCache struct {
	ID   string `json:"id"`
	Host string `json:"host"`
	Key  string `json:"key"`
}

type DogeboxStateInitialSetup

type DogeboxStateInitialSetup struct {
	HasGeneratedKey    bool `json:"hasGeneratedKey"`
	HasSetNetwork      bool `json:"hasSetNetwork"`
	HasFullyConfigured bool `json:"hasFullyConfigured"`
}

type DogeboxStateSSHConfig

type DogeboxStateSSHConfig struct {
	Enabled bool                 `json:"enabled"`
	Keys    []DogeboxStateSSHKey `json:"keys"`
}

type DogeboxStateSSHKey

type DogeboxStateSSHKey struct {
	ID        string    `json:"id"`
	DateAdded time.Time `json:"dateAdded"`
	Key       string    `json:"key"`
}

type Dogeboxd

type Dogeboxd struct {
	Pups             PupManager
	SystemUpdater    SystemUpdater
	SystemMonitor    SystemMonitor
	JournalReader    JournalReader
	NetworkManager   NetworkManager
	PupUpdateChecker PupUpdateChecker

	Changes    chan Change
	JobManager *JobManager
	// contains filtered or unexported fields
}

func NewDogeboxd

func NewDogeboxd(
	stateManager StateManager,
	pups PupManager,
	updater SystemUpdater,
	monitor SystemMonitor,
	journal JournalReader,
	networkManager NetworkManager,
	sourceManager SourceManager,
	nixManager NixManager,
	logtailer LogTailer,
	pupUpdateChecker PupUpdateChecker,
	config *ServerConfig,
) Dogeboxd

func (Dogeboxd) AddAction

func (t Dogeboxd) AddAction(a Action) string

Add an Action to the Action queue, returns a unique ID which can be used to match the outcome in the Event queue

func (Dogeboxd) GetJobLogChannel added in v0.8.0

func (t Dogeboxd) GetJobLogChannel(JobID string) (context.CancelFunc, chan string, error)

GetJobLogChannel returns a log channel for a specific job Streams logs from the job's ActionLogger in real-time (same system as pup logs)

func (Dogeboxd) GetLogChannel

func (t Dogeboxd) GetLogChannel(PupID string) (context.CancelFunc, chan string, error)

func (Dogeboxd) Run

func (t Dogeboxd) Run(started, stopped chan bool, stop chan context.Context) error

Main Dogeboxd goroutine, handles routing messages in and out of the system via job and change channels, handles messages from subsystems ie: SystemUpdater, SystemMonitor etc.

func (*Dogeboxd) SetJobManager added in v0.8.0

func (t *Dogeboxd) SetJobManager(jm *JobManager)

SetJobManager sets the JobManager reference after Dogeboxd is created

type EnablePup

type EnablePup struct {
	PupID string
}

Enable a previously disabled pup

func (EnablePup) ActionName added in v0.9.0

func (EnablePup) ActionName() string

type EnableSSH

type EnableSSH struct{}

func (EnableSSH) ActionName added in v0.9.0

func (EnableSSH) ActionName() string

type EnvEntry

type EnvEntry struct {
	KEY string
	VAL string
}

type ImportBlockchainData

type ImportBlockchainData struct{}

Import blockchain data to the system (not tied to a specific pup)

func (ImportBlockchainData) ActionName added in v0.9.0

func (ImportBlockchainData) ActionName() string

type InstallPup

type InstallPup struct {
	PupName    string
	PupVersion string
	SourceId   string
	Options    AdoptPupOptions

	SessionToken string
}

Install a pup on the system

func (InstallPup) ActionName added in v0.9.0

func (InstallPup) ActionName() string

type InstallPups

type InstallPups []InstallPup

InstallPups represents a batch installation of multiple pups

func (InstallPups) ActionName added in v0.9.0

func (InstallPups) ActionName() string

type Job

type Job struct {
	A       Action
	ID      string
	Err     string
	Success any
	Start   time.Time // set when the job is first created, for calculating duration
	Logger  *actionLogger
	State   *PupState // nilable, check before use!
}

A Job is created when an Action is recieved by the system. Jobs are passed through the Dogeboxd service and result in a Change being send to the client via websockets.

type JobManager added in v0.8.0

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

JobManager handles job persistence and state management

func NewJobManager added in v0.8.0

func NewJobManager(sm *StoreManager, dbx *Dogeboxd) *JobManager

func (*JobManager) ClearAllJobs added in v0.8.0

func (jm *JobManager) ClearAllJobs() (int, error)

ClearAllJobs removes ALL jobs (for development/cleanup)

func (*JobManager) ClearCompletedJobs added in v0.8.0

func (jm *JobManager) ClearCompletedJobs(olderThan time.Duration) (int, error)

ClearCompletedJobs removes completed/failed jobs older than the specified duration

func (*JobManager) ClearOrphanedJobs added in v0.9.0

func (jm *JobManager) ClearOrphanedJobs(olderThan time.Duration) (int, error)

ClearOrphanedJobs marks jobs stuck in queued/in_progress state as failed Jobs are considered orphaned if they've been queued for longer than the threshold

func (*JobManager) CompleteJob added in v0.8.0

func (jm *JobManager) CompleteJob(jobID string, err string) error

CompleteJob marks a job as completed

func (*JobManager) CreateJobRecord added in v0.8.0

func (jm *JobManager) CreateJobRecord(j Job) (*JobRecord, error)

CreateJobRecord creates a new job record from a Job

func (*JobManager) GetActiveJobs added in v0.8.0

func (jm *JobManager) GetActiveJobs() ([]JobRecord, error)

GetActiveJobs retrieves all jobs that are queued or in progress

func (*JobManager) GetAllJobs added in v0.8.0

func (jm *JobManager) GetAllJobs() ([]JobRecord, error)

GetAllJobs retrieves all job records

func (*JobManager) GetJob added in v0.8.0

func (jm *JobManager) GetJob(jobID string) (*JobRecord, error)

GetJob retrieves a job record by ID

func (*JobManager) GetRecentJobs added in v0.8.0

func (jm *JobManager) GetRecentJobs(limit int) ([]JobRecord, error)

GetRecentJobs retrieves recent completed/failed jobs

func (*JobManager) IsJobActive added in v0.9.0

func (jm *JobManager) IsJobActive(jobID string) bool

IsJobActive returns true if the job is in the active jobs cache (not yet completed) Used to avoid duplicate CompleteJob calls

func (*JobManager) SetDogeboxd added in v0.8.0

func (jm *JobManager) SetDogeboxd(dbx *Dogeboxd)

SetDogeboxd sets the Dogeboxd reference (needed for circular dependency)

func (*JobManager) SyncWithActiveJobs added in v0.8.0

func (jm *JobManager) SyncWithActiveJobs() error

SyncWithActiveJobs ensures all jobs in the queue are tracked

func (*JobManager) UpdateJobProgress added in v0.8.0

func (jm *JobManager) UpdateJobProgress(ap ActionProgress) error

UpdateJobProgress updates job progress from ActionProgress

func (*JobManager) UpdateJobPupID added in v0.9.0

func (jm *JobManager) UpdateJobPupID(jobID string, pupID string) error

UpdateJobPupID updates the pupID of a job record (used for install jobs where pupID isn't known at creation)

type JobRecord added in v0.8.0

type JobRecord struct {
	ID             string     `json:"id"`
	Started        time.Time  `json:"started"`
	Finished       *time.Time `json:"finished"` // nil if not finished
	DisplayName    string     `json:"displayName"`
	Action         string     `json:"action"`   // Action type: install, upgrade, uninstall, etc.
	Progress       int        `json:"progress"` // 0-100
	Status         JobStatus  `json:"status"`
	SummaryMessage string     `json:"summaryMessage"`
	ErrorMessage   string     `json:"errorMessage"`
	PupID          string     `json:"pupID"` // Associated pup if applicable
}

JobRecord represents a persisted job for the frontend activity view

type JobStatus added in v0.8.0

type JobStatus string

JobStatus represents the current state of a job

const (
	JobStatusQueued     JobStatus = "queued"
	JobStatusInProgress JobStatus = "in_progress"
	JobStatusCompleted  JobStatus = "completed"
	JobStatusFailed     JobStatus = "failed"
	JobStatusCancelled  JobStatus = "cancelled"
)

type JobsUpdate added in v0.8.0

type JobsUpdate struct {
	Jobs []JobRecord `json:"jobs"`
}

JobsUpdate represents a change to the jobs list for WebSocket updates

func (JobsUpdate) MarshalJSON added in v0.8.0

func (ju JobsUpdate) MarshalJSON() ([]byte, error)

MarshalJSON custom marshaler to handle the Update interface

type JournalReader

type JournalReader interface {
	GetJournalChannel(string) (context.CancelFunc, chan string, error)
}

actively listen for systemd journal entries for a given systemd service, close channel when done

type LifecycleManager

type LifecycleManager interface {
	Shutdown()
	Reboot()
}

type LineWriter

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

func NewLineWriter

func NewLineWriter(receiver func(string)) *LineWriter

implements io.Writer and calls a function for each line

func (*LineWriter) Write

func (t *LineWriter) Write(p []byte) (int, error)

type LogTailer

type LogTailer interface {
	GetChannel(string) (context.CancelFunc, chan string, error)
}

type ManifestSource

type ManifestSource interface {
	ValidateFromLocation(location string) (ManifestSourceConfiguration, error)
	Config() ManifestSourceConfiguration
	List(ignoreCache bool) (ManifestSourceList, error)
	Download(diskPath string, remoteLocation map[string]string) error
}

type ManifestSourceConfiguration

type ManifestSourceConfiguration struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Location    string `json:"location"`
	Type        string `json:"type"`
}

type ManifestSourceList

type ManifestSourceList struct {
	Config      ManifestSourceConfiguration
	LastChecked time.Time
	Pups        []ManifestSourcePup
	Error       string `json:"error,omitempty"`
}

type ManifestSourcePup

type ManifestSourcePup struct {
	Name         string
	Location     map[string]string
	Version      string
	Manifest     PupManifest
	LogoBase64   string
	ReleaseNotes string
	ReleaseDate  *time.Time
	ReleaseURL   string
}

type NetworkConnection

type NetworkConnection interface {
	// contains filtered or unexported methods
}

type NetworkConnector

type NetworkConnector interface {
	Connect(network SelectedNetwork) error
}

type NetworkEthernet

type NetworkEthernet struct {
	Type      string `json:"type"`
	Interface string `json:"interface"`
}

type NetworkManager

type NetworkManager interface {
	GetAvailableNetworks() []NetworkConnection
	SetPendingNetwork(selectedNetwork SelectedNetwork, j Job) error
	TryConnect(nixPatch NixPatch) error
	TestConnect() error
	GetLocalIP() (net.IP, error)
}

type NetworkPersistor

type NetworkPersistor interface {
	Persist(nixPatch NixPatch, network SelectedNetwork)
}

type NetworkState

type NetworkState struct {
	CurrentNetwork SelectedNetwork
	PendingNetwork SelectedNetwork
}

type NetworkWifi

type NetworkWifi struct {
	Type      string            `json:"type"`
	Interface string            `json:"interface"`
	Ssids     []NetworkWifiSSID `json:"ssids"`
}

type NetworkWifiSSID

type NetworkWifiSSID struct {
	Ssid       string  `json:"ssid"`
	Bssid      string  `json:"bssid"` // TODO: this should probably not be a string?
	Encryption string  `json:"encryption,omitempty"`
	Quality    float32 `json:"quality"`
	Signal     string  `json:"signal"`
}

type NixFirewallTemplateValues

type NixFirewallTemplateValues struct {
	SSH_ENABLED bool
	PUP_PORTS   []struct {
		PORT   int
		PUBLIC bool
		PUP_ID string
	}
}

type NixIncludesFileTemplateValues

type NixIncludesFileTemplateValues struct {
	NIX_DIR string
	PUP_IDS []string
}

type NixManager

type NixManager interface {
	// NixPatch passthrough helpers.
	InitSystem(patch NixPatch, dbxState DogeboxState)
	UpdateIncludesFile(patch NixPatch, pups PupManager)
	WritePupFile(patch NixPatch, state PupState, dbxState DogeboxState)
	RemovePupFile(patch NixPatch, pupId string)
	UpdateSystemContainerConfiguration(patch NixPatch)
	UpdateFirewallRules(patch NixPatch, dbxState DogeboxState)
	UpdateNetwork(patch NixPatch, values NixNetworkTemplateValues)
	UpdateSystem(patch NixPatch, values NixSystemTemplateValues)
	UpdateStorageOverlay(patch NixPatch, partitionName string)

	RebuildBoot(log SubLogger) error
	Rebuild(log SubLogger) error

	NewPatch(log SubLogger) NixPatch
}

type NixNetworkTemplateValues

type NixNetworkTemplateValues struct {
	USE_ETHERNET  bool
	USE_WIRELESS  bool
	INTERFACE     string
	WIFI_SSID     string
	WIFI_PASSWORD string
}

type NixPatch

type NixPatch interface {
	State() string
	Apply() error
	ApplyCustom(options NixPatchApplyOptions) error

	Cancel() error

	UpdateSystemContainerConfiguration(values NixSystemContainerConfigTemplateValues)
	UpdateFirewall(values NixFirewallTemplateValues)
	UpdateSystem(values NixSystemTemplateValues)
	UpdateNetwork(values NixNetworkTemplateValues)
	UpdateIncludesFile(values NixIncludesFileTemplateValues)
	WritePupFile(pupId string, values NixPupContainerTemplateValues)
	RemovePupFile(pupId string)
	UpdateStorageOverlay(values NixStorageOverlayTemplateValues)
}

type NixPatchApplyOptions

type NixPatchApplyOptions struct {
	RebuildBoot        bool
	DangerousNoRebuild bool
}

type NixPupContainerServiceValues

type NixPupContainerServiceValues struct {
	NAME string
	EXEC string
	CWD  string
	ENV  []EnvEntry
}

type NixPupContainerTemplateValues

type NixPupContainerTemplateValues struct {
	DATA_DIR          string
	CONTAINER_LOG_DIR string
	PUP_ID            string
	PUP_ENABLED       bool
	INTERNAL_IP       string
	PUP_PORTS         []struct {
		PORT   int
		PUBLIC bool
	}
	STORAGE_PATH string
	PUP_PATH     string
	NIX_FILE     string
	SERVICES     []NixPupContainerServiceValues
	PUP_ENV      []EnvEntry
	GLOBAL_ENV   []EnvEntry

	IS_DEV_MODE       bool
	DEV_MODE_SERVICES []string
}

type NixStorageOverlayTemplateValues

type NixStorageOverlayTemplateValues struct {
	STORAGE_DEVICE string
	DATA_DIR       string
	DBX_UID        string
}

type NixSystemContainerConfigTemplatePupRequiresInternet

type NixSystemContainerConfigTemplatePupRequiresInternet struct {
	PUP_ID string
	PUP_IP string
}

type NixSystemContainerConfigTemplatePupTcpConnection

type NixSystemContainerConfigTemplatePupTcpConnection struct {
	NAME       string
	ID         string
	IP         string
	OTHER_PUPS []NixSystemContainerConfigTemplatePupTcpConnectionOtherPup
}

type NixSystemContainerConfigTemplatePupTcpConnectionOtherPup

type NixSystemContainerConfigTemplatePupTcpConnectionOtherPup struct {
	NAME  string
	ID    string
	IP    string
	PORTS []struct {
		PORT int
	}
}

type NixSystemContainerConfigTemplateValues

type NixSystemContainerConfigTemplateValues struct {
	DOGEBOX_HOST_IP         string
	DOGEBOX_CONTAINER_CIDR  string
	PUPS_REQUIRING_INTERNET []NixSystemContainerConfigTemplatePupRequiresInternet
	PUPS_TCP_CONNECTIONS    []NixSystemContainerConfigTemplatePupTcpConnection
}

type NixSystemTemplateValues

type NixSystemTemplateValues struct {
	SYSTEM_HOSTNAME   string
	KEYMAP            string
	TIMEZONE          string
	SSH_ENABLED       bool
	SSH_KEYS          []DogeboxStateSSHKey
	BINARY_CACHE_SUBS []string
	BINARY_CACHE_KEYS []string
}

type ProcStatus

type ProcStatus struct {
	CPUPercent float64 `json:"cpuPercent"`
	MEMPercent float64 `json:"memPercent"`
	MEMMb      float64 `json:"memMb"`
	Running    bool    `json:"running"`

	// ActiveState/SubState come from systemd and help disambiguate transient states
	// like activating/deactivating even when MainPID is not yet (or no longer) present.
	ActiveState string `json:"activeState,omitempty"`
	SubState    string `json:"subState,omitempty"`
}

SystemMonitor issues these for monitored PUPs

type PupAsset

type PupAsset struct {
	Logos PupLogos `json:"logos"`
}

type PupDependencyReport

type PupDependencyReport struct {
	Interface             string                        `json:"interface"`
	Version               string                        `json:"version"`
	Optional              bool                          `json:"optional"`
	CurrentProvider       string                        `json:"currentProvider"`
	InstalledProviders    []string                      `json:"installedProviders"`
	InstallableProviders  []PupManifestDependencySource `json:"InstallableProviders"`
	DefaultSourceProvider PupManifestDependencySource   `json:"DefaultProvider"`
}

type PupHealthStateReport

type PupHealthStateReport struct {
	Issues    PupIssues
	NeedsConf bool
	NeedsDeps bool
}

type PupHook

type PupHook struct {
	Port int    `json:"port"`
	Path string `json:"path"`
	ID   string `json:"id"`
}

type PupInterfaceVersion added in v0.9.0

type PupInterfaceVersion struct {
	InterfaceName string   `json:"interfaceName"`
	OldVersion    string   `json:"oldVersion"`
	NewVersion    string   `json:"newVersion"`
	ChangeType    string   `json:"changeType"`   // "major", "minor", "patch"
	AffectedPups  []string `json:"affectedPups"` // PupIDs that depend on this interface
}

PupInterfaceVersion tracks changes to provided interfaces

type PupIssues

type PupIssues struct {
	DepsNotRunning   []string `json:"depsNotRunning"`
	HealthWarnings   []string `json:"healthWarnings"`
	UpgradeAvaialble bool     `json:"upgradeAvailable"`
}

type PupLogos

type PupLogos struct {
	MainLogoBase64 string `json:"mainLogoBase64"`
}

type PupManager

type PupManager interface {
	// Run starts the PupManager as a service.
	Run(started, stopped chan bool, stop chan context.Context) error

	// GetUpdateChannel returns a channel for receiving pup updates.
	GetUpdateChannel() chan Pupdate

	// GetStatsChannel returns a channel for receiving pup stats.
	GetStatsChannel() chan []PupStats

	// GetStateMap returns a map of all pup states.
	GetStateMap() map[string]PupState

	// GetStatsMap returns a map of all pup stats.
	GetStatsMap() map[string]PupStats

	// GetAssetsMap returns a map of pup assets like logos.
	GetAssetsMap() map[string]PupAsset

	// AdoptPup adds a new pup from a manifest. It returns the PupID and an error if any.
	AdoptPup(m PupManifest, source ManifestSource, options AdoptPupOptions) (string, error)

	// UpdatePup updates the state of a pup with provided update functions.
	UpdatePup(id string, updates ...func(*PupState, *[]Pupdate)) (PupState, error)

	// PurgePup removes a pup and its state from the manager.
	PurgePup(pupId string) error

	// GetPup retrieves the state and stats for a specific pup by ID.
	GetPup(id string) (PupState, PupStats, error)

	// FindPupByIP retrieves a pup by its assigned IP address.
	FindPupByIP(ip string) (PupState, PupStats, error)

	// GetAllFromSource retrieves all pups from a specific source.
	GetAllFromSource(source ManifestSourceConfiguration) []*PupState

	// GetPupFromSource retrieves a specific pup by name from a source.
	GetPupFromSource(name string, source ManifestSourceConfiguration) *PupState

	// GetMetrics retrieves the metrics for a specific pup.
	GetMetrics(pupId string) map[string]interface{}

	// UpdateMetrics updates the metrics for a pup based on provided data.
	UpdateMetrics(u UpdateMetrics)

	// CanPupStart checks if a pup can start based on its current state and dependencies.
	CanPupStart(pupId string) (bool, error)

	// GetPupHealthState returns the health state report for a pup.
	GetPupHealthState(pup *PupState) PupHealthStateReport

	// CalculateDeps calculates the dependencies for a pup.
	CalculateDeps(pupID string) ([]PupDependencyReport, error)

	// SetSourceManager sets the SourceManager for the PupManager.
	SetSourceManager(sourceManager SourceManager)

	// FastPollPup initiates a rapid polling of a specific pup for debugging or immediate updates.
	FastPollPup(pupId string)

	GetPupSpecificEnvironmentVariablesForContainer(pupID string) map[string]string

	// StopPup stops a running pup by disabling it and triggering a rebuild
	StopPup(pupID string, nixManager NixManager, logger SubLogger) error

	// StartPup starts a stopped pup by enabling it and triggering a rebuild
	StartPup(pupID string, nixManager NixManager, logger SubLogger) error

	// Snapshot management
	CreateSnapshot(pupState PupState) error
	GetSnapshot(pupID string) (*PupVersionSnapshot, error)
	HasSnapshot(pupID string) bool
	DeleteSnapshot(pupID string) error
	ListSnapshots() ([]string, error)
	CleanOldSnapshots(maxAge time.Duration) (int, error)

	// ClearCacheEntry removes a specific pup from the update cache
	ClearCacheEntry(pupID string)
}

The PupManager is responsible for all aspects of the pup lifecycle * see pkg/pup/manager.go

type PupManifest

type PupManifest struct {
	// The version of the actual manifest. This differs from the "version"
	// of the pup, and the version of the deployed software for this pup.
	// Valid values: 1
	ManifestVersion int                     `json:"manifestVersion"`
	Meta            PupManifestMeta         `json:"meta"`
	Config          PupManifestConfigFields `json:"config"`
	Container       PupManifestContainer    `json:"container"`
	Interfaces      []PupManifestInterface  `json:"interfaces"`
	Dependencies    []PupManifestDependency `json:"dependencies"`
	Metrics         []PupManifestMetric     `json:"metrics"`
}

PupManifest represents a Nix installed process * running inside the Dogebox Runtime Environment. * These are defined in pup.json files.

func LoadManifestFromPath added in v0.9.0

func LoadManifestFromPath(pupPath string) (PupManifest, error)

LoadManifestFromPath loads a PupManifest from a pup directory

func (*PupManifest) Validate

func (m *PupManifest) Validate() error

type PupManifestBuild

type PupManifestBuild struct {
	// The location of the nix file used for building this pups environment.
	NixFile string `json:"nixFile"`
	// The SHA256 hash of the nix file.
	NixFileSha256 string `json:"nixFileSha256"`
}

PupManifestBuild holds information about the target nix * package that is to be built for this pup.

type PupManifestCommand

type PupManifestCommand struct {
	// Required. The whole executable string, including any arguments that need to be passed.
	Exec string `json:"exec"`
	// Optional. The working directory specified for a systemd service.
	CWD string `json:"cwd"`
	// Optional. Any environment variables that need to be set.
	ENV map[string]string `json:"env"`
}

Represents the command to run inside this PUP * Container.

type PupManifestConfigField added in v0.9.0

type PupManifestConfigField struct {
	Label       string   `json:"label"`
	Name        string   `json:"name"`
	Type        string   `json:"type"`
	Required    bool     `json:"required"`
	Placeholder string   `json:"placeholder,omitempty"`
	Help        string   `json:"help,omitempty"`
	Default     any      `json:"default,omitempty"`
	Min         *float64 `json:"min,omitempty"`
	Max         *float64 `json:"max,omitempty"`
	Step        *float64 `json:"step,omitempty"`
}

type PupManifestConfigFields

type PupManifestConfigFields struct {
	ShowOnInstall bool                       `json:"showOnInstall"`
	Sections      []PupManifestConfigSection `json:"sections"`
}

Represents fields that are user settable, which provide the values * for templates (Args, ENV, ConfigFiles), we only care about Name

type PupManifestConfigSection added in v0.9.0

type PupManifestConfigSection struct {
	Name   string                   `json:"name"`
	Label  string                   `json:"label"`
	Fields []PupManifestConfigField `json:"fields"`
}

type PupManifestContainer

type PupManifestContainer struct {
	Build PupManifestBuild `json:"build"`
	// A single nix build file can provide multiple services, which all
	// may need to be started separately. Each "service" should be provided
	// as an artifact here with the correct execution configuration.
	Services []PupManifestService      `json:"services"`
	Exposes  []PupManifestExposeConfig `json:"exposes"`
	// This pup requires internet access to function.
	RequiresInternet bool `json:"requiresInternet"`
}

PupManfiestV1Container contains information about the * execution environment of the pup, including both build * and runtime details of whatever is to be executed.

type PupManifestDependency

type PupManifestDependency struct {
	InterfaceName    string                      `json:"interfaceName"`    // interface that we depend on
	InterfaceVersion string                      `json:"interfaceVersion"` // semver expression
	PermissionGroups []string                    `json:"permissionGroups"` // list of permission groups from that interface we want
	DefaultSource    PupManifestDependencySource `json:"source"`           // optional, default package that provides this interface
	Optional         bool                        `json:"optional"`
}

Dependency specifies that this pup requires * another pup to be running, and what permission * groups from that pup need to be available.

type PupManifestDependencySource

type PupManifestDependencySource struct {
	SourceLocation string `json:"sourceLocation"`
	PupName        string `json:"pupName"`
	PupVersion     string `json:"pupVersion"`
	PupLogoBase64  string `json:"pupLogoBase64"`
}

A DependencySource specifies the location of a * dependency that needs to be installed. We list it in the manifest * so that if a user doesn't already have this source set up we * can still resolve this dependency tree.

type PupManifestExposeConfig

type PupManifestExposeConfig struct {
	Name         string   `json:"name"`         // Freeform field used to refer to this port in the frontend.
	Type         string   `json:"type"`         // Must be one of: http, tcp
	Port         int      `json:"port"`         // The port that is being listened on inside the container.
	Interfaces   []string `json:"interfaces"`   // Designates that certain interfaces can be accessed on this port
	ListenOnHost bool     `json:"listenOnHost"` // If true, the port will be accessible on the host network, otherwise it will listen on a private internal network interface.
	WebUI        bool     `json:"webUI"`        // If true, will be proxied from an available port to the dPanel user
}

Allow the user to expose certain ports in their container.

type PupManifestInterface

type PupManifestInterface struct {
	Name             string                       `json:"name"`             // the globally unique name for this interface
	Version          string                       `json:"version"`          // Semver ie: 0.1.1
	PermissionGroups []PupManifestPermissionGroup `json:"permissionGroups"` // The permission groups that make up this interface
}

type PupManifestMeta

type PupManifestMeta struct {
	Name string `json:"name"`
	// The version of the pup.
	// nb. This can differ from the version of the software deployed
	//     by this pup, as we may change this pup manifest to expose
	//     additional configuration options for the same software version.
	Version string `json:"version"`
	// Optional. A path to a logo for this pup.
	LogoPath string `json:"logoPath"`
	// A short description, single line.
	ShortDescription string `json:"shortDescription"`
	// Optional, longer description. Used for store listings.
	LongDescription string `json:"longDescription"`
	// A key value pair of upstream versions that this pup ships with.
	UpstreamVersions map[string]string `json:"upstreamVersions"`
}

PupManifestMeta holds meta information about this pup * such as its name, version, any imagery that needs to be shown.

type PupManifestMetric

type PupManifestMetric struct {
	Name        string `json:"name"`
	Label       string `json:"label"`
	Type        string `json:"type"` // string, int, float
	HistorySize int    `json:"history"`
	Description string `json:"description,omitempty"`
}

type PupManifestPermissionGroup

type PupManifestPermissionGroup struct {
	Name        string   `json:"name"`        // ie:  admin, wallet-read-only, etc.
	Description string   `json:"description"` // What does this permission group do (shown to user)
	Severity    int      `json:"severity"`    // 1-3, 1: critical/danger, 2: makes changes, 3: read only stuff
	Routes      []string `json:"routes"`      // http routes accessible for this group
	Port        int      `json:"port"`        // port accessible for this group
}

PermissionGroups define how other * pups can request access to this pup's * APIs and resources, via their Dependencies

type PupManifestService

type PupManifestService struct {
	Name    string             `json:"name"`
	Command PupManifestCommand `json:"command"`
}

type PupMetric

type PupMetric struct {
	Value any `json:"value"`
}

type PupMetrics

type PupMetrics[T any] struct {
	Name   string     `json:"name"`
	Label  string     `json:"label"`
	Type   string     `json:"type"`
	Values *Buffer[T] `json:"values"`
}

type PupState

type PupState struct {
	ID           string                      `json:"id"`
	LogoBase64   string                      `json:"logoBase64"`
	Source       ManifestSourceConfiguration `json:"source"`
	Manifest     PupManifest                 `json:"manifest"`
	Config       map[string]string           `json:"config"`
	ConfigSaved  bool                        `json:"configSaved"`  // Has config been saved at least once?
	Providers    map[string]string           `json:"providers"`    // providers of interface dependencies
	Hooks        []PupHook                   `json:"hooks"`        // webhooks
	Installation string                      `json:"installation"` // see table above and constants
	BrokenReason string                      `json:"brokenReason"` // reason for being in a broken state
	Enabled      bool                        `json:"enabled"`      // Is this pup supposed to be running?
	NeedsConf    bool                        `json:"needsConf"`    // Has all required config been provided?
	NeedsDeps    bool                        `json:"needsDeps"`    // Have all dependencies been met?
	IP           string                      `json:"ip"`           // Internal IP for this pup
	Version      string                      `json:"version"`
	WebUIs       []PupWebUI                  `json:"webUIs"`

	IsDevModeEnabled bool     `json:"isDevModeEnabled"`
	DevModeServices  []string `json:"devModeServices"`

	// Update management
	SkippedVersion string `json:"skippedVersion,omitempty"` // Version up to which updates are skipped
}

PupState is persisted to disk

type PupStats

type PupStats struct {
	ID            string            `json:"id"`
	Status        string            `json:"status"`
	SystemMetrics []PupMetrics[any] `json:"systemMetrics"`
	Metrics       []PupMetrics[any] `json:"metrics"`
	Issues        PupIssues         `json:"issues"`
}

PupStats is not persisted to disk, and holds the running stats for the pup process, ie: disk, CPU, etc.

type PupUpdateChecker added in v0.9.0

type PupUpdateChecker interface {
	// CheckForUpdates checks for updates for a specific pup
	CheckForUpdates(pupID string) (PupUpdateInfo, error)

	// CheckAllPupUpdates checks for updates for all installed pups
	CheckAllPupUpdates() map[string]PupUpdateInfo

	// GetCachedUpdateInfo retrieves update information from the cache
	GetCachedUpdateInfo(pupID string) (PupUpdateInfo, bool)

	// GetAllCachedUpdates retrieves all update information from the cache
	GetAllCachedUpdates() map[string]PupUpdateInfo

	// ClearCacheEntry removes a specific pup from the update cache
	ClearCacheEntry(pupID string)

	// StartPeriodicCheck starts a background goroutine that checks for updates periodically
	StartPeriodicCheck(stop chan bool)

	// GetEventChannel returns the channel for update check completion events
	GetEventChannel() <-chan PupUpdatesCheckedEvent

	// DetectInterfaceChanges compares interfaces between two manifests and returns changes
	DetectInterfaceChanges(oldManifest, newManifest PupManifest) []PupInterfaceVersion
}

The PupUpdateChecker is used to check for pup updates

type PupUpdateInfo added in v0.9.0

type PupUpdateInfo struct {
	PupID             string       `json:"pupId"`
	CurrentVersion    string       `json:"currentVersion"`
	LatestVersion     string       `json:"latestVersion"`
	AvailableVersions []PupVersion `json:"availableVersions"`
	UpdateAvailable   bool         `json:"updateAvailable"`
	LastChecked       time.Time    `json:"lastChecked"`
}
Pup update types

PupUpdateInfo tracks available updates for a pup

type PupUpdatePreviousVersion added in v0.9.0

type PupUpdatePreviousVersion struct {
	PupID           string              `json:"pupId"`
	PreviousVersion *PupVersionSnapshot `json:"previousVersion"` // Only keep last version
}

PupUpdatePreviousVersion tracks update history for rollback

type PupUpdatesCheckedEvent added in v0.9.0

type PupUpdatesCheckedEvent struct {
	PupsChecked      int  `json:"pupsChecked"`
	UpdatesAvailable int  `json:"updatesAvailable"`
	IsPeriodicCheck  bool `json:"isPeriodicCheck"`
}

PupUpdatesCheckedEvent is emitted when a pup update check completes

type PupVersion added in v0.9.0

type PupVersion struct {
	Version          string                `json:"version"`
	ReleaseNotes     string                `json:"releaseNotes,omitempty"`
	ReleaseDate      *time.Time            `json:"releaseDate,omitempty"`
	ReleaseURL       string                `json:"releaseUrl,omitempty"`
	BreakingChanges  []string              `json:"breakingChanges,omitempty"`
	InterfaceChanges []PupInterfaceVersion `json:"interfaceChanges,omitempty"`
}

PupVersion represents a version available for update

type PupVersionSnapshot added in v0.9.0

type PupVersionSnapshot struct {
	Version        string            `json:"version"`
	Manifest       PupManifest       `json:"manifest"`
	Config         map[string]string `json:"config"`
	Providers      map[string]string `json:"providers"`
	Enabled        bool              `json:"enabled"`
	SnapshotDate   time.Time         `json:"snapshotDate"`
	SourceID       string            `json:"sourceId"`
	SourceLocation string            `json:"sourceLocation"` // For re-downloading
}

PupVersionSnapshot stores data needed for rollback Note: User data in storage directory is NOT snapshotted - only state/config

type PupWebUI

type PupWebUI struct {
	Name     string `json:"name"`
	Internal int    `json:"-"`
	Port     int    `json:"port"`
}

Represents a Web UI exposed port from the manifest

type Pupdate

type Pupdate struct {
	ID    string
	Event int // see consts above ^
	State PupState
}

Represents a change to pup state

type PurgePup

type PurgePup struct {
	PupID string
}

Purging a pup will remove the container storage.

func (PurgePup) ActionName added in v0.9.0

func (PurgePup) ActionName() string

type RemoveBinaryCache

type RemoveBinaryCache struct {
	ID string
}

func (RemoveBinaryCache) ActionName added in v0.9.0

func (RemoveBinaryCache) ActionName() string

type RemoveSSHKey

type RemoveSSHKey struct {
	ID string
}

func (RemoveSSHKey) ActionName added in v0.9.0

func (RemoveSSHKey) ActionName() string

type RollbackPupUpgrade added in v0.9.0

type RollbackPupUpgrade struct {
	PupID string
}

RollbackPupUpgrade rolls back a pup to its previous version after a failed upgrade

func (RollbackPupUpgrade) ActionName added in v0.9.0

func (RollbackPupUpgrade) ActionName() string

type SaveCustomNix added in v0.9.0

type SaveCustomNix struct {
	Content string `json:"content"`
}

func (SaveCustomNix) ActionName added in v0.9.0

func (SaveCustomNix) ActionName() string

type SelectedNetwork

type SelectedNetwork interface {
	// contains filtered or unexported methods
}

type SelectedNetworkEthernet

type SelectedNetworkEthernet struct {
	SelectedNetwork
	Interface string `json:"interface"`
}

type SelectedNetworkWifi

type SelectedNetworkWifi struct {
	SelectedNetwork
	Interface  string `json:"interface"`
	Ssid       string `json:"ssid"`
	Password   string `json:"password"`
	Encryption string `json:"encryption"`
	IsHidden   bool   `json:"isHidden"`
}

type ServerConfig

type ServerConfig struct {
	DataDir          string
	TmpDir           string
	NixDir           string
	ContainerLogDir  string
	Bind             string
	Port             int
	InternalPort     int
	Verbose          bool
	Recovery         bool
	UiDir            string
	UiPort           int
	DevMode          bool
	DisableReflector bool
	UnixSocketPath   string
}

type SourceDetails

type SourceDetails struct {
	ID          string             `json:"id"`
	Name        string             `json:"name"`
	Description string             `json:"description"`
	Pups        []SourceDetailsPup `json:"pups"`
}

type SourceDetailsPup

type SourceDetailsPup struct {
	Location string `json:"location"`
}

type SourceManager

type SourceManager interface {
	GetAll(ignoreCache bool) (map[string]ManifestSourceList, error)
	GetSourceManifest(sourceId, pupName, pupVersion string) (PupManifest, ManifestSource, error)
	GetSourcePup(sourceId, pupName, pupVersion string) (ManifestSourcePup, error)
	GetSource(name string) (ManifestSource, error)
	AddSource(location string) (ManifestSource, error)
	RemoveSource(id string) error
	DownloadPup(diskPath, sourceId, pupName, pupVersion string) (PupManifest, error)
	GetAllSourceConfigurations() []ManifestSourceConfiguration
}

type SourceState

type SourceState struct {
	SourceConfigs []ManifestSourceConfiguration
}

type State

type State struct {
	Network NetworkState
	Dogebox DogeboxState
	Sources SourceState
}

type StateManager

type StateManager interface {
	Get() State
	CloseDB() error
	OpenDB() error
	SetNetwork(s NetworkState) error
	SetDogebox(s DogeboxState) error
	SetSources(s SourceState) error
}

type StatsUpdate

type StatsUpdate struct {
	Stats []PupStats `json:"stats"`
}

StatsUpdate represents one or more PupStats updates

type StoreManager

type StoreManager struct {
	DBPath  string
	DB      *sql.DB
	WriteMu sync.Mutex
}

func NewStoreManager

func NewStoreManager(dbPath string) (*StoreManager, error)

func (*StoreManager) CloseDB

func (sm *StoreManager) CloseDB() error

func (*StoreManager) OpenDB

func (sm *StoreManager) OpenDB() error

func (*StoreManager) Run

func (sm *StoreManager) Run(started, stopped chan bool, stop chan context.Context) error

type SubLogger

type SubLogger interface {
	Log(msg string)
	Logf(msg string, a ...any)
	Err(msg string)
	Errf(msg string, a ...any)
	Progress(p int) SubLogger
	LogCmd(cmd *exec.Cmd)
}

type SystemDisk

type SystemDisk struct {
	Name        string                `json:"name"`
	Size        int64                 `json:"size"`
	SizePretty  string                `json:"sizePretty"`
	Suitability SystemDiskSuitability `json:"suitability"`
	BootMedia   bool                  `json:"bootMedia"`
	Label       string                `json:"label"`
	Path        string                `json:"path"`
	MountPoints []string              `json:"mountPoints,omitempty"`
	Children    []SystemDisk          `json:"children,omitempty"`
}

type SystemDiskSuitability

type SystemDiskSuitability struct {
	Install       SystemDiskSuitabilityEntry `json:"install"`
	Storage       SystemDiskSuitabilityEntry `json:"storage"`
	IsAlreadyUsed bool                       `json:"isAlreadyUsed"`
}

type SystemDiskSuitabilityEntry

type SystemDiskSuitabilityEntry struct {
	Usable bool `json:"usable"`
	SizeOK bool `json:"sizeOK"`
}

type SystemMonitor

type SystemMonitor interface {
	GetMonChannel() chan []string
	GetStatChannel() chan map[string]ProcStatus
	GetFastMonChannel() chan string
	GetFastStatChannel() chan map[string]ProcStatus
}

monitors systemd services and returns stats

type SystemUpdate added in v0.8.0

type SystemUpdate struct {
	Package string
	Version string
}

func (SystemUpdate) ActionName added in v0.9.0

func (SystemUpdate) ActionName() string

type SystemUpdater

type SystemUpdater interface {
	AddJob(Job)
	GetUpdateChannel() chan Job

	// These ideally should not be on here, but we currently don't
	// have a way to wait for a SystemUpdater event to finish.
	AddSSHKey(key string, l SubLogger) error
	EnableSSH(l SubLogger) error
	ListSSHKeys() ([]DogeboxStateSSHKey, error)
	AddBinaryCache(j AddBinaryCache, l SubLogger) error
	UpdateSystemConfig(dbxState DogeboxState, log SubLogger) error
	ValidateNix(content string) error

	// Snapshot management for pup rollbacks
	HasSnapshot(pupID string) bool
	GetSnapshot(pupID string) (*PupVersionSnapshot, error)
}

handle jobs on behalf of Dogeboxd and return them via it's own update channel.

type TypeStore

type TypeStore[T any] struct {
	Table string
	// contains filtered or unexported fields
}

func GetTypeStore

func GetTypeStore[T any](sm *StoreManager) *TypeStore[T]

func (*TypeStore[T]) Del

func (ts *TypeStore[T]) Del(key string) error

func (*TypeStore[T]) Exec

func (ts *TypeStore[T]) Exec(query string, args ...interface{}) ([]T, error)

This should not be used to update/insert, it doesn't lock

func (*TypeStore[T]) ExecWrite added in v0.8.0

func (ts *TypeStore[T]) ExecWrite(query string, args ...interface{}) (int64, error)

ExecWrite executes a write statement (DELETE, UPDATE) and returns the number of affected rows

func (*TypeStore[T]) Get

func (ts *TypeStore[T]) Get(key string) (T, error)

func (*TypeStore[T]) Set

func (ts *TypeStore[T]) Set(key string, value T) error

type UIServer

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

func (UIServer) Run

func (t UIServer) Run(started, stopped chan bool, stop chan context.Context) error

type UninstallPup

type UninstallPup struct {
	PupID string
}

Uninstalling a pup will remove container configuration, but keep storage.

func (UninstallPup) ActionName added in v0.9.0

func (UninstallPup) ActionName() string

type UnknownAction added in v0.9.0

type UnknownAction struct {
	Type string
}

UnknownAction is a test-only action type for testing unknown action handling

func (UnknownAction) ActionName added in v0.9.0

func (UnknownAction) ActionName() string

type Update

type Update any
Updates are responses to Actions or simply

* internal state changes that the frontend needs, * these are wrapped in a 'change' and sent via * websocket to the client. * * Updates need to be json-marshalable types

type UpdateKeymap added in v0.9.0

type UpdateKeymap struct {
	Keymap string
}

func (UpdateKeymap) ActionName added in v0.9.0

func (UpdateKeymap) ActionName() string

type UpdateMetrics

type UpdateMetrics struct {
	PupID   string
	Payload map[string]PupMetric
}

updates the custom metrics for a pup

func (UpdateMetrics) ActionName added in v0.9.0

func (UpdateMetrics) ActionName() string

type UpdatePendingSystemNetwork

type UpdatePendingSystemNetwork struct {
	Network SelectedNetwork
}

func (UpdatePendingSystemNetwork) ActionName added in v0.9.0

func (UpdatePendingSystemNetwork) ActionName() string

type UpdatePupConfig

type UpdatePupConfig struct {
	PupID   string
	Payload map[string]string
}

Updates the config values in a PUPState object

func (UpdatePupConfig) ActionName added in v0.9.0

func (UpdatePupConfig) ActionName() string

type UpdatePupHooks

type UpdatePupHooks struct {
	PupID   string
	Payload []PupHook
}

Updates hooks for this pup

func (UpdatePupHooks) ActionName added in v0.9.0

func (UpdatePupHooks) ActionName() string

type UpdatePupProviders

type UpdatePupProviders struct {
	PupID   string
	Payload map[string]string
}

Updates the providers of dependant interfaces for this pup

func (UpdatePupProviders) ActionName added in v0.9.0

func (UpdatePupProviders) ActionName() string

type UpdateTimezone added in v0.9.0

type UpdateTimezone struct {
	Timezone string
}

func (UpdateTimezone) ActionName added in v0.9.0

func (UpdateTimezone) ActionName() string

type UpgradePup added in v0.9.0

type UpgradePup struct {
	PupID         string
	TargetVersion string
	SourceId      string // Source to download new version from
}

UpgradePup upgrades a pup to a new version while preserving config and data

func (UpgradePup) ActionName added in v0.9.0

func (UpgradePup) ActionName() string

Jump to

Keyboard shortcuts

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