Documentation
¶
Overview ¶
Package applicationrelease holds the owner-signed record of one scoped application release change: the retained copy of the application's prior data, the prior intent, and the release transition it authorizes.
A forward change stops only the selected application, copies each of its governed volumes into an operation-bound retained volume, reads the copy back as a file-tree digest and then selects the target release in the StackSpec; normal generate and Apply run the change. A rollback stops the application again, copies the retained data back, proves the live tree equals the checkpoint digest and restores the prior intent; the next Apply may then start the earlier release on exactly that data. While a record is open, Apply starts only the release it expects; without one, Apply refuses every move to an earlier release.
Index ¶
- Constants
- func CanAdvance(from, next State) bool
- func RemoveRetainedRuntimeFiles(workspace string, record Record) error
- func RestoreRuntimeFiles(workspace string, record Record) error
- func RetainRuntimeFiles(workspace string, record Record) error
- func ValidOperationID(id string) bool
- func VerifyRetainedRuntimeFiles(workspace string, record Record) error
- func VerifyRuntimeFilesAtCheckpoint(workspace string, record Record) error
- type Image
- type ManagedAuthority
- type Readback
- type Record
- type RuntimeFile
- type State
- type Volume
Constants ¶
const APIVersion = "stackkit.application-release/v1"
const Directory = ".stackkit/applications/releases"
Directory holds one owner-signed record per scoped release operation.
Variables ¶
This section is empty.
Functions ¶
func CanAdvance ¶
CanAdvance reports whether a record in state from may move to next.
func RemoveRetainedRuntimeFiles ¶
RemoveRetainedRuntimeFiles removes the operation-bound copies.
func RestoreRuntimeFiles ¶
RestoreRuntimeFiles verifies every retained copy, then writes each back over its live file and reads it back.
func RetainRuntimeFiles ¶
RetainRuntimeFiles copies every live runtime file of the record into its operation-bound private copy. A copy already read back is kept; a live file that no longer has its checkpoint digest refuses, since nothing may change it while the checkpoint is open.
func ValidOperationID ¶
ValidOperationID reports whether id is a scoped release operation identity.
func VerifyRetainedRuntimeFiles ¶
VerifyRetainedRuntimeFiles reports whether every retained copy of the record still has its checkpoint digest. It writes nothing, so a rollback checks it before any destructive volume restore.
func VerifyRuntimeFilesAtCheckpoint ¶
VerifyRuntimeFilesAtCheckpoint reports whether every live runtime file of the record still has its checkpoint digest.
Types ¶
type ManagedAuthority ¶
type ManagedAuthority struct {
CapabilityID string `json:"capabilityId"`
CapabilitySHA256 string `json:"capabilitySha256"`
IssuerID string `json:"issuerId"`
KeyID string `json:"keyId"`
}
ManagedAuthority is the Techstack authority of a release change on a managed node: the exact application-release.update capability the node verified against its Owner-approved trust before it stopped the application. A standalone record carries none.
type Record ¶
type Record struct {
APIVersion string `json:"apiVersion"`
OperationID string `json:"operationId"`
State State `json:"state"`
UseCaseRef string `json:"useCaseRef"`
WorkloadRef string `json:"workloadRef"`
ModuleRef string `json:"moduleRef"`
NodeRef string `json:"nodeRef"`
ComposeProject string `json:"composeProject"`
EntryComponent string `json:"entryComponent"`
PriorRelease string `json:"priorRelease"`
PriorImage Image `json:"priorImage"`
TargetRelease string `json:"targetRelease"`
TargetImage Image `json:"targetImage"`
// TargetUntested marks a target outside the catalog's tested releases,
// accepted explicitly by the owner.
TargetUntested bool `json:"targetUntested,omitempty"`
// Managed is set when Techstack manages the node; the intent change was
// admitted by that capability, and resume and rollback stay bound to it.
Managed *ManagedAuthority `json:"managed,omitempty"`
PriorSpecHash string `json:"priorSpecHash"`
TargetSpecHash string `json:"targetSpecHash"`
// PriorSpec and TargetSpec are the exact canonical StackSpec bytes.
PriorSpec []byte `json:"priorSpec"`
TargetSpec []byte `json:"targetSpec"`
PlanHash string `json:"planHash"`
KopiaHelperImage string `json:"kopiaHelperImage"`
Volumes []Volume `json:"volumes"`
// RuntimeFiles are the private runtime files of a native installation
// (the Marketplace) retained beside its volumes and restored with them.
RuntimeFiles []RuntimeFile `json:"runtimeFiles,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Signature localevidence.OwnerApplicationReleaseSignature `json:"signature"`
}
func Persist ¶
Persist signs and atomically replaces the record of its operation. A new record must start at StateCheckpointStarted; an existing one may move only along the declared transitions.
type RuntimeFile ¶
type RuntimeFile struct {
// Path is relative to the workspace root.
Path string `json:"path"`
// SHA256 is the lowercase hex digest of the checkpointed bytes.
SHA256 string `json:"sha256"`
}
RuntimeFile is one private runtime file of a native installation that a release checkpoint retains beside the application's volumes. For the Marketplace these are its Compose recipe, its environment (APP_KEY and database credentials), its custody (API token, server identity) and its SSH key: Coolify migrates its database forward on start, so a rollback restores the database together with the custody that matches it.
func CaptureRuntimeFiles ¶
func CaptureRuntimeFiles(workspace string, paths []string) ([]RuntimeFile, error)
CaptureRuntimeFiles reads the live private files and returns their checkpoint digests.
type State ¶
type State string
const ( // StateCheckpointStarted: the application may be stopped and its // retained copies may be incomplete; live data is unchanged. StateCheckpointStarted State = "checkpoint-started" // StateCheckpointed: retained copies are complete and read back, the // target release is selected, and the application stays stopped until // Apply starts the target release. StateCheckpointed State = "checkpointed" // StateRollbackStarted: live data may be partly restored. StateRollbackStarted State = "rollback-started" // StateRolledBack: live data equals the checkpoint, the prior intent is // selected, and the next Apply may start the prior release. StateRolledBack State = "rolled-back" // StateAbandoned: a checkpoint that never completed was released; the // prior intent and runtime stay authoritative. StateAbandoned State = "abandoned" // StateFinalized: retained copies are removed; the record is history. StateFinalized State = "finalized" )
type Volume ¶
type Volume struct {
ComponentRef string `json:"componentRef"`
LogicalName string `json:"logicalName"`
ComposeProject string `json:"composeProject"`
LiveName string `json:"liveName"`
RollbackName string `json:"rollbackName"`
Checkpoint *Readback `json:"checkpoint,omitempty"`
}
Volume is one governed live volume of the application and its retained, operation-bound copy.