diff --git a/tools/cosmovisor/CHANGELOG.md b/tools/cosmovisor/CHANGELOG.md index 1be2bba58148..5ee6ad5f26c9 100644 --- a/tools/cosmovisor/CHANGELOG.md +++ b/tools/cosmovisor/CHANGELOG.md @@ -36,28 +36,30 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +## v1.5.0 - 2023-07-17 + ## Features -* [#16413](https://github.com/cosmos/cosmos-sdk/issues/16413) Add `cosmovisor pre-upgrade` command to manually add an upgrade to cosmovisor. -* [#16573](https://github.com/cosmos/cosmos-sdk/pull/16573) Extend `cosmovisor` configuration with new log format options -* [#16550](https://github.com/cosmos/cosmos-sdk/pull/16550) Add COSMOVISOR_CUSTOM_PREUPGRADE to cosmovisor to execute custom pre-upgrade scripts (separate from daemon pre-upgrade). -* [#16963](https://github.com/cosmos/cosmos-sdk/pull/69630) Add DAEMON_SHUTDOWN_GRACE to send interrupt and wait before sending kill +* [#16413](https://github.com/cosmos/cosmos-sdk/issues/16413) Add `cosmovisor add-upgrade` command to manually add an upgrade to cosmovisor. +* [#16573](https://github.com/cosmos/cosmos-sdk/pull/16573) Extend `cosmovisor` configuration with new log format options. +* [#16550](https://github.com/cosmos/cosmos-sdk/pull/16550) Add COSMOVISOR_CUSTOM_PREUPGRADE to cosmovisor to execute custom pre-upgrade scripts (separate from daemon `pre-upgrade` command). +* [#16963](https://github.com/cosmos/cosmos-sdk/pull/69630) Add DAEMON_SHUTDOWN_GRACE to send interrupt and wait before sending kill. * [#15361](https://github.com/cosmos/cosmos-sdk/pull/15361) Add `cosmovisor config` command to display the configuration used by cosmovisor. ## Improvements -* [#16919](https://github.com/cosmos/cosmos-sdk/pull/16919) Add COSMOVISOR_DISABLE_RECASE to cosmovisor to disable automatic case change for plan name +* [#16919](https://github.com/cosmos/cosmos-sdk/pull/16919) Add COSMOVISOR_DISABLE_RECASE to cosmovisor to disable automatic case change for plan name. * [#14881](https://github.com/cosmos/cosmos-sdk/pull/14881) Refactor Cosmovisor to use `x/upgrade` validation logic. * [#14881](https://github.com/cosmos/cosmos-sdk/pull/14881) Refactor Cosmovisor to depend only on the `x/upgrade` module. -* [#15362](https://github.com/cosmos/cosmos-sdk/pull/15362) Allow disabling Cosmovisor logs +* [#15362](https://github.com/cosmos/cosmos-sdk/pull/15362) Allow disabling Cosmovisor logs. -## v1.4.0 2022-10-23 +## v1.4.0 - 2022-10-23 ### API Breaking Changes * [#13603](https://github.com/cosmos-sdk/pull/13603) Rename cosmovisor package to `cosmossdk.io/tools/cosmovisor`. -## v1.3.0 2022-09-11 +## v1.3.0 - 2022-09-11 ### Improvements @@ -68,7 +70,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#13221](https://github.com/cosmos/cosmos-sdk/pull/13221) Fix `go install`. -## v1.2.0 2022-07-26 +## v1.2.0 - 2022-07-26 ### Features @@ -85,7 +87,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [\#12188](https://github.com/cosmos/cosmos-sdk/pull/12188) Remove the possibility to set a time with only a number. `DAEMON_POLL_INTERVAL` env variable now only supports a duration (e.g. `100ms`, `30s`, `20m`). -## v1.1.0 2022-02-10 +## v1.1.0 - 2022-02-10 ### Features @@ -100,7 +102,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [\#10458](https://github.com/cosmos/cosmos-sdk/pull/10458) Fix version when using 'go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.0.0' to install cosmovisor. -## v1.0.0 2021-09-30 +## v1.0.0 - 2021-09-30 ### Features @@ -119,7 +121,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [\#10128](https://github.com/cosmos/cosmos-sdk/pull/10128) Change default value of `DAEMON_RESTART_AFTER_UPGRADE` to `true`. -## v0.1 2021-08-06 +## v0.1.0 - 2021-08-06 This is the first release and we started this changelog on 2021-07-01. See the [README](https://github.com/cosmos/cosmos-sdk/blob/release/cosmovisor/v0.1.x/cosmovisor/CHANGELOG.md) file for the full list of features. diff --git a/tools/cosmovisor/README.md b/tools/cosmovisor/README.md index b6191307335a..730e4a2dc47c 100644 --- a/tools/cosmovisor/README.md +++ b/tools/cosmovisor/README.md @@ -4,7 +4,7 @@ sidebar_position: 1 # Cosmovisor -`cosmovisor` is a small process manager for Cosmos SDK application binaries that monitors the governance module for incoming chain upgrade proposals. If it sees a proposal that gets approved, `cosmovisor` can automatically download the new binary, stop the current binary, switch from the old binary to the new one, and finally restart the node with the new binary. +`cosmovisor` is a process manager for Cosmos SDK application binaries that monitors the governance module for incoming chain upgrade proposals. If it sees a proposal that gets approved, `cosmovisor` can automatically download the new binary, stop the current binary, switch from the old binary to the new one, and finally restart the node with the new binary. * [Design](#design) * [Contributing](#contributing) @@ -74,7 +74,7 @@ The first argument passed to `cosmovisor` is the action for `cosmovisor` to take * `run` - Run the configured binary using the rest of the provided arguments. * `version` - Output the `cosmovisor` version and also run the binary with the `version` argument. * `config` - Display the current `cosmovisor` configuration, that means displaying the environment variables value that `cosmovisor` is using. -* `add-upgrade` - Add an upgrade manually to `cosmovisor`. +* `add-upgrade` - Add an upgrade manually to `cosmovisor`. This command allow you to easily add the binary corresponding to an upgrade in cosmovisor. All arguments passed to `cosmovisor run` will be passed to the application binary (as a subprocess). `cosmovisor` will return `/dev/stdout` and `/dev/stderr` of the subprocess as its own. For this reason, `cosmovisor run` cannot accept any command-line arguments other than those available to the application binary. @@ -178,6 +178,18 @@ When the upgrade mechanism is triggered, `cosmovisor` will: 1. if `DAEMON_ALLOW_DOWNLOAD_BINARIES` is enabled, start by auto-downloading a new binary into `cosmovisor//bin` (where `` is the `upgrade-info.json:name` attribute); 2. update the `current` symbolic link to point to the new directory and save `data/upgrade-info.json` to `cosmovisor/current/upgrade-info.json`. +### Adding Upgrade Binary + +`cosmovisor` has an `add-upgrade` command that allows to easily link a binary to an upgrade. It creates a new folder in `cosmovisor/upgrades/` and copies the provided executable file to `cosmovisor/upgrades//bin/`. + +Using the `--upgrade-height` flag allows to specify at which height the binary should be switched, without going via a gorvernance proposal. +This enables support for an emergency coordinated upgrades where the binary must be switched at a specific height, but there is no time to go through a governance proposal. + +:::warning +`--upgrade-height` creates an `upgrade-info.json` file. This means if a chain upgrade via governance proposal is executed before the specified height with `--upgrade-height`, the governance proposal will overwrite the `upgrade-info.json` plan created by `add-upgrade --upgrade-height `. +Take this into consideration when using `--upgrade-height`. +::: + ### Auto-Download Generally, `cosmovisor` requires that the system administrator place all relevant binaries on disk before the upgrade happens. However, for people who don't need such control and want an automated setup (maybe they are syncing a non-validating fullnode and want to do little maintenance), there is another option. @@ -316,11 +328,10 @@ Set the optional environment variable to trigger an automatic app restart: export DAEMON_RESTART_AFTER_UPGRADE=true ``` -Create the folder for the genesis binary and copy the `simd` binary: +Initialize cosmovisor with the current binary: ```shell -mkdir -p $DAEMON_HOME/cosmovisor/genesis/bin -cp ./build/simd $DAEMON_HOME/cosmovisor/genesis/bin +cosmovisor init ./build/simd ``` Now you can run cosmovisor with simapp v0.44: @@ -341,11 +352,10 @@ Build the new version `simd` binary: make build ``` -Create the folder for the upgrade binary and copy the `simd` binary: +Add the new `simd` binary and the upgrade name: ```shell -mkdir -p $DAEMON_HOME/cosmovisor/upgrades/test1/bin -cp ./build/simd $DAEMON_HOME/cosmovisor/upgrades/test1/bin +cosmovisor add-upgrade test1 ./build/simd ``` Open a new terminal window and submit an upgrade proposal along with a deposit and a vote (these commands must be run within 20 seconds of each other): @@ -361,7 +371,7 @@ Open a new terminal window and submit an upgrade proposal along with a deposit a **v0.46, v0.47**: ```shell -./build/simd tx gov submit-legacy-proposal software-upgrade test1 --title upgrade --description upgrade --upgrade-height 200 --from validator --yes +./build/simd tx gov submit-legacy-proposal software-upgrade test1 --title upgrade --description upgrade --upgrade-height 200 --no-validate --from validator --yes ./build/simd tx gov deposit 1 10000000stake --from validator --yes ./build/simd tx gov vote 1 yes --from validator --yes ``` diff --git a/tools/cosmovisor/RELEASE_NOTES.md b/tools/cosmovisor/RELEASE_NOTES.md index edd56731a36f..6896b7a566de 100644 --- a/tools/cosmovisor/RELEASE_NOTES.md +++ b/tools/cosmovisor/RELEASE_NOTES.md @@ -1,7 +1,3 @@ -# Cosmovisor v1.4.0 Release Notes +# Cosmovisor v1.5.0 Release Notes -* Rename cosmovisor package to `cosmossdk.io/tools/cosmovisor`. - -## Changelog - -For more details, please see the [CHANGELOG](https://github.com/cosmos/cosmos-sdk/blob/tools/cosmovisor/v1.4.0/tools/cosmovisor/CHANGELOG.md). +See the [CHANGELOG](https://github.com/cosmos/cosmos-sdk/blob/tools/cosmovisor/v1.5.0/tools/cosmovisor/CHANGELOG.md) for details on the changes in v1.5.0. diff --git a/tools/cosmovisor/cmd/cosmovisor/add_upgrade.go b/tools/cosmovisor/cmd/cosmovisor/add_upgrade.go index 98ca072e9859..24de3cd4899a 100644 --- a/tools/cosmovisor/cmd/cosmovisor/add_upgrade.go +++ b/tools/cosmovisor/cmd/cosmovisor/add_upgrade.go @@ -17,7 +17,7 @@ import ( func NewAddUpgradeCmd() *cobra.Command { addUpgrade := &cobra.Command{ Use: "add-upgrade [upgrade-name] [path to executable]", - Short: "Manually add upgrade binary to Cosmovisor", + Short: "Add APP upgrade binary to cosmovisor", SilenceUsage: true, Args: cobra.ExactArgs(2), RunE: AddUpgrade, diff --git a/tools/cosmovisor/cmd/cosmovisor/run.go b/tools/cosmovisor/cmd/cosmovisor/run.go index 9192ecea1e7b..24aa9b6f8991 100644 --- a/tools/cosmovisor/cmd/cosmovisor/run.go +++ b/tools/cosmovisor/cmd/cosmovisor/run.go @@ -1,8 +1,6 @@ package main import ( - "os" - "github.com/spf13/cobra" "cosmossdk.io/tools/cosmovisor" @@ -25,13 +23,12 @@ func run(args []string, options ...RunOption) error { return err } - logger := cfg.Logger(os.Stdout) - runCfg := DefaultRunConfig for _, opt := range options { opt(&runCfg) } + logger := cfg.Logger(runCfg.StdOut) launcher, err := cosmovisor.NewLauncher(logger, cfg) if err != nil { return err