Documentation
¶
Overview ¶
Package coolify relocates Coolify workloads with the pinned coolify-mirror fork in third_party/coolify-mirror. StackKits runs the engine as a separate process on the server it is installed on and accepts only the pinned build.
Index ¶
- Constants
- Variables
- func DrainRecordPath(workspace string) string
- type ReceiveOptions
- type Runner
- func (r *Runner) Check(ctx context.Context, plan []byte) (*workloadrelocation.Check, error)
- func (r *Runner) Drain(ctx context.Context, plan []byte, recordPath string) (json.RawMessage, error)
- func (r *Runner) Plan(ctx context.Context, sel Selection) (json.RawMessage, error)
- func (r *Runner) Receive(ctx context.Context, secrets TransferSecrets, opt ReceiveOptions, ...) error
- func (r *Runner) Send(ctx context.Context, secrets TransferSecrets, opt SendOptions, out io.Writer) error
- func (r *Runner) Undrain(ctx context.Context, recordPath string) (json.RawMessage, error)
- type Selection
- type SendOptions
- type TransferSecrets
Constants ¶
const DefaultBackupDir = "/data/coolify-mirror/backups/kombify-relocate"
DefaultBackupDir is where send writes its backups (the engine's own folder).
const DefaultEnginePath = "/usr/local/lib/stackkit/coolify-mirror"
DefaultEnginePath is where StackKits installs the engine on a node.
DefaultSharePort is the engine's direct HTTPS share port.
const EngineEnv = "STACKKIT_COOLIFY_MIRROR"
EngineEnv overrides where the engine binary is looked up.
Variables ¶
var Pinned = workloadrelocation.Engine{
Name: "coolify-mirror",
Version: "1.9.3",
UpstreamCommit: "f46fa093644268759fc0802e7d098e9e45dee984",
ForkRevision: "kombify.4",
}
Pinned engine build. Keep in step with third_party/coolify-mirror (internal/engine/manifest.go and KOMBIFY-FORK.md).
Functions ¶
func DrainRecordPath ¶
DrainRecordPath is where the source keeps its drain record between drain, send and the end of the move: the workspace's relocation state.
Types ¶
type ReceiveOptions ¶
type ReceiveOptions struct {
From string // source HOST[:PORT]
OnConflict string // copy or skip
NoStart bool
SetDomains []string
// Wait is how long to wait for the source's share to accept connections,
// so both sides of a move can start together; 0 tries once.
Wait time.Duration
}
ReceiveOptions control the destination side of a move.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner is the pinned engine on this server.
func Locate ¶
Locate finds the engine (explicit path, EngineEnv, DefaultEnginePath, then PATH) and refuses any build other than the pinned one.
func (*Runner) Check ¶
Check verifies on this (destination) server whether plan can be restored. A blocked move is a valid result (Ready false), not an error.
func (*Runner) Drain ¶
func (r *Runner) Drain(ctx context.Context, plan []byte, recordPath string) (json.RawMessage, error)
Drain stops the applications and services of plan on this (source) server; databases keep running for a consistent final backup. The record is written to recordPath even for a partial drain, so Undrain can restart what was stopped. It returns the engine's drain record unchanged.
func (*Runner) Plan ¶
Plan inventories the selection on this (source) server and returns the engine's plan document unchanged, ready to hand to Check on the destination.
func (*Runner) Receive ¶
func (r *Runner) Receive(ctx context.Context, secrets TransferSecrets, opt ReceiveOptions, out io.Writer) error
Receive downloads the shared backup from the source and restores it here.
func (*Runner) Send ¶
func (r *Runner) Send(ctx context.Context, secrets TransferSecrets, opt SendOptions, out io.Writer) error
Send backs up the selection with the derived archive key and shares the file until the destination has downloaded it once.
type Selection ¶
type Selection struct {
Full bool
All bool
Projects []string
Domains []string
UUIDs []string
NoDeps bool
Images string
}
Selection chooses what to relocate (mirrors the engine's backup flags).
type SendOptions ¶
type SendOptions struct {
Selection Selection
File string // reuse an existing backup made with the same secrets
OutputDir string // where a new backup is written
Host string // address the destination reaches this server on
Port int
OpenFirewall bool
TTL string
// Drained is the active drain record, if any: drained resources restore
// running on the destination although they are stopped here.
Drained string
}
SendOptions control the source side of a move.
type TransferSecrets ¶
type TransferSecrets struct {
// contains filtered or unexported fields
}
TransferSecrets are the per-move secrets both servers derive from the same Wallet item: the archive key encrypts the backup file, the share secret authenticates the download and pins its TLS certificate.
func DeriveTransferSecrets ¶
func DeriveTransferSecrets(value []byte) (TransferSecrets, error)
DeriveTransferSecrets derives both secrets from a Wallet item value.