Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support self updating the binary #53

Closed
ripienaar opened this issue Sep 21, 2018 · 2 comments
Closed

support self updating the binary #53

ripienaar opened this issue Sep 21, 2018 · 2 comments
Labels
enhancement New feature or request

Comments

@ripienaar
Copy link
Member

ripienaar commented Sep 21, 2018

We already support config updates and in place restarts by simply doing an Exec on the same binary and path, this works quite well.

We should also add to this a method that can fetch a new binary, replace the running one and then exec that to do in-place upgrades.

We'd need a few things:

  • Some manifest of versions available
    • Files per architecture and OS per version
    • Checksums
    • crypto signatures with pubkey in the (currently running) binary

The flow would be at least this - but probably need to be more robust than this even

  • Token validated only
  • Request asking to upgrade to a specific version
  • If we aren't already on that version
    • Get version info and ensure it exists
    • Download file into a temp location
    • Verify file
    • Backup current executable in same dir as ${current_fname}.${current_version}
    • Move temp download into same dir, set owner, permissions etc same as current
    • mv it over current
    • restart

File Store

The file store should be just a web server, with something like this /choriaupdate/0.7.0-auto/linux/amd64/ and in there a bit of JSON about the release and the actual release.

It should be able to live on object stores like those provided by cloud providers and so might need access token support in the request (v2)

For arm the arch above would be arm5 etc and we'd need to have special handling for that

The JSON would at least need:

{
  "binary": "acme-choria-linux-amd64-0.7.0-auto",
  "hash": ".....",
  "signature": ".....",
}

binary is the path to the file to get in the same dir as the json file compressed using compress/gzip
hash is a SHA256 of the file
signature is a signature made and verifiable using the key that should be compiled into the binary thats doing the update or perhaps we support something like a public key stored in /choriaupdate/release.pem

Library Package

The package to do the update should probably be separate with an api like this:

// for the paths above repo is "/choriaupdate" here
FetchSpec(repo string, version string) (*Spec, error)
Apply(target string, update *Spec) error

This should do all the things above except any restarts etc, restarts to happen elsewhere. UpdateSpec is the data in the JSON above

@ripienaar ripienaar added the enhancement New feature or request label Sep 21, 2018
@ripienaar ripienaar changed the title support updating the binary support self updating the binary Sep 21, 2018
@ripienaar
Copy link
Member Author

@ripienaar
Copy link
Member Author

project that implements a basic updater https://github.com/choria-io/go-updater without crypto support

ripienaar added a commit that referenced this issue Oct 1, 2018
(#53) first stab at adding a way to in-place update choria
ripienaar added a commit that referenced this issue Oct 1, 2018
(#53) increase DDL timeout for provision actions
ripienaar added a commit to ripienaar/provisioner that referenced this issue Nov 29, 2022
Signed-off-by: R.I.Pienaar <rip@devco.net>
ripienaar added a commit to ripienaar/provisioner that referenced this issue Nov 29, 2022
Signed-off-by: R.I.Pienaar <rip@devco.net>
ripienaar added a commit that referenced this issue Nov 29, 2022
(#53) Support upgrading choria servers using go-updater
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant