From 6fc79b153d4f3fbc430bbf3663adbe894063c1c4 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Tue, 14 Sep 2021 14:52:29 +0200 Subject: [PATCH] feat: change default value of DAEMON_RESTART_AFTER_UPGRADE to true (#10128) ## Description Closes: #9678 --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [x] added `!` to the type prefix if API or client breaking change - [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [x] provided a link to the relevant issue or specification - [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [x] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [x] added a changelog entry to `CHANGELOG.md` - [x] included comments for [documenting Go code](https://blog.golang.org/godoc) - [x] updated the relevant documentation or specification - [x] reviewed "Files changed" and left comments if necessary - [x] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --- cosmovisor/CHANGELOG.md | 1 + cosmovisor/README.md | 2 +- cosmovisor/args.go | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cosmovisor/CHANGELOG.md b/cosmovisor/CHANGELOG.md index 2064bfd93b..6883e8f864 100644 --- a/cosmovisor/CHANGELOG.md +++ b/cosmovisor/CHANGELOG.md @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features + [\#8590](https://github.com/cosmos/cosmos-sdk/pull/8590) File watcher for cosmovisor. Instead of parsing logs from stdin and stderr, we watch the `/data/upgrade-info.json` file updates using polling mechanism. ++ [\#10128](https://github.com/cosmos/cosmos-sdk/pull/10128) Change default value of `DAEMON_RESTART_AFTER_UPGRADE` to `true`. ### Improvements diff --git a/cosmovisor/README.md b/cosmovisor/README.md index 94c3b8c03c..7f8d7d7f5b 100644 --- a/cosmovisor/README.md +++ b/cosmovisor/README.md @@ -40,7 +40,7 @@ All arguments passed to `cosmovisor` will be passed to the application binary (a * `DAEMON_HOME` is the location where the `cosmovisor/` directory is kept that contains the genesis binary, the upgrade binaries, and any additional auxiliary files associated with each binary (e.g. `$HOME/.gaiad`, `$HOME/.regend`, `$HOME/.simd`, etc.). * `DAEMON_NAME` is the name of the binary itself (e.g. `gaiad`, `regend`, `simd`, etc.). * `DAEMON_ALLOW_DOWNLOAD_BINARIES` (*optional*), if set to `true`, will enable auto-downloading of new binaries (for security reasons, this is intended for full nodes rather than validators). By default, `cosmovisor` will not auto-download new binaries. -* `DAEMON_RESTART_AFTER_UPGRADE` (*optional*), if set to `true`, will restart the subprocess with the same command-line arguments and flags (but with the new binary) after a successful upgrade. By default, `cosmovisor` stops running after an upgrade and requires the system administrator to manually restart it. Note that `cosmovisor` will not auto-restart the subprocess if there was an error. +* `DAEMON_RESTART_AFTER_UPGRADE` (*optional*, default = `true`), if `true`, will restart the subprocess with the same command-line arguments and flags (but with the new binary) after a successful upgrade. Otherwise (`false`), `cosmovisor` stops running after an upgrade and requires the system administrator to manually restart it. Note that `cosmovisor` will not auto-restart the subprocess if there was an error. * `DAEMON_POLL_INTERVAL` is the interval length in milliseconds for polling the upgrade plan file. Default: 300. * `UNSAFE_SKIP_BACKUP` (defaults to `false`), if set to `false`, will backup the data before trying the upgrade. Otherwise it will upgrade directly without doing any backup. This is useful (and recommended) in case of failures and when needed to rollback. It is advised to use backup option, i.e., `UNSAFE_SKIP_BACKUP=false` diff --git a/cosmovisor/args.go b/cosmovisor/args.go index ebcb5994d4..192b60ce53 100644 --- a/cosmovisor/args.go +++ b/cosmovisor/args.go @@ -125,7 +125,7 @@ func GetConfigFromEnv() (*Config, error) { if cfg.AllowDownloadBinaries, err = booleanOption(envDownloadBin, false); err != nil { return nil, err } - if cfg.RestartAfterUpgrade, err = booleanOption(envRestartUpgrade, false); err != nil { + if cfg.RestartAfterUpgrade, err = booleanOption(envRestartUpgrade, true); err != nil { return nil, err } if cfg.UnsafeSkipBackup, err = booleanOption(envSkipBackup, false); err != nil {