From 7dd4056d6a0bed492549ce60418a22167c38ef84 Mon Sep 17 00:00:00 2001 From: Billy Yang <97488959+billyyang423@users.noreply.github.com> Date: Mon, 16 Oct 2023 14:53:04 -0600 Subject: [PATCH] remove zetavisor and replace with cosmovisor (#175) Co-authored-by: Billy Yang --- docs/validators/cosmovisor.mdx | 154 +++++++++++++++++++++ docs/validators/zetavisor.mdx | 238 --------------------------------- 2 files changed, 154 insertions(+), 238 deletions(-) create mode 100644 docs/validators/cosmovisor.mdx delete mode 100644 docs/validators/zetavisor.mdx diff --git a/docs/validators/cosmovisor.mdx b/docs/validators/cosmovisor.mdx new file mode 100644 index 00000000..c0145bc0 --- /dev/null +++ b/docs/validators/cosmovisor.mdx @@ -0,0 +1,154 @@ +--- +sidebar_position: 5 +sidebar_label: Setting up Cosmovisor +hide_title: false +id: setting-up-Cosmovisor +title: Setting up Cosmovisor +--- + +# Setting up Cosmovisor + +## Installing Cosmovisor + +``` +go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.5.0 +mv $GOPATH/bin/cosmovisor /usr/local/bin/cosmovisor +``` + +### Download Cosmovisor Binary + +Download the Binary for your system architecture from the following links and +place it in your $PATH +amd64: https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2Fv1.5.0/cosmovisor-v1.5.0-linux-amd64.tar.gz +arm64: https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2Fv1.5.0/cosmovisor-v1.5.0-linux-arm64.tar.gz + +This example assumes you are using amd64 architecture. If you are using arm64 +replace amd64 with arm64 in the commands below. + +```bash +wget https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2Fv1.5.0/cosmovisor-v1.5.0-linux-amd64.tar.gz +mv cosmovisor-amd64 /usr/local/bin/cosmovisor +``` + +## Setting up Cosmovisor + +### Create `cosmovisor` Directories + +```bash +mkdir -p ~/.zetacored/config +mkdir -p ~/.zetacored/cosmovisor/genesis/bin +mkdir -p ~/.zetacored/cosmovisor/upgrades + +``` + +### Setup `cosmovisor` systemd service + +In this example we'll run Cosmovisor as a systemd service. You can also run it as +a docker container or as a standalone process. The environment variables are +explained in the [Environment Variables](#environment-variables) section at the +end of this document. + +Create a file at `/etc/systemd/system/cosmovisor.service` with the following +contents. Make sure to change the `User` and `/home/zetachain/` fields to the +user you want to run the service as. + +```bash +[Unit] +Description=cosmovisor ZetaChain Service +After=multi-user.target +StartLimitIntervalSec=0 +[Install] +WantedBy=multi-user.target +[Service] +WorkingDirectory=/home/zetachain/.zetacored/cosmovisor +Environment="DAEMON_HOME=/home/zetachain/.zetacored" +Environment="DAEMON_NAME=zetacored" +Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false" +Environment="DAEMON_RESTART_AFTER_UPGRADE=true" +Environment="DAEMON_DATA_BACKUP_DIR=/home/zetachain/.zetacored" +Environment="CLIENT_DAEMON_NAME=zetaclientd" +Environment="CLIENT_SKIP_UPGRADE=false" +Environment="CLIENT_START_PROCESS=false" +Environment="UNSAFE_SKIP_BACKUP=true" +Type=simple +Restart=always +RestartSec=600 +User=zetachain +LimitNOFILE=262144 +ExecStart=cosmovisor start --home /home/zetachain/.zetacored/ --log_format json --moniker +``` + +## Install the `zetacored` Binary + +### Download `zetacored` Binary + +Download the latest `zetacored` binary for your system architecture from the following +links and place it in the `cosmovisor/genesis/bin/` directory. This example +assumes you are using ubuntu 22 on amd64 architecture. You may need to make +adjustments for your system. + +```bash +wget https://github.com/zeta-chain/node/releases/latest/download/zetacored-ubuntu-22-amd64 +mv zetacored-ubuntu-22-amd64 ~/.zetacored/cosmovisor/genesis/bin/zetacored +chmod +x ~/.zetacored/cosmovisor/genesis/bin/zetacored + +``` + +### Install ZetaChain Configuration Files + +ZetaChain configuration files for the Athens3 Testnet can be downloaded from the [Athens3 Github +Repo](https://github.com/zeta-chain/network-athens3/tree/main/network_files/config) + +Install them as follows: + +```bash +git clone https://github.com/zeta-chain/network-athens3 +cp network-athens3/network_files/config/* ~/.zetacored/config/ +``` + +## Starting Cosmovisor + +### State Sync + +You may choose to sync the state of your node from a snapshot. This will speed +up the time it takes to sync your node. Instructions for syncing from a snapshot +can be found +[here](https://docs.zetachain.io/docs/running-a-full-node#state-sync). + +### Start the `cosmovisor` Service + +```bash +sudo systemctl daemon-reload +sudo systemctl enable cosmovisor +sudo systemctl start cosmovisor +``` + +### Check the `cosmovisor` Service Status + +```bash +sudo systemctl status cosmovisor +``` + +### Check the `cosmovisor` Logs + +```bash +journalctl -u cosmovisor -f +``` + +## Monitoring + +In a production environment we recommend monitoring the node resources (CPU +load, Memory Usage, Disk usage and Disk IO) for any performance degradation. + +ZetaChain Core generates a log that can be monitored for errors and used for +troubleshooting. If you install Zetacore as a Systemd service using the +instructions above you can view this log with `journalctl -o cat -f -u zetacored`. + +Prometheus can be enabled to serve metrics which can be consumed by Prometheus +collector(s). Telemetry include Prometheus metrics can be enabled in the +app.toml file. See the [CosmosSDK Telemetry +Documentation](https://docs.cosmos.network/v0.46/core/telemetry.html) for more +information. + +## More Information About Cosmovisor +For more detailed information about Cosmosvisor you can visit the [Cosmos Documentation Here](https://docs.cosmos.network/main/build/tooling/cosmovisor) \ No newline at end of file diff --git a/docs/validators/zetavisor.mdx b/docs/validators/zetavisor.mdx deleted file mode 100644 index c365537f..00000000 --- a/docs/validators/zetavisor.mdx +++ /dev/null @@ -1,238 +0,0 @@ ---- -sidebar_position: 5 -sidebar_label: Setting up Zetavisor -hide_title: false -id: setting-up-zetavisor -title: Setting up Zetavisor ---- - -# Setting up ZetaVisor - -ZetaVisor is an optional process supervisor for ZetaChain. It is a wrapper -around the `zetacored` binary that allows for automatic restarts automatic -upgrades of the ZetaChain binary. It is a fork of the -[CosmosVisor](https://docs.cosmos.network/main/tooling/cosmovisor) tool. - -You can use a prebuilt `zetavisor` binary or build it yourself from source. - -## Installing ZetaVisor - -### Building From Source - -You need to have Go 1.19 and other dependencies first but those are outside the -scope of this document. If you are uncomfortable building the binary from source -code we recommend using a prebuilt binary as shown in the next step. - -You can build from source by cloning the repository and running the following -commands. - -```bash -git clone https://github.com/zeta-chain/cosmos-sdk -cd cosmos-sdk/ -git checkout zetavisor-v0.1.5 -cd cosmovisor -make zetavisor -mv $GOPATH/bin/zetavisor /usr/local/bin/zetavisor -``` - -### Download Zetavisor Binary - -Download the Binary for your system architecture from the following links and -place it in your $PATH -amd64: https://zetachain-external-files.s3.amazonaws.com/binaries/zetavisor/latest/zetavisor-amd64 -arm64: https://zetachain-external-files.s3.amazonaws.com/binaries/zetavisor/latest/zetavisor-arm64 - -This example assumes you are using amd64 architecture. If you are using arm64 -replace amd64 with arm64 in the commands below. - -```bash -wget https://zetachain-external-files.s3.amazonaws.com/binaries/zetavisor/latest/zetavisor-amd64 -mv zetavisor-amd64 /usr/local/bin/zetavisor -``` - -## Setting up ZetaVisor - -### Create `zetavisor` Directories - -```bash -mkdir -p ~/.zetacored/config -mkdir -p ~/.zetacored/zetavisor/genesis/bin -mkdir -p ~/.zetacored/zetavisor/upgrades - -``` - -### Setup `zetavisor` systemd service - -In this example we'll run zetavisor as a systemd service. You can also run it as -a docker container or as a standalone process. The environment variables are -explained in the [Environment Variables](#environment-variables) section at the -end of this document. - -Create a file at `/etc/systemd/system/zetavisor.service` with the following -contents. Make sure to change the `User` and `/home/zetachain/` fields to the -user you want to run the service as. - -```bash -[Unit] -Description=Zetavisor ZetaChain Service -After=multi-user.target -StartLimitIntervalSec=0 -[Install] -WantedBy=multi-user.target -[Service] -WorkingDirectory=/home/zetachain/.zetacored/zetavisor -Environment="DAEMON_HOME=/home/zetachain/.zetacored" -Environment="DAEMON_NAME=zetacored" -Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=true" -Environment="DAEMON_RESTART_AFTER_UPGRADE=true" -Environment="DAEMON_DATA_BACKUP_DIR=/home/zetachain/.zetacored" -Environment="CLIENT_DAEMON_NAME=zetaclientd" -Environment="CLIENT_SKIP_UPGRADE=false" -Environment="CLIENT_START_PROCESS=false" -Environment="UNSAFE_SKIP_BACKUP=true" -Type=simple -Restart=always -RestartSec=600 -User=zetachain -LimitNOFILE=262144 -ExecStart=zetavisor start --home /home/zetachain/.zetacored/ --log_format json --moniker -``` - -## Install the `zetacored` Binary - -### Download `zetacored` Binary - -Download the latest `zetacored` binary for your system architecture from the following -links and place it in the `zetavisor/genesis/bin/` directory. This example -assumes you are using ubuntu 22 on amd64 architecture. You may need to make -adjustments for your system. - -```bash -wget https://zetachain-external-files.s3.amazonaws.com/binaries/athens3/latest/zetacored-ubuntu-22-amd64 -mv zetacored-ubuntu-22-amd64 ~/.zetacored/zetavisor/genesis/bin/zetacored -chmod +x ~/.zetacored/zetavisor/genesis/bin/zetacored - -``` - -### Install ZetaChain Configuration Files - -ZetaChain configuration files for the Athens3 Testnet can be downloaded from the [Athens3 Github -Repo](https://github.com/zeta-chain/network-athens3/tree/main/network_files/config) - -Install them as follows: - -```bash -git clone https://github.com/zeta-chain/network-athens3 -cp network-athens3/network_files/config/* ~/.zetacored/config/ -``` - -## Starting ZetaVisor - -### State Sync - -You may choose to sync the state of your node from a snapshot. This will speed -up the time it takes to sync your node. Instructions for syncing from a snapshot -can be found -[here](https://docs.zetachain.io/docs/running-a-full-node#state-sync). - -### Start the `zetavisor` Service - -```bash -sudo systemctl daemon-reload -sudo systemctl enable zetavisor -sudo systemctl start zetavisor -``` - -### Check the `zetavisor` Service Status - -```bash -sudo systemctl status zetavisor -``` - -### Check the `zetavisor` Logs - -```bash -journalctl -u zetavisor -f -``` - -## Monitoring - -In a production environment we recommend monitoring the node resources (CPU -load, Memory Usage, Disk usage and Disk IO) for any performance degradation. - -ZetaChain Core generates a log that can be monitored for errors and used for -troubleshooting. If you install Zetacore as a Systemd service using the -instructions above you can view this log with `journalctl -o cat -f -u zetacored`. - -Prometheus can be enabled to serve metrics which can be consumed by Prometheus -collector(s). Telemetry include Prometheus metrics can be enabled in the -app.toml file. See the [CosmosSDK Telemetry -Documentation](https://docs.cosmos.network/v0.46/core/telemetry.html) for more -information. - -## ZetaVisor Environment Variables - -Breif explanation of the environment variables used by zetavisor. - -- `DAEMON_HOME` - - - The location where the zetavisor/ directory is kept that contains the - genesis binary, the upgrade binaries, and any additional auxiliary files - associated with each binary (e.g. $HOME/.zetacored, etc.). - -- `DAEMON_NAME` - - - The name of the binary itself (e.g. gaiad, regend, simd, etc.). - -- `DAEMON_ALLOW_DOWNLOAD_BINARIES` (optional) - - - If set to true, enables auto-downloading of new binaries (for security - reasons, this is intended for full nodes rather than validators). By - default, zetavisor will not auto-download new binaries. - -- `DAEMON_RESTART_AFTER_UPGRADE` (optional, default = true) - - - If true, restarts the subprocess with the same command-line arguments and - flags (but with the new binary) after a successful upgrade. Otherwise - (false), zetavisor stops running after an upgrade and requires the system - administrator to manually restart it. Note that restart is only after the - upgrade and does not auto-restart the subprocess after an error occurs. - -- `DAEMON_DATA_BACKUP_DIR` - - - Option to set a custom backup directory. If not set, DAEMON_HOME is used. - -- `UNSAFE_SKIP_BACKUP` (defaults to false) - - If set to true, upgrades directly without performing a backup. Otherwise - (false, default), backs up the data before trying the upgrade. The default - value of false is useful and recommended in case of failures and when a - backup is needed to rollback. We recommend using the default backup option - UNSAFE_SKIP_BACKUP=false. -- `CLIENT_DAEMON_NAME` - - Top level config for name of core binary -- `AllowDownloadBinaries` - - True : Top level config to allow download during an upgrade - - False : Top Level config to stop the above -- `CLIENT_SKIP_UPGRADE` - - True : - - Skips upgrade for the client (Does not replace binary) - - Note Upgrade includes download also - - Does not kill the client process at upgrade height - - Does not start the client after upgrade - - Use this to completely ignore zetaclient . - - False: Replaces the client binary at the correct height -- `CLIENT_START_PROCESS` - - True : Starts zetaclientd - - False : Does not start zetaclientd - - Note - - Both `RestartAfterUpgrade` and `StartClientProcess` need to be `true` - for this to work - - `SkipClientUpgrade` needs to be `false` and `StartClientProcess` needs - to be `true` for this to work - - Use this to tune upgrade process - - Example : `SkipClientUpgrade` : false && `StartClientProcess` false - - Will do the upgrade , replace binaries etc but starting the client - needs to be handled separately - - Note the client will still be killed at the upgrade height , and - new binaries will be copied to the correct location (Dowloaded if - allowed)