-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fc4232
commit bca3de6
Showing
1 changed file
with
80 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,58 @@ | ||
# Cosmovisor setup guide for bitcanna-1 | ||
|
||
# Cosmovisor setup for `bitcanna-1` | ||
`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, it stops the current binary, switch from the old binary to the new one, and finally restarts the node with the new binary. | ||
|
||
This guide will explain how to install Cosmovisor and prepare for a future chain update. A full guide about Cosmovisor can be found [here](https://github.com/cosmos/cosmos-sdk/tree/master/cosmovisor). | ||
> NOTE: This doc is updated to run with last version v1.4.5. Specific Upgrade Guide for v1.4.5 from v.1.3.1 is [here](https://github.com/BitCannaGlobal/bcna/blob/main/last_upgrade.md) | ||
This guide will explain how to install Cosmovisor and prepare for a future chain update. A full guide about Cosmovisor can be found [here](https://github.com/cosmos/cosmos-sdk/tree/main/tools/cosmovisor). | ||
|
||
## Step 1. Download Cosmovisor | ||
You can build Cosmovisor from the source or download it from our GitHub repository. Detailed instruction to understand how it works [here](https://github.com/cosmos/cosmos-sdk/tree/master/cosmovisor#cosmosvisor). | ||
|
||
### A) Download Cosmovisor | ||
## Step 1. Install/update Cosmovisor | ||
You can build Cosmovisor from the source or download it from the official GitHub repository. | ||
|
||
To download Cosmovisor without having to compile it yourself, run the following command: | ||
``` | ||
cd ~ | ||
wget https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2Fv1.1.0/cosmovisor-v1.1.0-linux-amd64.tar.gz | ||
``` | ||
Check sha256 sum | ||
``` | ||
sha256sum cosmovisor-v1.1.0-linux-amd64.tar.gz | ||
``` | ||
It must return: `9a6eb658404f28a3607a3d531821ca4a6501749aa483698847155f362e66859d` | ||
The easy way is install with Go: | ||
|
||
Unzip the file, give it the correct permissions and move it to your machine's PATH | ||
``` | ||
tar -xf cosmovisor-v1.1.0-linux-amd64.tar.gz | ||
rm cosmovisor-v1.1.0-linux-amd64.tar.gz | ||
chmod +x cosmovisor | ||
sudo mv cosmovisor /usr/local/bin | ||
``` | ||
### B) Build from source | ||
`go install cosmossdk.io/tools/cosmovisor/cmd/[email protected]` | ||
|
||
To compile Cosmovisor from the source, you need to have `go` installed on your system. A full guide to install `go` can be found [here](https://golangdocs.com/install-go-linux). | ||
|
||
Try this to install Cosmovisor from the source by pulling the cosmos-sdk repository, switch to the correct version and build it: | ||
``` | ||
git clone https://github.com/cosmos/cosmos-sdk.git | ||
cd cosmos-sdk | ||
git checkout cosmovisor/v1.1.0 | ||
make cosmovisor | ||
``` | ||
The previous action builds Cosmovisor in the `/cosmovisor` directory, now let's move it to the system's PATH: | ||
## Step 2. Setup Cosmovisor | ||
> Version v1.2 and higher includes a new command that will create the required folder structure for you, so it will avoid you some extra steps | ||
1) Download & init the folders with the old genesis version BitCanna `v1.2` binary. | ||
``` | ||
sudo mv cosmovisor/cosmovisor /usr/local/bin | ||
cd ~ | ||
rm -f bcnad #delete the binary if exist to avoid version mixings | ||
wget https://github.com/BitCannaGlobal/bcna/releases/download/v1.2/bcnad | ||
chmod +x ./bcnad | ||
#Set the necessaries VARs to start Cosmovisor (later you can add to .profile) | ||
export DAEMON_NAME=bcnad | ||
export DAEMON_RESTART_AFTER_UPGRADE=true | ||
export DAEMON_HOME=${HOME}/.bcna | ||
export DAEMON_RESTART_DELAY=30s | ||
export UNSAFE_SKIP_BACKUP=true | ||
export DAEMON_LOG_BUFFER_SIZE=512 | ||
#add this to continue to use bcnad for commands, this is optional | ||
PATH="${HOME}/.bcna/cosmovisor/current/bin:$PATH" | ||
#start the initial configuration | ||
cosmovisor init ./bcnad | ||
``` | ||
You can delete the `cosmos-sdk` folder | ||
It should show something like: | ||
``` | ||
cd .. && rm -rf cosmos-sdk/ | ||
11:46AM INF checking on the genesis/bin directory module=cosmovisor | ||
11:46AM INF creating directory (and any parents): "/Users/test/.bcna/cosmovisor/genesis/bin" module=cosmovisor | ||
11:46AM INF checking on the genesis/bin executable module=cosmovisor | ||
11:46AM INF copying executable into place: "/Users/test/.bcna/cosmovisor/genesis/bin/bcnad" module=cosmovisor | ||
11:46AM INF making sure "/Users/test/.bcna/cosmovisor/genesis/bin/bcnad" is executable module=cosmovisor | ||
11:46AM INF checking on the current symlink and creating it if needed module=cosmovisor | ||
11:46AM INF the current symlink points to: "/Users/t/.bcna/cosmovisor/genesis/bin/bcnad" module=cosmovisor | ||
``` | ||
## Step 2. Setup Cosmovisor | ||
> Version v1.2 includes a new command that will create the required folder structure for you, check [here](https://github.com/cosmos/cosmos-sdk/blob/main/cosmovisor/README.md#initialization), we will create them manually: | ||
|
||
1) Create new directories | ||
2) Create directories for next upgrades | ||
``` | ||
mkdir -p ${HOME}/.bcna/cosmovisor/genesis/bin | ||
mkdir -p ${HOME}/.bcna/cosmovisor/upgrades/ruderalis/bin | ||
mkdir -p ${HOME}/.bcna/cosmovisor/upgrades/strangebuddheads/bin/ | ||
mkdir -p ${HOME}/.bcna/cosmovisor/upgrades/trichomemonster-ica/bin/ | ||
``` | ||
2) Download & copy the old genesis version BitCanna `v1.2` binary to Cosmovisor's genesis folder. | ||
``` | ||
cd ~ | ||
rm -f bcnad #delete the binary if exist to avoid version mixings | ||
wget https://github.com/BitCannaGlobal/bcna/releases/download/v1.2/bcnad | ||
cp ./bcnad ${HOME}/.bcna/cosmovisor/genesis/bin/ | ||
``` | ||
|
||
3a) Download & copy the next version `v.1.3.1` to the upgrades folder. | ||
This guide shows how to download the binary. If you want to build the binary from the source, detailed instructions can be found in the [README](https://github.com/BitCannaGlobal/bcna/blob/main/README.md) of our GitHub. | ||
|
||
|
@@ -92,7 +83,7 @@ This guide shows how to download the binary. If you want to build the binary fro | |
|
||
``` | ||
cd ~ | ||
bcna_linux_amd64.tar.gz #delete old file if exist | ||
rm bcna_linux_amd64.tar.gz #delete old file if exist | ||
wget -nc https://github.com/BitCannaGlobal/bcna/releases/download/v1.4.5/bcna_linux_amd64.tar.gz | ||
``` | ||
Check the sha256sum. | ||
|
@@ -111,20 +102,48 @@ chmod +x bcnad | |
``` | ||
Move the newly built binary to the upgrades directory. | ||
``` | ||
mkdir -p ${HOME}/.bcna/cosmovisor/upgrades/strangebuddheads/bin/ | ||
mv ./bcnad ${HOME}/.bcna/cosmovisor/upgrades/strangebuddheads/bin/ | ||
``` | ||
|
||
3c) **Download & copy the last version `v.1.5.3` to the upgrades folder**. | ||
This guide shows how to download the binary. If you want to build the binary from the source, detailed instructions can be found in the [README](https://github.com/BitCannaGlobal/bcna/blob/main/README.md) of our GitHub. | ||
|
||
``` | ||
cd ~ | ||
rm bcna_linux_amd64.tar.gz #delete old file if exist | ||
wget -nc https://github.com/BitCannaGlobal/bcna/releases/download/v1.5.3/bcna_linux_amd64.tar.gz | ||
``` | ||
Check the sha256sum. | ||
``` | ||
sha256sum bcna_linux_amd64.tar.gz | ||
``` | ||
It must return: `--------------------tda--------------------` | ||
|
||
Extract and verify that the version is:`1.5.3` | ||
``` | ||
rm -f ./bcnad #delete old file if exist | ||
tar zxvf bcna_linux_amd64.tar.gz | ||
rm bcna_linux_amd64.tar.gz | ||
chmod +x bcnad | ||
./bcnad version | ||
``` | ||
Move the newly built binary to the upgrades directory. | ||
``` | ||
mv ./bcnad ${HOME}/.bcna/cosmovisor/upgrades/trichomemonster-ica/bin/ | ||
``` | ||
|
||
|
||
> If you build the binary from the code source move it to the same folder | ||
4) Setup the current version link for Cosmovisor. | ||
> Very important decision now. Depending on your choice you should sync the chain using a snapshot file/service or sync from the scratch (very slow process but the only to get the whole original chain by yourself) | ||
* If you want to sync from the scratch (from block 1) you should do: | ||
``` | ||
ln -s -T ${HOME}/.bcna/cosmovisor/genesis ${HOME}/.bcna/cosmovisor/current | ||
ln -sfn -T ${HOME}/.bcna/cosmovisor/genesis ${HOME}/.bcna/cosmovisor/current | ||
``` | ||
* If you are going to sync using **(advanced users)** a snapshot file, StateSync or other you should point to the last version (v1.4.5) | ||
``` | ||
ln -s -T ${HOME}/.bcna/cosmovisor/upgrades/strangebuddheads ${HOME}/.bcna/cosmovisor/current | ||
ln -sfn ${HOME}/.bcna/cosmovisor/upgrades/strangebuddheads ${HOME}/.bcna/cosmovisor/current | ||
``` | ||
5) To check if everything is OK, run: | ||
``` | ||
|
@@ -133,7 +152,7 @@ ls .bcna/cosmovisor/ -lh | |
The output should look like this: | ||
``` | ||
total 8.0K | ||
lrwxrwxrwx 1 user user 35 Jan 14 20:16 current -> /home/user/.bcna/cosmovisor/genesis | ||
lrwxrwxrwx 1 user user 35 Jan 14 20:16 current -> /home/user/.bcna/cosmovisor/upgrades/strangebuddheads | ||
drwxrwxr-x 3 user user 4.0K Jan 14 20:09 genesis | ||
drwxrwxr-x 4 user user 4.0K Jan 14 20:15 upgrades | ||
``` | ||
|
@@ -201,7 +220,7 @@ sudo systemctl enable cosmovisor.service && sudo systemctl start cosmovisor.serv | |
13) Check the logs to see if everything is OK. (ctrl + C to stop). | ||
``` | ||
sudo journalctl -uf cosmovisor | ||
sudo journalctl -u cosmovisor -f -o cat | ||
``` | ||
> You can speed up the syncing using a StateSync Server or a snapshot file. | ||
|
@@ -220,6 +239,7 @@ export DAEMON_RESTART_AFTER_UPGRADE=true | |
export DAEMON_HOME=${HOME}/.bcna | ||
export UNSAFE_SKIP_BACKUP=true #if you want to skip automatic backup | ||
export DAEMON_LOG_BUFFER_SIZE=512 | ||
export DAEMON_RESTART_DELAY=30s | ||
|
||
#add this to continue to use bcnad for commands, this is optional | ||
PATH="${HOME}/.bcna/cosmovisor/current/bin:$PATH" | ||
|
@@ -231,7 +251,7 @@ source .profile | |
``` | ||
3) Now let's try Cosmovisor. | ||
* Show Cosmovisor version: `cosmovisor run version` Will be `v.1.3.1` before the upgrade and `v1.4.5` after the upgrade | ||
* Show Cosmovisor version: `cosmovisor run version` Will be `v.1.4.5` before the upgrade and `v1.5.3` after the upgrade | ||
``` | ||
cosmovisor run version | ||
``` | ||
|
@@ -253,3 +273,8 @@ For example: | |
* Stop the service: `sudo service cosmovisor stop` | ||
* Restart the service: `sudo service cosmovisor restart` | ||
* Check the logs: `sudo journalctl -u cosmovisor -f` | ||
###### tags: `cosmovisor`, `bitcanna` |