feat(releaseupdate): transactional self-update through archied (#1633)
archied update install verifies the release zip, checks every binary reports the release, pulls the agent image by digest, backs up the database in-process and stages the binaries before handing off to archied update watchdog in its own process. The watchdog restarts units in release order, requires archied healthy for 120s and otherwise rolls back binaries and image policy, restoring the database only when a migration ran. Boot recovery resumes the frozen watchdog. Deletes scripts/archie-update-install, scripts/archie-update-watchdog, the updater's --from-source and --auto, CommandInstaller, ScriptInstaller and the update-image and update-topology subcommands.
This commit is contained in:
1 parent
23f87c4cea
commit
417d379ede
33 files changed
+1754
-1114
No files matched your search
@@ -64,7 +64,7 @@ func (c *GitHubCatalog) Check(ctx context.Context) (Snapshot, error) {
|
||||
}
|
||||
return Snapshot{Components: []Component{
|
||||
component("daemon", "Gateway", installedVersion(buildinfo.Version)),
|
||||
component("agent", "Runtime", installedAgent()),
|
||||
component("agent", "Runtime", installedAgent(executableDir())),
|
||||
}}, nil
|
||||
}
|
||||
|
||||
@@ -197,13 +197,9 @@ func installedVersion(version string) string {
|
||||
// installedAgent is the image the installer last switched to, recorded in a
|
||||
// sidecar beside the binaries; without one it is the runtime this release was
|
||||
// cut with. A malformed sidecar is unknown, not guessed.
|
||||
func installedAgent() string {
|
||||
exe, err := os.Executable()
|
||||
if err != nil {
|
||||
return installedVersion(buildinfo.Runtime)
|
||||
}
|
||||
data, err := os.ReadFile(filepath.Join(filepath.Dir(exe), "archie-agent.version"))
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
func installedAgent(binDir string) string {
|
||||
data, err := os.ReadFile(filepath.Join(binDir, agentVersionFile))
|
||||
if binDir == "" || errors.Is(err, os.ErrNotExist) {
|
||||
return installedVersion(buildinfo.Runtime)
|
||||
}
|
||||
version := strings.TrimSpace(string(data))
|
||||
@@ -212,3 +208,11 @@ func installedAgent() string {
|
||||
}
|
||||
return installedVersion(version)
|
||||
}
|
||||
|
||||
func executableDir() string {
|
||||
exe, err := os.Executable()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return filepath.Dir(exe)
|
||||
}
|
||||
Reference in new issue
Block a user