Skip to content

Commit

Permalink
docs: clarify cosmovisor doc (#18359)
Browse files Browse the repository at this point in the history
(cherry picked from commit 8b666b6)

# Conflicts:
#	tools/cosmovisor/README.md
  • Loading branch information
julienrbrt authored and mergify[bot] committed Nov 6, 2023
1 parent e83a200 commit d5cdcfe
Showing 1 changed file with 37 additions and 13 deletions.
50 changes: 37 additions & 13 deletions tools/cosmovisor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,28 @@ sidebar_position: 1

# Cosmovisor

<<<<<<< HEAD
`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 automates application binary switch at chain upgrades.
It polls the `upgrade-info.json` file that is created by the x/upgrade module at upgrade height, and then 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.
>>>>>>> 8b666b6a5 (docs: clarify cosmovisor doc (#18359))
* [Design](#design)
* [Contributing](#contributing)
* [Setup](#setup)
* [Installation](#installation)
* [Command Line Arguments And Environment Variables](#command-line-arguments-and-environment-variables)
* [Folder Layout](#folder-layout)
* [Installation](#installation)
* [Command Line Arguments And Environment Variables](#command-line-arguments-and-environment-variables)
* [Folder Layout](#folder-layout)
* [Usage](#usage)
* [Initialization](#initialization)
* [Detecting Upgrades](#detecting-upgrades)
* [Auto-Download](#auto-download)
* [Initialization](#initialization)
* [Detecting Upgrades](#detecting-upgrades)
* [Adding Upgrade Binary](#adding-upgrade-binary)
* [Auto-Download](#auto-download)
* [Example: SimApp Upgrade](#example-simapp-upgrade)
* [Chain Setup](#chain-setup)
* [Prepare Cosmovisor and Start the Chain](#prepare-cosmovisor-and-start-the-chain)
* [Update App](#update-app)
* [Chain Setup](#chain-setup)
* [Prepare Cosmovisor and Start the Chain](#prepare-cosmovisor-and-start-the-chain)
* [Update App](#update-app)

## Design

Expand All @@ -32,7 +38,17 @@ Cosmovisor is designed to be used as a wrapper for a `Cosmos SDK` app:

*Note: If new versions of the application are not set up to run in-place store migrations, migrations will need to be run manually before restarting `cosmovisor` with the new binary. For this reason, we recommend applications adopt in-place store migrations.*

<<<<<<< HEAD
*Note: If validators would like to enable the auto-download option (which [we don't recommend](#auto-download)), and they are currently running an application using Cosmos SDK `v0.42`, they will need to use Cosmovisor [`v0.1`](https://github.com/cosmos/cosmos-sdk/releases/tag/cosmovisor%2Fv0.1.0). Later versions of Cosmovisor do not support Cosmos SDK `v0.44.3` or earlier if the auto-download option is enabled.*
=======
:::tip
Only the lastest version of cosmovisor is actively developed/maintained.
:::

:::warning
Versions prior to v1.0.0 have a vulnerability that could lead to a DOS. Please upgrade to the latest version.
:::
>>>>>>> 8b666b6a5 (docs: clarify cosmovisor doc (#18359))
## Contributing

Expand Down Expand Up @@ -114,10 +130,10 @@ Use of `cosmovisor` without one of the action arguments is deprecated. For backw

The `cosmovisor/` directory incudes a subdirectory for each version of the application (i.e. `genesis` or `upgrades/<name>`). Within each subdirectory is the application binary (i.e. `bin/$DAEMON_NAME`) and any additional auxiliary files associated with each binary. `current` is a symbolic link to the currently active directory (i.e. `genesis` or `upgrades/<name>`). The `name` variable in `upgrades/<name>` is the lowercased URI-encoded name of the upgrade as specified in the upgrade module plan. Note that the upgrade name path are normalized to be lowercased: for instance, `MyUpgrade` is normalized to `myupgrade`, and its path is `upgrades/myupgrade`.

Please note that `$DAEMON_HOME/cosmovisor` only stores the *application binaries*. The `cosmovisor` binary itself can be stored in any typical location (e.g. `/usr/local/bin`). The application will continue to store its data in the default data directory (e.g. `$HOME/.gaiad`) or the data directory specified with the `--home` flag. `$DAEMON_HOME` is independent of the data directory and can be set to any location. If you set `$DAEMON_HOME` to the same directory as the data directory, you will end up with a configuation like the following:
Please note that `$DAEMON_HOME/cosmovisor` only stores the *application binaries*. The `cosmovisor` binary itself can be stored in any typical location (e.g. `/usr/local/bin`). The application will continue to store its data in the default data directory (e.g. `$HOME/.simapp`) or the data directory specified with the `--home` flag. `$DAEMON_HOME` is independent of the data directory and can be set to any location. If you set `$DAEMON_HOME` to the same directory as the data directory, you will end up with a configuation like the following:

```text
.gaiad
.simapp
├── config
├── data
└── cosmovisor
Expand Down Expand Up @@ -267,8 +283,6 @@ Set up app config:

Initialize the node and overwrite any previous genesis file (never do this in a production environment):

<!-- TODO: init does not read chain-id from config -->

```shell
./build/simd init test --chain-id test --overwrite
```
Expand Down Expand Up @@ -334,7 +348,17 @@ Build the new version `simd` binary:
make build
```

<<<<<<< HEAD
Create the folder for the upgrade binary and copy the `simd` binary:
=======
Add the new `simd` binary and the upgrade name:

:::warning

The migration name must match the one defined in the migration plan.

:::
>>>>>>> 8b666b6a5 (docs: clarify cosmovisor doc (#18359))
```shell
mkdir -p $DAEMON_HOME/cosmovisor/upgrades/test1/bin
Expand Down

0 comments on commit d5cdcfe

Please sign in to comment.