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

add cosmovisor guide for newtork upgrade #176

Merged
merged 5 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions docs/getting-started/cosmovisor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Running "Canis Major" network upgrade with cosmovisor

## Step 0 - Install cosmosviosr

One can follow this [link](https://docs.cosmos.network/master/run-node/cosmovisor.html#installation) to install.

Alternatively, run the below commands instead
```
$ git clone https://github.com/cosmos/cosmos-sdk.git
$ cd cosmos-sdk/cosmovisor
$ make cosmovisor
```

## Step 1 - Set up Environment Variables

Set your [Environment Variables](https://docs.cosmos.network/master/run-node/cosmovisor.html#command-line-arguments-and-environment-variables) for cosmovisor to run

```
export DAEMON_NAME=chain-maind
export DAEMON_HOME=/home/ubuntu/.chain-maind
export DAEMON_RESTART_AFTER_UPGRADE=true
export DAEMON_ALLOW_DOWNLOAD_BINARIES=true
export DAEMON_LOG_BUFFER_SIZE=512
```


### Step 1.1 - Create cosmovisor folder structure

One can follow this [folder structure](https://docs.cosmos.network/master/run-node/cosmovisor.html#data-folder-layout)
```
.chain-maind/
├── config
│ 
├── cosmovisor
│   ├── current -> genesis or upgrades/v2.0.0
│   ├── genesis
│   │ └── bin
│   │ └── chain-maind
│ └── upgrades
│ └── v2.0.0
│ └── bin
│ └── chain-maind
└── data
```

For `.chain-maind/cosmovisor/genesis/bin/chain-maind`, it is the binary before the upgrade proceeds. In our case of the "Canis Major" upgrade, it should be chain-maind with version `1.2.1`. Kindly have this binary ready before running cosmovisor.

## Step 2. - Run everything

- Start `cosmovisor`, e.g.:

```bash
$ ./cosmovisor start
```

Since we enable `DAEMON_ALLOW_DOWNLOAD_BINARIES=true`, cosmovisor will automatically download binary with `2.0.1` in `./cosmovisor/upgrades/v2.0.0/bin/chain-maind` and update `./cosmovisor/current` directory symlink to `upgrades/v2.0.0` instead when proposed upgrade log is found. cosmovisor will create `./cosmovisor/upgrades/v2.0.0/bin/chain-maind` for you.

:::warning Important:
If one doesn't want to enable `DAEMON_ALLOW_DOWNLOAD_BINARIES`, one should prepare `./cosmovisor/upgrades/v2.0.0/bin/chain-maind` manually before upgrade time.
[Linux](https://github.com/crypto-org-chain/chain-main/releases/download/v2.0.1/chain-main_2.0.1_Linux_x86_64.tar.gz), [Mac](https://github.com/crypto-org-chain/chain-main/releases/download/v2.0.1/chain-main_2.0.1_Darwin_x86_64.tar.gz) and [Windows](https://github.com/crypto-org-chain/chain-main/releases/download/v2.0.1/chain-main_2.0.1_Windows_x86_64.zip) are also available.
:::

:::tip Tip:
Example of running cosmovisor with systemd
```toml
# /lib/systemd/system/chain-maind.service
[Unit]
Description=Chain-maind
ConditionPathExists=/chain/bin/cosmovisor
After=network.target

[Service]
Type=simple
User=crypto
Group=crypto
LimitNOFILE=12288

Restart=always
RestartSec=10

Environment="DAEMON_NAME=chain-maind"
Environment="DAEMON_HOME=/chain/.chain-maind"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=true"
Environment="DAEMON_LOG_BUFFER_SIZE=512"

WorkingDirectory=/chain/bin
ExecStart=/chain/bin/cosmovisor start --home /chain/.chain-maind

# make sure log directory exists and owned by syslog
PermissionsStartOnly=true

StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=chain-maind

TimeoutStartSec=3min

[Install]
WantedBy=multi-user.target
```
:::

11 changes: 8 additions & 3 deletions docs/getting-started/mainnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@

This is a detailed documentation for setting up a **Validator** or a **Full Node** on Crypto.org mainnet.

## Pre-requisites
## Network upgrade for "Canis Major"

::: tip Remarks:

For network upgrade from `v1.*.*` to `v2.0.1`, please follow this [guide](./upgrade_guide.md#the-canis-major-upgrade-guide-v1-to-v2-0-1).

:::

**Remarks**:
Please follow this [guide](./upgrade_guide.md#chain-maind-binary-upgrade-guide-v1-1-0-v1-2-0-to-v1-2-1). If you are upgrade from `v1.1.0`/`v1.2.0` to `v1.2.1`

## Pre-requisites
### Supported OS

We officially support macOS, Windows and Linux only. Other platforms may work, but there is no guarantee. We will extend our support to other platforms after we have stabilized our current architecture.
Expand Down
9 changes: 6 additions & 3 deletions docs/getting-started/upgrade_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ The chain-maind `v2.0.1` - Canis Major upgrade is proposed to be scheduled on 1

**DO NOT UPGRADE to the binary `v2.0.1` before that suggested upgrade schedule and come across with the error message as described in [Step 0](#step-0-don-t-panic).**
:::

For those who want to enjoy the automatic upgrade managed by [cosmovisor](https://docs.cosmos.network/master/run-node/cosmovisor.html), please follow this [cosmovisor guide](./cosmovisor.md) for the coming "Canis Major" network upgrade. Otherwise, please continue below manual upgrade steps.

## Step 0 - Don't panic
At the point of proposed upgrade, user will see the following error message on the `chain-maind`:

`ERR BINARY UPDATED BEFORE TRIGGER! UPGRADE "v2.0.0" - in binary but not executed on chain`
`ERR UPGRADE "v2.0.0" NEEDED at time: 2021-06-01T23:59:00Z: {"binaries":{"darwin/amd64":"https://github.com/crypto-org-chain/chain-main/releases/download/v2.0.1/chain-main_2.0.1_Darwin_x86_64.tar.gz?checksum=sha256:a4d51bf98350c7ecbb5e6bab192c9cac2f4059754e5507d2a1970a8a5488c74a","darwin/arm64":"https://github.com/crypto-org-chain/chain-main/releases/download/v2.0.1/chain-main_2.0.1_Darwin_arm64.tar.gz?checksum=sha256:eb6274724eab1957a7b708a5a0887de9f213d053841fb58041f697e13728a454","linux/amd64":"https://github.com/crypto-org-chain/chain-main/releases/download/v2.0.1/chain-main_2.0.1_Linux_x86_64.tar.gz?checksum=sha256:5e9e9f703cb85c72573086e384e187e752463b2ed0ccd612094a1f29a13f0158","linux/arm64":"https://github.com/crypto-org-chain/chain-main/releases/download/v2.0.1/chain-main_2.0.1_Linux_arm64.tar.gz?checksum=sha256:345c7eacfc768df355c3b3ecadc9cc39e3c1656c9c0c4d465b938834fa66ff03","windows/amd64":"https://github.com/crypto-org-chain/chain-main/releases/download/v2.0.1/chain-main_2.0.1_Windows_x86_64.zip?checksum=sha256:07b06382397df49774788ec06a5c9d0bf7e28ddb7b1dd91abdb35174bce49a31"}}`

Don't panic - The Chain will be paused to allow the majority of validators to upgrade. Validators and full node hosts will have to upgrade your Crypto.org Chain nodes to the latest release binary.

Expand All @@ -31,7 +34,8 @@ To simplify the following step, we will be using **Linux** for illustration. Bin
```bash
$ sudo systemctl stop chain-maind
```

And replace the binary in the location where the `ExecStart` states in Systemd Unit file.

:::


Expand All @@ -41,7 +45,6 @@ To simplify the following step, we will be using **Linux** for illustration. Bin
```bash
$ brew upgrade chain-maind
```

### Step 1.1 - Verify the version

You can verify the installation by checking the version of `chain-maind`, the latest version is `2.0.1`.
Expand Down