software

package
v0.0.0-...-d25dbbd Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package software implements the Software Delivery domain for AppOS.

Subdomain Boundary (Story 29.2)

Software Delivery is divided into four internal subdomains:

  • catalog — what software AppOS manages (component identity, template refs)
  • inventory — what software is installed on each delivery target
  • provisioning — how software is installed, upgraded, verified, and reinstalled
  • target-readiness — whether the target environment satisfies required capabilities

Target Types

Software Delivery manages static component state for two delivery target types:

  • local — AppOS runtime install: components in the AppOS container (nginx, redis, docker, supervisor). Static state: version and availability.
  • server — managed remote servers registered in the server catalog. Full workflow: install, upgrade, verify, reinstall.

Ownership Rules

Software Delivery OWNS (for both target types):

  • managed component identity (catalog)
  • installed component inventory per target (inventory)
  • install, upgrade, verify, and reinstall workflows (provisioning)
  • OS, privilege, network, and dependency readiness checks (target-readiness)

For ALL target types (local and server), the domain split is:

Software Delivery owns (regardless of whether the component is running):
  - installed component identity, version, and availability (inventory)
  - install, upgrade, verify, and reinstall workflows (provisioning)
  - OS, privilege, network, and dependency readiness checks (target-readiness)

Monitor owns (for the same software, only its runtime observation):
  - is it currently alive (active state via supervisord / systemd)
  - runtime health trend, uptime, CPU, memory, logs
  - active checks and health summaries
  - operator-facing status timelines and degraded-state visibility

The split is: Software Delivery answers "what is installed and at what version", Monitor answers "is it running and is it healthy right now". Monitor is a CONSUMER of Software Delivery inventory events (SoftwareCapabilityReady, SoftwareCapabilityDegraded). It does not own or execute install, upgrade, or readiness workflows.

Current Code Mapping

Existing code material maps to subdomains as follows:

backend/domain/software/catalog   -> catalog
backend/domain/software/inventory -> inventory
backend/domain/software           -> provisioning, target-readiness

Audit Migration Note

Prior to Story 29.2, audit action constants used the prefix "server.serverbase.*". They are now "server.software.*". If audit records were emitted before this change, a data migration may be needed to backfill the action names. No migration is required for a fresh install.

Index

Constants

View Source
const (
	// EventSoftwareCapabilityReady is published when a capability transitions to a ready state
	// (installed_state=installed, verification_state=healthy).
	EventSoftwareCapabilityReady = "software.capability.ready"

	// EventSoftwareCapabilityDegraded is published when capability verification returns degraded.
	EventSoftwareCapabilityDegraded = "software.capability.degraded"

	// EventSoftwareActionSucceeded is published when an install, upgrade, verify, or reinstall
	// action completes with terminal_status=success.
	EventSoftwareActionSucceeded = "software.action.succeeded"

	// EventSoftwareActionFailed is published when an install, upgrade, verify, or reinstall
	// action reaches terminal_status=failed.
	EventSoftwareActionFailed = "software.action.failed"
)

Domain event name constants for the Software Delivery domain.

These event names are used when publishing domain events to the application event bus. External domains (Monitor, Deploy, Gateway) may subscribe to these events to refresh their own projections.

Naming convention: software.<subject>.<verb-past>

View Source
const (
	AuditActionInstall   = "server.software.install"
	AuditActionUpgrade   = "server.software.upgrade"
	AuditActionStart     = "server.software.start"
	AuditActionStop      = "server.software.stop"
	AuditActionRestart   = "server.software.restart"
	AuditActionVerify    = "server.software.verify"
	AuditActionReinstall = "server.software.reinstall"
	AuditActionUninstall = "server.software.uninstall"
)

Variables

View Source
var CapabilityComponentMap = map[Capability]ComponentKey{
	CapabilityContainerRuntime: ComponentKeyDocker,
	CapabilityMonitorAgent:     ComponentKeyTelegraf,
	CapabilityReverseProxy:     ComponentKeyReverseProxy,
}

CapabilityComponentMap is the canonical mapping from capability name to the component key that backs it. External domains must use capability names; they must not depend on component_key directly.

View Source
var MaterialSubdomainMap = map[string]Subdomain{

	"software.local_registry": SubdomainCatalog,

	"software.local_inventory_output": SubdomainInventory,

	"software.install_upgrade_verify": SubdomainProvisioning,
	"software.os_privilege_network":   SubdomainTargetReadiness,
}

MaterialSubdomainMap maps current code material keys to their target Software Delivery subdomain. This map encodes the boundary decision from Story 29.2 so it can be verified by tests and referenced during implementation. MaterialSubdomainMap maps current code material keys to their target Software Delivery subdomain. This map encodes the boundary decision from Story 29.2 so it can be verified by tests and referenced during implementation.

NOTE: local service definitions live under software/catalog. Active local service observation belongs to Monitor and is intentionally ABSENT from this map.

Functions

func NormalizeAppOSBaseURL

func NormalizeAppOSBaseURL(raw string) string

Types

type Action

type Action string
const (
	ActionInstall   Action = "install"
	ActionUpgrade   Action = "upgrade"
	ActionStart     Action = "start"
	ActionStop      Action = "stop"
	ActionRestart   Action = "restart"
	ActionVerify    Action = "verify"
	ActionReinstall Action = "reinstall"
	ActionUninstall Action = "uninstall"
)

type ActionTimeoutPolicySpec

type ActionTimeoutPolicySpec struct {
	Install   TimeoutPolicyResult `yaml:"install"`
	Upgrade   TimeoutPolicyResult `yaml:"upgrade"`
	Start     TimeoutPolicyResult `yaml:"start"`
	Stop      TimeoutPolicyResult `yaml:"stop"`
	Restart   TimeoutPolicyResult `yaml:"restart"`
	Verify    TimeoutPolicyResult `yaml:"verify"`
	Reinstall TimeoutPolicyResult `yaml:"reinstall"`
	Uninstall TimeoutPolicyResult `yaml:"uninstall"`
}

ActionTimeoutPolicySpec defines the terminal result to apply when an action exceeds its declared total timeout.

func (ActionTimeoutPolicySpec) ResultFor

type ActionTimeoutsSpec

type ActionTimeoutsSpec struct {
	InstallSeconds   int `yaml:"install_seconds"`
	UpgradeSeconds   int `yaml:"upgrade_seconds"`
	StartSeconds     int `yaml:"start_seconds"`
	StopSeconds      int `yaml:"stop_seconds"`
	RestartSeconds   int `yaml:"restart_seconds"`
	VerifySeconds    int `yaml:"verify_seconds"`
	ReinstallSeconds int `yaml:"reinstall_seconds"`
	UninstallSeconds int `yaml:"uninstall_seconds"`
}

ActionTimeoutsSpec defines optional total timeouts for each managed action. Values are declared in whole seconds in template YAML. A zero value means the action uses the existing executor/default timing behavior.

func (ActionTimeoutsSpec) DurationFor

func (s ActionTimeoutsSpec) DurationFor(action Action) time.Duration

type AppOSConnectionStatus

type AppOSConnectionStatus string
const (
	AppOSConnectionConnected     AppOSConnectionStatus = "connected"
	AppOSConnectionStale         AppOSConnectionStatus = "stale"
	AppOSConnectionNotConnected  AppOSConnectionStatus = "not_connected"
	AppOSConnectionAuthFailed    AppOSConnectionStatus = "auth_failed"
	AppOSConnectionMisconfigured AppOSConnectionStatus = "misconfigured"
	AppOSConnectionUnknown       AppOSConnectionStatus = "unknown"
	AppOSConnectionNotApplicable AppOSConnectionStatus = "not_applicable"
)

type ArtifactKind

type ArtifactKind string
const (
	ArtifactKindPackage ArtifactKind = "package"
	ArtifactKindScript  ArtifactKind = "script"
	ArtifactKindBinary  ArtifactKind = "binary"
	ArtifactKindDocker  ArtifactKind = "docker"
)

func EffectiveArtifactKind

func EffectiveArtifactKind(entry CatalogEntry, templateKind TemplateKind) ArtifactKind

type AsyncCommandResponse

type AsyncCommandResponse struct {
	Accepted    bool           `json:"accepted"`
	OperationID string         `json:"operation_id,omitempty"`
	Phase       OperationPhase `json:"phase,omitempty"`
	Message     string         `json:"message,omitempty"`
}

type Capability

type Capability string
const (
	CapabilityContainerRuntime Capability = "container_runtime"
	CapabilityMonitorAgent     Capability = "monitor_agent"
	CapabilityReverseProxy     Capability = "reverse_proxy"
)

type CapabilityCommander

type CapabilityCommander interface {
	// EnsureCapability installs the component backing a capability if not already installed,
	// or re-converges it if it is degraded. Idempotent for already-healthy capabilities.
	EnsureCapability(ctx context.Context, serverID string, capability Capability) (AsyncCommandResponse, error)

	// UpgradeCapability upgrades the installed component to the packaged version.
	UpgradeCapability(ctx context.Context, serverID string, capability Capability) (AsyncCommandResponse, error)

	// VerifyCapability runs a verification pass on the installed component and updates
	// the readiness projection. Safe to call on any installed component.
	VerifyCapability(ctx context.Context, serverID string, capability Capability) (AsyncCommandResponse, error)
}

CapabilityCommander is the write-side cross-domain interface for Software Delivery.

External domains must use this interface to issue async capability commands. All methods return an AsyncCommandResponse with an operation_id that callers can use to poll operation status.

type CapabilityQuerier

type CapabilityQuerier interface {
	// ListCapabilities returns readiness status for all managed capabilities on a server.
	ListCapabilities(ctx context.Context, serverID string) ([]CapabilityStatus, error)

	// GetCapabilityStatus returns readiness status for one named capability.
	GetCapabilityStatus(ctx context.Context, serverID string, capability Capability) (CapabilityStatus, error)

	// IsCapabilityReady returns true when the capability is installed, verified, and all
	// readiness dimensions (OS, privilege, network, dependency) are satisfied.
	IsCapabilityReady(ctx context.Context, serverID string, capability Capability) (bool, error)
}

CapabilityQuerier is the read-side cross-domain interface for Software Delivery.

External domains (Deploy, Monitor, Gateway) must use this interface to inspect capability status without depending on component-level implementation details.

All methods are synchronous and safe to call in request context.

type CapabilityStatus

type CapabilityStatus struct {
	Capability      Capability            `json:"capability"`
	ComponentKey    ComponentKey          `json:"component_key"`
	InstalledState  InstalledState        `json:"installed_state"`
	Ready           bool                  `json:"ready"`
	ReadinessResult TargetReadinessResult `json:"readiness"`
}

CapabilityStatus is the readiness summary exposed by the cross-domain query interface.

type CatalogEntry

type CatalogEntry struct {
	ComponentKey           ComponentKey        `yaml:"component_key"`
	TargetType             TargetType          `yaml:"target_type"`
	Label                  string              `yaml:"label"`
	Capability             Capability          `yaml:"capability"`
	ArtifactKind           ArtifactKind        `yaml:"artifact_kind"`
	TemplateRef            string              `yaml:"template_ref"`
	VersionCommand         string              `yaml:"version_command"`
	Binary                 string              `yaml:"binary"`
	ServiceName            string              `yaml:"service_name"`
	LegacyServiceNames     []string            `yaml:"legacy_service_names"`
	PackageName            string              `yaml:"package_name"`
	PackageNames           []string            `yaml:"package_names"`
	PackageRepoProfile     string              `yaml:"package_repo_profile"`
	ScriptPath             string              `yaml:"script_path"`
	ScriptURL              string              `yaml:"script_url"`
	Description            string              `yaml:"description"`
	ReadinessRequirements  []string            `yaml:"readiness_requirements"`
	RequiresAppOSBaseURL   bool                `yaml:"requires_appos_base_url"`
	FavoriteSystemdService bool                `yaml:"favorite_systemd_service"`
	Visibility             []CatalogVisibility `yaml:"visibility"`
	SupportedActions       []Action            `yaml:"supported_actions"`
}

CatalogEntry is one component record in the catalog. Placeholder fields (Binary, ServiceName, PackageName, ScriptURL) are injected into template specs by ResolveTemplate; they never originate from user input.

func ApplyRuntimeBindings

func ApplyRuntimeBindings(app core.App, entry CatalogEntry) CatalogEntry

type CatalogVisibility

type CatalogVisibility string
const (
	CatalogVisibilityServerOperations           CatalogVisibility = "server_operations"
	CatalogVisibilitySupportedSoftwareDiscovery CatalogVisibility = "supported_software_discovery"
	CatalogVisibilityLocalInventory             CatalogVisibility = "local_inventory"
)

type ComponentCatalog

type ComponentCatalog struct {
	Components []CatalogEntry `yaml:"components"`
}

ComponentCatalog holds all registered components.

type ComponentExecutor

type ComponentExecutor interface {
	// Detect runs the detection step and returns the current installed state and version.
	Detect(ctx context.Context, serverID string, tpl ResolvedTemplate) (DetectionResult, error)

	// RunPreflight executes all preflight checks and returns a TargetReadinessResult.
	// A non-ok result does not indicate an executor error; the caller decides whether to proceed.
	RunPreflight(ctx context.Context, serverID string, tpl ResolvedTemplate) (TargetReadinessResult, error)

	// Install executes the install step and returns execution detail from the primary action.
	// Post-action truth must be evaluated separately via Verify or Detect by the caller.
	Install(ctx context.Context, serverID string, tpl ResolvedTemplate) (SoftwareComponentDetail, error)

	// Upgrade executes the upgrade step and returns execution detail from the primary action.
	Upgrade(ctx context.Context, serverID string, tpl ResolvedTemplate) (SoftwareComponentDetail, error)

	// Start starts the managed runtime service and returns execution detail from the control action.
	Start(ctx context.Context, serverID string, tpl ResolvedTemplate) (SoftwareComponentDetail, error)

	// Stop stops the managed runtime service and returns execution detail from the control action.
	Stop(ctx context.Context, serverID string, tpl ResolvedTemplate) (SoftwareComponentDetail, error)

	// Restart restarts the managed runtime service and returns execution detail from the control action.
	Restart(ctx context.Context, serverID string, tpl ResolvedTemplate) (SoftwareComponentDetail, error)

	// Uninstall executes the uninstall step and returns execution detail from the primary action.
	// Idempotent: if the component is already absent, returns the current absent state unchanged.
	Uninstall(ctx context.Context, serverID string, tpl ResolvedTemplate) (SoftwareComponentDetail, error)

	// Verify executes the verify step and returns the current component state.
	Verify(ctx context.Context, serverID string, tpl ResolvedTemplate) (SoftwareComponentDetail, error)

	// Reinstall re-executes the primary reinstall step and returns execution detail.
	// If the component is already healthy, returns the current healthy state unchanged.
	Reinstall(ctx context.Context, serverID string, tpl ResolvedTemplate) (SoftwareComponentDetail, error)
}

ComponentExecutor runs the template-driven execution flows against a target host.

All methods accept a ResolvedTemplate (produced by TemplateResolver) and return a SoftwareComponentDetail reflecting the component state after execution. Implementations must be idempotent: calling Install or Reinstall on a component that is already in a healthy installed state must not fail or degrade the component.

type ComponentKey

type ComponentKey string
const (
	// Server-target components — referenced by CapabilityComponentMap and provisioning logic.
	ComponentKeyDocker       ComponentKey = "docker"
	ComponentKeyReverseProxy ComponentKey = "reverse-proxy"
	ComponentKeyTelegraf     ComponentKey = "telegraf"
)

func (ComponentKey) IsReservedRouteKey

func (k ComponentKey) IsReservedRouteKey() bool

type ComponentTemplate

type ComponentTemplate struct {
	TemplateKind        TemplateKind            `yaml:"template_kind"`
	Detect              DetectSpec              `yaml:"detect"`
	Preflight           PreflightSpec           `yaml:"preflight"`
	ActionTimeouts      ActionTimeoutsSpec      `yaml:"action_timeouts"`
	ActionTimeoutPolicy ActionTimeoutPolicySpec `yaml:"timeout_policy"`
	Install             InstallSpec             `yaml:"install"`
	Upgrade             UpgradeSpec             `yaml:"upgrade"`
	Uninstall           UninstallSpec           `yaml:"uninstall"`
	Verify              VerifySpec              `yaml:"verify"`
	// Reinstall is optional in YAML. When absent, ResolveTemplate defaults to reinstall strategy.
	Reinstall *ReinstallSpec `yaml:"reinstall"`
}

ComponentTemplate is a named, reusable delivery template. Each template defines a full set of execution steps that any compatible catalog entry can follow, substituting catalog-supplied placeholder values at resolve time.

type DetectSpec

type DetectSpec struct {
	VersionCommand string   `yaml:"version_command"`
	InstalledHint  []string `yaml:"installed_hint"`
}

DetectSpec defines how to detect whether a component is installed and its version.

type DetectionResult

type DetectionResult struct {
	InstalledState  InstalledState `json:"installed_state"`
	DetectedVersion string         `json:"detected_version,omitempty"`
	InstallSource   InstallSource  `json:"install_source,omitempty"`
	SourceEvidence  string         `json:"source_evidence,omitempty"`
}

type FailureCode

type FailureCode string
const (
	FailureCodeEnqueueError           FailureCode = "enqueue_error"
	FailureCodePreflightError         FailureCode = "preflight_error"
	FailureCodePreflightBlocked       FailureCode = "preflight_blocked"
	FailureCodeExecutionError         FailureCode = "execution_error"
	FailureCodeExecutionTimeout       FailureCode = "execution_timeout"
	FailureCodeVerificationDegraded   FailureCode = "verification_degraded"
	FailureCodeVerificationError      FailureCode = "verification_error"
	FailureCodeVerificationTimeout    FailureCode = "verification_timeout"
	FailureCodeUninstallTruthMismatch FailureCode = "uninstall_truth_mismatch"
)

type HealthResolutionEvidence

type HealthResolutionEvidence struct {
	ComponentKey                 ComponentKey
	InstalledState               InstalledState
	VerificationState            VerificationState
	Verification                 *SoftwareVerificationResult
	LastOperationTerminalStatus  TerminalStatus
	ReportingExpected            bool
	MetricsFreshnessState        string
	MetricsReasonCode            string
	HasMonitorConnectionEvidence bool
}

type InstallSource

type InstallSource string
const (
	InstallSourceManaged        InstallSource = "managed"
	InstallSourceForeignPackage InstallSource = "foreign_package"
	InstallSourceManual         InstallSource = "manual"
	InstallSourceUnknown        InstallSource = "unknown"
)

type InstallSpec

type InstallSpec struct {
	Strategy           string            `yaml:"strategy"`
	PackageName        string            `yaml:"package_name"`
	PackageNames       []string          `yaml:"package_names"`
	PackageRepoProfile string            `yaml:"package_repo_profile"`
	ScriptPath         string            `yaml:"script_path"`
	ScriptURL          string            `yaml:"script_url"`
	Env                map[string]string `yaml:"env"`
	Args               []string          `yaml:"args"`
}

InstallSpec defines the install step.

type InstalledState

type InstalledState string
const (
	InstalledStateInstalled    InstalledState = "installed"
	InstalledStateNotInstalled InstalledState = "not_installed"
	InstalledStateUnknown      InstalledState = "unknown"
)

type OperationPhase

type OperationPhase string
const (
	OperationPhaseAccepted          OperationPhase = "accepted"
	OperationPhasePreflight         OperationPhase = "preflight"
	OperationPhaseExecuting         OperationPhase = "executing"
	OperationPhaseVerifying         OperationPhase = "verifying"
	OperationPhaseSucceeded         OperationPhase = "succeeded"
	OperationPhaseFailed            OperationPhase = "failed"
	OperationPhaseAttentionRequired OperationPhase = "attention_required"
)

type PreflightSpec

type PreflightSpec struct {
	RequireRoot    bool     `yaml:"require_root"`
	RequireNetwork bool     `yaml:"require_network"`
	VerifiedOS     []string `yaml:"verified_os"`
	ServiceManager string   `yaml:"service_manager"`
	PackageManager string   `yaml:"package_manager"`
}

PreflightSpec defines readiness checks required before any action.

type ReadinessIssueCode

type ReadinessIssueCode string

ReadinessIssueCode is a machine-readable identifier for a blocking readiness condition.

const (
	// ReadinessIssueOSNotSupported is returned when the target OS is outside the template's verified OS baseline.
	ReadinessIssueOSNotSupported ReadinessIssueCode = "os_not_supported"

	// ReadinessIssuePrivilegeRequired is returned when the template requires root but the target lacks it.
	ReadinessIssuePrivilegeRequired ReadinessIssueCode = "privilege_required"

	// ReadinessIssueNetworkRequired is returned when the template requires network access but it is unavailable.
	ReadinessIssueNetworkRequired ReadinessIssueCode = "network_required"

	// ReadinessIssueDependencyMissing is returned when a prerequisite capability is not yet available.
	ReadinessIssueDependencyMissing ReadinessIssueCode = "dependency_missing"

	// ReadinessIssueServiceManagerMissing is returned when the required service manager is unavailable.
	ReadinessIssueServiceManagerMissing ReadinessIssueCode = "service_manager_missing"

	// ReadinessIssuePackageManagerMissing is returned when the required package manager is unavailable.
	ReadinessIssuePackageManagerMissing ReadinessIssueCode = "package_manager_missing"
)

type ReinstallSpec

type ReinstallSpec struct {
	Strategy string `yaml:"strategy"`
}

ReinstallSpec defines how to reinstall a component. Strategy "reinstall" means: re-execute install then verify. Strategy "restart" means: restart the service via the system supervisor.

type ResolvedTemplate

type ResolvedTemplate struct {
	ComponentKey        ComponentKey
	TemplateRef         string
	TemplateKind        TemplateKind
	Detect              DetectSpec
	Preflight           PreflightSpec
	ActionTimeouts      ActionTimeoutsSpec
	ActionTimeoutPolicy ActionTimeoutPolicySpec
	Install             InstallSpec
	Upgrade             UpgradeSpec
	Uninstall           UninstallSpec
	Verify              VerifySpec
	Reinstall           ReinstallSpec
	SupportedActions    []Action
}

ResolvedTemplate is a CatalogEntry fused with its ComponentTemplate, with all {{placeholder}} values substituted from catalog metadata.

ResolvedTemplate is the sole input type accepted by ComponentExecutor; no component-specific logic is permitted outside of this resolution step.

type ServiceStatus

type ServiceStatus string
const (
	ServiceStatusRunning        ServiceStatus = "running"
	ServiceStatusStopped        ServiceStatus = "stopped"
	ServiceStatusInstalled      ServiceStatus = "installed"
	ServiceStatusNotInstalled   ServiceStatus = "not_installed"
	ServiceStatusNeedsAttention ServiceStatus = "needs_attention"
	ServiceStatusUnknown        ServiceStatus = "unknown"
)

type SoftwareActionResponse

type SoftwareActionResponse struct {
	ComponentKey      ComponentKey      `json:"component_key"`
	Action            Action            `json:"action"`
	Result            string            `json:"result"`
	InstalledState    InstalledState    `json:"installed_state"`
	DetectedVersion   string            `json:"detected_version,omitempty"`
	PackagedVersion   string            `json:"packaged_version,omitempty"`
	VerificationState VerificationState `json:"verification_state"`
	Message           string            `json:"message,omitempty"`
	Output            string            `json:"output,omitempty"`
}

type SoftwareComponentDetail

type SoftwareComponentDetail struct {
	SoftwareComponentSummary
	ServiceName  string                      `json:"service_name,omitempty"`
	BinaryPath   string                      `json:"binary_path,omitempty"`
	ConfigPath   string                      `json:"config_path,omitempty"`
	Preflight    *TargetReadinessResult      `json:"preflight,omitempty"`
	Verification *SoftwareVerificationResult `json:"verification,omitempty"`
}

type SoftwareComponentSummary

type SoftwareComponentSummary struct {
	ComponentKey      ComponentKey                `json:"component_key"`
	Label             string                      `json:"label"`
	TemplateKind      TemplateKind                `json:"template_kind"`
	ArtifactKind      ArtifactKind                `json:"artifact_kind,omitempty"`
	InstalledState    InstalledState              `json:"installed_state"`
	DetectedVersion   string                      `json:"detected_version,omitempty"`
	InstallSource     InstallSource               `json:"install_source,omitempty"`
	SourceEvidence    string                      `json:"source_evidence,omitempty"`
	PackagedVersion   string                      `json:"packaged_version,omitempty"`
	VerificationState VerificationState           `json:"verification_state"`
	ServiceStatus     ServiceStatus               `json:"service_status"`
	AppOSConnection   AppOSConnectionStatus       `json:"appos_connection"`
	HealthReasons     []string                    `json:"health_reasons,omitempty"`
	AvailableActions  []Action                    `json:"available_actions,omitempty"`
	LastAction        *SoftwareDeliveryLastAction `json:"last_action,omitempty"`
}

type SoftwareDeliveryLastAction

type SoftwareDeliveryLastAction struct {
	Action string `json:"action"`
	Result string `json:"result"`
	At     string `json:"at"`
}

type SoftwareDeliveryOperation

type SoftwareDeliveryOperation struct {
	OperationID    string         `json:"operation_id"`
	ServerID       string         `json:"server_id"`
	Capability     Capability     `json:"capability"`
	ComponentKey   ComponentKey   `json:"component_key"`
	Action         Action         `json:"action"`
	Phase          OperationPhase `json:"phase"`
	TerminalStatus TerminalStatus `json:"terminal_status"`
	FailurePhase   OperationPhase `json:"failure_phase,omitempty"`
	FailureCode    FailureCode    `json:"failure_code,omitempty"`
	FailureReason  string         `json:"failure_reason,omitempty"`
	EventLog       string         `json:"event_log,omitempty"`
	CreatedAt      string         `json:"created_at"`
	UpdatedAt      string         `json:"updated_at"`
}

type SoftwareVerificationResult

type SoftwareVerificationResult struct {
	State     VerificationState `json:"state"`
	CheckedAt string            `json:"checked_at"`
	Reason    string            `json:"reason,omitempty"`
	Details   map[string]any    `json:"details,omitempty"`
}

type Subdomain

type Subdomain string

Subdomain identifies one of the four internal subdomains of Software Delivery.

const (
	// SubdomainCatalog owns component identity: what software AppOS manages,
	// template references, and display metadata.
	SubdomainCatalog Subdomain = "catalog"

	// SubdomainInventory owns the installed component snapshot for each delivery target.
	SubdomainInventory Subdomain = "inventory"

	// SubdomainProvisioning owns install, upgrade, verify, and reinstall workflows.
	SubdomainProvisioning Subdomain = "provisioning"

	// SubdomainTargetReadiness owns OS, privilege, network, and dependency readiness checks
	// that determine whether actions can safely run on a target.
	SubdomainTargetReadiness Subdomain = "target-readiness"
)

type TargetInfo

type TargetInfo struct {
	// OS is the canonical OS name of the target, e.g. "ubuntu", "debian", "rocky".
	OS string

	// HasRoot indicates whether the executor agent has root (or equivalent) privilege.
	HasRoot bool

	// NetworkOK indicates whether the required network path is currently reachable.
	NetworkOK bool

	// ServiceManager is the detected service supervisor/runtime, e.g. "systemd" or "supervisor".
	ServiceManager string

	// PackageManager is the detected package manager, e.g. "apt".
	PackageManager string
}

TargetInfo captures the attributes of a delivery target that are required to evaluate readiness against a PreflightSpec.

TargetInfo is produced by the infrastructure layer and must never be constructed from user-supplied HTTP inputs.

type TargetReadinessResult

type TargetReadinessResult struct {
	OK               bool     `json:"ok"`
	OSSupported      bool     `json:"os_supported"`
	PrivilegeOK      bool     `json:"privilege_ok"`
	NetworkOK        bool     `json:"network_ok"`
	DependencyReady  bool     `json:"dependency_ready"`
	ServiceManagerOK bool     `json:"service_manager_ok"`
	PackageManagerOK bool     `json:"package_manager_ok"`
	Issues           []string `json:"issues,omitempty"`
}

type TargetType

type TargetType string

TargetType identifies the delivery target class for a software component. Software Delivery manages static component state for both target types.

const (
	// TargetTypeLocal is the AppOS runtime install: components built into or
	// installed alongside the running AppOS container (nginx, redis, docker, etc.).
	// Static state only — version detection and availability. Runtime service
	// observation (supervisord, health metrics) belongs to Monitor.
	TargetTypeLocal TargetType = "local"

	// TargetTypeServer is a managed remote server registered in the server catalog.
	// Software Delivery owns install, upgrade, verify, and reinstall workflows for
	// all components on server targets.
	TargetTypeServer TargetType = "server"
)

type TemplateKind

type TemplateKind string
const (
	TemplateKindPackage TemplateKind = "package"
	TemplateKindScript  TemplateKind = "script"
	TemplateKindBinary  TemplateKind = "binary"
)

type TemplateRegistry

type TemplateRegistry struct {
	Templates map[string]ComponentTemplate `yaml:"templates"`
}

TemplateRegistry holds all named component templates keyed by template_ref string.

type TemplateResolver

type TemplateResolver interface {
	// Resolve returns the fully resolved template for a component key.
	// Returns an error if the component key is unknown or its template_ref is not registered.
	Resolve(key ComponentKey) (ResolvedTemplate, error)
}

TemplateResolver maps a ComponentKey to a fully resolved ResolvedTemplate.

Implementations look up the catalog entry for the given key, fetch its referenced template from the registry, and substitute all {{placeholder}} values from catalog metadata. No user-supplied values enter the resolution pipeline.

type TerminalStatus

type TerminalStatus string
const (
	TerminalStatusNone              TerminalStatus = "none"
	TerminalStatusSuccess           TerminalStatus = "success"
	TerminalStatusFailed            TerminalStatus = "failed"
	TerminalStatusCancelled         TerminalStatus = "cancelled"
	TerminalStatusAttentionRequired TerminalStatus = "attention_required"
)

type TimeoutPolicyResult

type TimeoutPolicyResult string
const (
	TimeoutPolicyAttentionRequired TimeoutPolicyResult = "attention_required"
	TimeoutPolicyFailed            TimeoutPolicyResult = "failed"
)

type UninstallSpec

type UninstallSpec struct {
	Strategy           string            `yaml:"strategy"`
	PackageName        string            `yaml:"package_name"`
	PackageNames       []string          `yaml:"package_names"`
	PackageRepoProfile string            `yaml:"package_repo_profile"`
	ScriptPath         string            `yaml:"script_path"`
	ScriptURL          string            `yaml:"script_url"`
	Env                map[string]string `yaml:"env"`
	Args               []string          `yaml:"args"`
}

UninstallSpec defines the uninstall step.

type UpgradeSpec

type UpgradeSpec struct {
	Strategy           string            `yaml:"strategy"`
	PackageName        string            `yaml:"package_name"`
	PackageNames       []string          `yaml:"package_names"`
	PackageRepoProfile string            `yaml:"package_repo_profile"`
	ScriptPath         string            `yaml:"script_path"`
	ScriptURL          string            `yaml:"script_url"`
	Env                map[string]string `yaml:"env"`
	Args               []string          `yaml:"args"`
}

UpgradeSpec defines the upgrade step.

type VerificationState

type VerificationState string
const (
	VerificationStateHealthy  VerificationState = "healthy"
	VerificationStateDegraded VerificationState = "degraded"
	VerificationStateUnknown  VerificationState = "unknown"
)

type VerifySpec

type VerifySpec struct {
	Strategy    string `yaml:"strategy"`
	ServiceName string `yaml:"service_name"`
}

VerifySpec defines the verify step.

Directories

Path Synopsis
Package catalog loads and resolves Software Delivery component templates and catalogs.
Package catalog loads and resolves Software Delivery component templates and catalogs.
Package executor provides SSH-based execution of Software Delivery template actions against managed remote servers.
Package executor provides SSH-based execution of Software Delivery template actions against managed remote servers.
Package readiness evaluates target readiness against a PreflightSpec.
Package readiness evaluates target readiness against a PreflightSpec.

Jump to

Keyboard shortcuts

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