Documentation
¶
Overview ¶
Package deploy provides release management, health checks, and backup/restore. All operations are pure Go.
Index ¶
- Constants
- func ActivateRelease(version string) error
- func Backup(inst *instance.Instance) (string, error)
- func DownloadArtifact(asset *GitHubAsset, destDir string) (string, error)
- func ExtractArtifact(artifactPath string, releasesDir string, version string) (string, error)
- func Restore(inst *instance.Instance, backupPath string) error
- func VerifyChecksum(artifactPath string) bool
- type GitHubAsset
- type HTTPClient
- type HealthCheck
- type Release
Constants ¶
const ( GitHubRepo = "E3CNC/E3CNC" GitHubAPI = "https://api.github.com/repos/" + GitHubRepo GitHubReleases = "https://github.com/" + GitHubRepo + "/releases" DefaultKeepReleases = 3 DefaultKeepBackups = 5 HealthCheckRetries = 12 HealthCheckBackoff = 10 )
Variables ¶
This section is empty.
Functions ¶
func ActivateRelease ¶
ActivateRelease atomically switches the current symlink to a new release.
func DownloadArtifact ¶
func DownloadArtifact(asset *GitHubAsset, destDir string) (string, error)
DownloadArtifact downloads a GitHub asset to a local path.
func ExtractArtifact ¶
ExtractArtifact extracts a .tar.zst stack artifact to the releases directory.
func VerifyChecksum ¶
VerifyChecksum verifies the sha256 checksum of a downloaded artifact.
Types ¶
type GitHubAsset ¶
type GitHubAsset struct {
Name string `json:"name"`
BrowserDownloadURL string `json:"browser_download_url"`
Size int `json:"size"`
}
GitHubAsset represents a release asset from the GitHub API.
func FindStackArtifact ¶
func FindStackArtifact() (*GitHubAsset, error)
FindStackArtifact fetches the latest release and finds the stack artifact.
type HTTPClient ¶
HTTPClient is the interface used by health checks for HTTP requests. The production implementation is http.Client; tests can mock this.
var DefaultHTTPClient HTTPClient = &http.Client{Timeout: 5 * time.Second}
defaultHTTPClient is the production HTTP client used by health checks. Override in tests with deploy.DefaultHTTPClient = mockClient.
type HealthCheck ¶
type HealthCheck struct {
Name string `json:"name"`
Passed bool `json:"passed"`
Detail string `json:"detail"`
IsOptional bool `json:"optional,omitempty"`
}
HealthCheck represents a single health check result.
func RunHealthChecks ¶
func RunHealthChecks(inst *instance.Instance) []HealthCheck
RunHealthChecks performs all 7 health checks against an instance.
type Release ¶
type Release struct {
Version string `json:"version"`
Path string `json:"path"`
Manifest map[string]any `json:"manifest,omitempty"`
SizeBytes int64 `json:"size_bytes"`
CreatedAt string `json:"created_at,omitempty"`
}
Release represents a single installed release directory.
func GetCurrentRelease ¶
func GetCurrentRelease() *Release
GetCurrentRelease returns the active release.
func ReleaseFromDir ¶
ReleaseFromDir creates a Release from a release directory path.