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

Extend Software Upgrade Proposal Plan #10047

Closed
4 of 5 tasks
robert-zaremba opened this issue Sep 1, 2021 · 10 comments · Fixed by #10602
Closed
4 of 5 tasks

Extend Software Upgrade Proposal Plan #10047

robert-zaremba opened this issue Sep 1, 2021 · 10 comments · Fixed by #10602
Assignees
Labels
C:Cosmovisor Issues and PR related to Cosmovisor C:x/upgrade S:needs architecture Needs a architecture proposal for how the feature will be implemented
Milestone

Comments

@robert-zaremba
Copy link
Collaborator

robert-zaremba commented Sep 1, 2021

Summary

Towards more sophisticated chain upgrades we would like to extend the Software Upgrade Proposal Plan with more details.

Dependencies:

Problem Definition

Ref:

Proposal

Instead of setting the upgrade process fully in the app, I propose to make it more flexible by extending the UpgradeInfo structure by adding PreUpgrade attribute:

type UpgradeInfo struct {
    Name string
    Info string
    PreUpgrade PreUpgradeInstructions
}

This is how the the PreUpgradeInstructions can look like:

{
  run: "script.sh" | "appd pre-upgrade  more-options",
  download: {
     "linux/amd64": "https://github.com/cosmos/cosmos-sdk/raw/master/cosmovisor/testdata/repo/chain3-zip_dir/autod.zip?checksum=sha256:8951f52a0aea8617de0ae459a20daf704c29d259c425e60d520e363df0f166b4"
  },
  description: "some more information about the upgrade process for devops"
}
  • run will tell cosmovisor (or an admin) what to run. It can be a shell command (if we support only POSIX shells), or an updated app binary, as in the original solution.
  • download record is optional has the same as the binaries we use to encode binaries to download in UpdateInfo.Info.
  • description: optional, more information for devops.

NOTE: we use a concrete type instead of string to be specific about the content.

This solution will solve other use-cases where we will need more advanced upgrade scenarios (eg moving files or downloading external libraries).

We can implement it in phases - and only start with run and description, and then add download.

I was presenting this solution during the Cosmovisor WG call last Friday and got ack as a superior then the "basic" one proposed originally.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@robert-zaremba
Copy link
Collaborator Author

CC: @tychoish , @jgimeno , @spoo-bar , @aaronc , @alexanderbez

@clevinson clevinson added the S:needs architecture review To discuss on the next architecture review call to come to alignment label Sep 3, 2021
@spoo-bar
Copy link
Contributor

spoo-bar commented Sep 7, 2021

I think Plan.Info can also be changed to use named properties to store its info instead of storing it as string.
Basically use the same Asset type as proposed in the PR for UpgradeInstructions

message Asset {
option (gogoproto.equal) = true;
// Platform identifier. It's composed from OS and CPU architecture. Example: "linux/amd64"
string platform = 1;
// URL to a script or binary to download. Should be related to the UpgradeInstructions pre_run or post_run
// commands. If multiple files are needed, then they should be packed in a gzip archive.
string url = 2;
// Checksum is a sha256 hex encoded checksum of an artifact referenced by the URL.
string checksum = 3;
}

Currently, cosmovisor just makes an effort to understand the Info value. But as the json value is string it can store whatever.

@spoo-bar
Copy link
Contributor

spoo-bar commented Sep 8, 2021

@robert-zaremba If you aren't maybe I can continue working on this issue?

@robert-zaremba
Copy link
Collaborator Author

@spoo-bar - we firstly need to finish a design of it. I started coding a PoC 1.5 month ago.

@robert-zaremba
Copy link
Collaborator Author

We need to decide:

  • What to do with Info field. I'm rather against doing a breaking change. We can keep it as a non machine interpret-able instructions.
  • What other attributes we want to add to the Plan. I proposed PreUpgrade, but following my previous point, we can create Upgrade - where we will put binaries.

Any thoughts? cc: @aaronc , @alessio , @spoo-bar , @anilcse , @dwedul-figure

@dwedul-figure
Copy link
Collaborator

I like the "fallback" approach here.

Add the new fields. Then, when handling an upgrade, if any of them have value, then the Info field is treated as just an info field, and we handle everything using the new stuff. If all of them are empty, then fallback to the old way of using the Info field the way we are now. The documentation should note this, and also state that in the future, the Info field fallback functionality might be removed.

An alternative might be to create a whole new proto and deprecate the current one. The nice thing with this is being able to use deprecation tags/indicators on the old proto. I feel it'd be significantly more work to create and wire this new proto (side-by-side with the current one) than to just add the fields to the existing proto and use the fallback approach on the Info field.

@robert-zaremba robert-zaremba added this to the v1.0 milestone Oct 15, 2021
@clevinson clevinson removed the S:needs architecture review To discuss on the next architecture review call to come to alignment label Nov 19, 2021
@robert-zaremba robert-zaremba added S:needs architecture Needs a architecture proposal for how the feature will be implemented Epic labels Nov 19, 2021
@dwedul-figure dwedul-figure linked a pull request Nov 24, 2021 that will close this issue
19 tasks
@tac0turtle
Copy link
Member

This needs to land with 0.46 if we plan on including tendermint 0.35+ with it.

@robert-zaremba
Copy link
Collaborator Author

The support for tendermint v0.35 is already there (including migration support). This feature extends what we already have in master, and it's not necessary for Tendermint v0.35 migration.

@tac0turtle
Copy link
Member

tac0turtle commented Jan 5, 2022

oh okay, it was my understanding it was not supported. If this was supported we should of tried to get this out in 0.45. Is it tested?

can you point me to a pr

@robert-zaremba
Copy link
Collaborator Author

We don't need it in 0.45. We need it for 0.46 which will be tagged from `master.
related issue: #9973

@mergify mergify bot closed this as completed in #10602 Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Cosmovisor Issues and PR related to Cosmovisor C:x/upgrade S:needs architecture Needs a architecture proposal for how the feature will be implemented
Projects
None yet
5 participants