|
| 1 | +# How to upgrade your node |
| 2 | + |
| 3 | +There are two major kinds of upgrades: |
| 4 | +* Governance gated |
| 5 | +* Non-governance gated |
| 6 | + |
| 7 | +In both cases, you can upgrade your node by replacing the binary manually or using Cosmovisor. |
| 8 | + |
| 9 | + |
| 10 | +## Governance Gated Upgrade |
| 11 | + |
| 12 | +A governance gated upgrade occurs when an upgrade plan goes on chain through a software upgrade proposal. |
| 13 | +* Your node **will** stop at the height listed in the upgrade plan. |
| 14 | + |
| 15 | +### Manual Binary Upgrade |
| 16 | + |
| 17 | +1. Build or download the binary for the release you are upgrading to. |
| 18 | +2. Wait for the node to stop at the upgrade height. |
| 19 | +* The log will display something like this: |
| 20 | +``` |
| 21 | +ERR UPGRADE "v3" NEEDED at height: <UPGRADE_HEIGHT>: upgrade to v3 and applying upgrade "v3" at height:<UPGRADE_HEIGHT> |
| 22 | + ``` |
| 23 | + * If the node service remains active, you can stop it now. |
| 24 | + 3. Replace the binary listed in the unit file with the new release. |
| 25 | + 4. Start the node service again. |
| 26 | +
|
| 27 | + ### Cosmovisor Upgrade |
| 28 | +
|
| 29 | + 1. Build or download the binary for the release you are upgrading to. |
| 30 | + 2. Create a folder for the new binary in the relevant Cosmovisor directory. |
| 31 | + * If the upgrade name is `v3`, you would place the binary under `<node home>/cosmovisor/upgrades/v3/bin/elysd`: |
| 32 | + ``` |
| 33 | + . |
| 34 | + ├── current -> genesis or upgrades/<name> |
| 35 | + ├── genesis |
| 36 | + │ └── bin |
| 37 | + │ └── elysd # old: v2.2.0 |
| 38 | + └── upgrades |
| 39 | + └── v3 |
| 40 | + └── bin |
| 41 | + └── elysd # new: v3.0.0 |
| 42 | + ``` |
| 43 | + 3. Verify that Cosmovisor will use the binary you have prepared. |
| 44 | + * The Cosmovisor service should have the auto-download feature disabled. A sample Cosmovisor unit file will look like this: |
| 45 | + ``` |
| 46 | + [Unit] |
| 47 | + Description=Cosmovisor service |
| 48 | + After=network-online.target |
| 49 | +
|
| 50 | + [Service] |
| 51 | + User=ubuntu |
| 52 | + ExecStart=/home/ubuntu/go/bin/cosmovisor run start --home /home/ubuntu/.elys |
| 53 | + Restart=on-failure |
| 54 | + RestartSec=3 |
| 55 | + LimitNOFILE=50000 |
| 56 | + Environment="DAEMON_NAME=elysd" |
| 57 | + Environment="DAEMON_HOME=/home/ubuntu/.elys" |
| 58 | + Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=true" |
| 59 | + Environment="DAEMON_RESTART_AFTER_UPGRADE=true" |
| 60 | + Environment="UNSAFE_SKIP_BACKUP=true" |
| 61 | +
|
| 62 | + [Install] |
| 63 | + WantedBy=multi-user.target |
| 64 | + ``` |
| 65 | + * If you must change the contents of the unit file, run `systemctl daemon-reload` before restarting the service. |
| 66 | + 4. Wait for the node to reach the upgrade height. Cosmovisor will restart the node using the new binary. |
| 67 | +
|
| 68 | +
|
| 69 | + ## Non-governance Gated Upgrade |
| 70 | +
|
| 71 | + A non-governance gated upgrade occurs when nodes upgrade their binary at an agreed-upon height. |
| 72 | +
|
| 73 | + * You **must** stop your node at the relevant height and replace the binary before starting it again. |
| 74 | + * ⚠️ Monitor your logs when the halt height is about to be reached. If your node does not stop at the specified height using the instructions below, stop the service manually and replace the binary before starting the service again. |
| 75 | +
|
| 76 | + ### Manual Binary Upgrade |
| 77 | +
|
| 78 | + 1. Build or download the binary for the release you are upgrading to. |
| 79 | + 2. Stop the node service. |
| 80 | + 3. Update the app.toml file in your node's config folder to set the `halt-height` variable. |
| 81 | + * A sample app.toml line will look like this for an upgrade height of `24666000`: |
| 82 | + ``` |
| 83 | + halt-height = 24666000 |
| 84 | + ``` |
| 85 | + 4. Restart the service. |
| 86 | + 5. Wait for the halt height. |
| 87 | + * The log will display something like this when height is reached: |
| 88 | + ``` |
| 89 | + ERR CONSENSUS FAILURE!!! err="failed to apply block; error halt per configuration height 24666000 time 0" |
| 90 | + ``` |
| 91 | + 7. Stop the node service. |
| 92 | + 8. Replace the binary listed in the unit file with the new release. |
| 93 | + * For Cosmovisor, this will be `<node home>/cosmovisor/current/bin/elysd`. |
| 94 | + 9. Update app.toml to set the `halt-height` back to 0. |
| 95 | + 10. Start the node service. |
| 96 | +
|
| 97 | + ### Cosmovisor `add-upgrade` |
| 98 | +
|
| 99 | + #### ⚠️ Be aware that there are reported issues with using Cosmovisor for non-governance upgrades: the instructions below may result in unexpected behaviour, such as an immediate upgrade or failure to stop at the specified height. |
| 100 | +
|
| 101 | + 1. Build or download the binary for the release you are upgrading to. |
| 102 | + 2. Run the `add-upgrade` command. This command will look as follows using the example values listed below. |
| 103 | + * New binary: `elysd-v3.0.0-linux-amd64` |
| 104 | + * Upgrade name: `v3.0.0` |
| 105 | + * Halt height: `24666000` |
| 106 | + ``` |
| 107 | + cosmovisor add-upgrade v3.0.0 elysd-v3.0.0-linux-amd64 --upgrade-height 24666000 --force |
| 108 | + ``` |
| 109 | + 3. Wait for the node to reach the upgrade height. Cosmovisor will restart the node using the new binary. |
0 commit comments