LogoLogo
  • Introduction
    • Kujira Empowers Everyone
      • Ecosystem
      • Where Everyone Can Be a Whale
      • Grown-Up DeFi (GUD)
    • Why Kujira
      • User and Developer Experience
      • Values
        • Principles
        • Sustainability
    • Meet Team Kujira
  • Kujira Ecosystem
    • Our Products
    • Wider Ecosystem
    • Kujira Roadmap
    • How to Participate
    • Moving Funds to Kujira
    • Shipping Lane
    • Security
    • Media Coverage
    • Links
  • dApps & Infrastructure
    • Basics
    • Welcome to Kujira (Landing Page)
    • BLUE (Central Hub)
      • Dashboard
      • Wallet
      • Swap
      • IBC / Bridge
      • Mint
      • Stake
      • Govern
      • Developer
      • Product Guides
        • How to Send Tokens
        • How to Convert balances to KUJI
        • How to Swap tokens
        • How to Bridge tokens
        • How to use IBC
        • How to Mint USK
        • How to Stake KUJI
        • How to Redelegate KUJI
        • How to Unstake KUJI
        • How to Check the Status of Governance Proposals and/or Vote
        • How to Nominate a Candidate for the Senate
        • How to View Information on Senate Candidates
    • BOW (Liquidity Engine)
      • Dashboard
      • Pools
        • Featured Pools
        • All Liquidity Pools
          • Pool Overview
          • Provide to a Pool
          • Leveraged Liquidity
          • Stake LP with a Pool
      • Swap
      • Stake USK
        • Overview
        • Stake / Unstake
        • Rewards
      • Product Guides
        • How to View LP positions
        • How to Add Liquidity
        • How to Remove Liquidity
        • How to Provide Incentives
        • How to Check the Reward Schedule of a Pool
    • FIN (DEX)
      • Overview
      • How to Use FIN
        • Search and Filter by View
        • Price Chart and Charting Tools
        • Orderbook status and Recent Trades
        • Personal Order Activity
        • Spot and Margin Trade UI
          • Isolated FIN Margin
      • Listing tokens on FIN
      • Coingecko API
      • Product Guides
        • How to Buy KUJI Using axlUSDC
        • How to Sell ATOM for USK
        • How to List a New Pair
        • How to Toggle View to see Certain Pairs
        • How to Save Favourite Pairs
        • How to Check Unclaimed Orders
        • How to Navigate to BOW Pools
        • How to Look at Your History
    • FINDER (Explorer)
      • Product Guides
        • How to View a Wallet's Balance
        • How to Bookmark Wallets for Tracking
        • How to View and Manage Bookmarked Wallets
    • GHOST (Money Market)
      • Basics
      • Dashboard
      • Borrow
      • Lend
    • ORCA (Liquidations)
      • Basics
        • Lending Markets
          • Analytics
          • USK Lending Markets
            • Isolated FIN Margin
          • xAsset Lending Markets
      • How to Integrate ORCA
      • Product Guides
        • How to Bid on Collateral
        • How to View Active Bids on Collateral
        • How to View the Analytics on a Liquidation Market
    • PILOT (Launchpad)
    • POD (Cross-chain Staking)
      • Product Guides
        • How to Stake any Cosmos Layer 1 Token
        • How to Redelegate any Cosmos L1 Token
        • How to Unstake any Cosmos L1 Token
    • Pond (Developer Toolkit)
    • (Retired) SENATE (Grant Oversight)
      • Senators
      • Constitution
      • Treasury
      • Contacting the Senate
      • Past Senate Proposals
      • Past Senate Meetings
      • Transparency
    • Sonar (Native Wallet)
      • Basics
      • Setup
        • Create a wallet
        • Fund your wallet
        • Customize your settings
      • Using Sonar
        • Mobile
          • Home
          • Swap
          • Launch
            • Trade
            • Mint
            • Borrow
            • Liquidate
            • Launch (PILOT)
            • Buy gift cards with Bidali
            • Fin orders (dashboard)
            • Mint & manage USK positions (dash)
            • Borrow on GHOST (dashboard)
          • Stake
          • Send/Receive
        • Desktop
    • USK (Stablecoin)
      • Basics
      • Technical Specifics
      • Use Cases
      • Transparency
      • How to Mint USK
  • Developers
    • Developer Kickstart Page
    • Smart Contracts
      • Token Factory
      • Price Oracle
      • Scheduler
      • Entropy Beacon
    • Indexers
      • SubQuery
    • Core Module Accounts
    • List of Tokens
    • dApp Front Ends
      • FIN
    • Contacting the Team
  • Tokenomics
    • KUJI Token
      • Staking KUJI
      • Staking Tiers and Symbols on BLUE, FIN, and ORCA
      • KUJI Sustainability
      • Kujira Governance
      • Lending and Borrowing KUJI
      • Buying Kujira NFTs
  • Validators
    • Run a Node
      • Create a validator
      • Oracle Price Feeder
      • Tips
    • Cosmovisor Setup
    • Community Tooling
    • Staking Rewards
    • Genesis Validator Allocation
  • Governance
    • Staking
      • Staking Overview
      • Redelegate
      • Unbond
      • Slashing
      • Staking UI
    • Vote on Proposals
    • Submit a Governance Proposal
    • (Retired) The Kujira Senate
      • Treasury
    • Discord Governance Forum
    • Capybara Labs
    • Smart Stake
  • Our Venture-Builder Program
    • Overview
  • Community
    • Kujira Amplifier
    • Kujira Communities
    • Kuji Kast
    • Kujira News
    • Kujira Support
      • Support Ticket System
      • Cosmobot
    • Kujira Social Media
      • Discord
      • Telegram
      • Twitter
      • WinkHUB
      • Medium
      • Reddit
      • Instagram
      • YouTube
  • Help Center
    • Kujira Classroom
    • FAQ
    • Handy Tools
    • Glossary
    • Common Error Messages
  • Brand Assets
    • Colors
    • Logo Options
      • Kujira Brand
      • Native Token Logos
      • Product Logos
      • Legacy Logos
    • Fonts
Powered by GitBook
On this page
  • Install
  • Add environment variables to your shell
  • Set up folder structure
  • Set up genesis binary
  • Set up service
  • Start Cosmovisor
Edit on GitHub
  1. Validators

Cosmovisor Setup

Setting up Cosmovisor is relatively straightforward. However, it does expect certain environment variables and folder structure to be set.

Cosmovisor allows you to download binaries ahead of time for chain upgrades, meaning that you can do zero (or close to zero) downtime chain upgrades. It's also useful if your local timezone means that a chain upgrade will fall at a bad time.

Rather than having to do stressful ops tasks late at night, it's always better if you can automate them away, and that's what Cosmovisor tries to do.

Install

First, go and get cosmovisor (recommended approach):

go get github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor

# or, with go >= 1.15 you can do
go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@latest

# to target a specific version:
go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.0.0

When using cosmovisor, make sure that you do not have auto download of binaries on.

Your installation can be confirmed with:

which cosmovisor

This will return something like:

/home/<your-user>/go/bin/cosmovisor

Building from source allows you to target a specific version of Cosmovisor, in case you do not want to run 1.0.0 yet.

You can also build from source; cosmovisor is in the main cosmos-sdk repo on Github, so you can use Git tags to target a specific version. This example uses a tag, v0.42.7 that refers to the Cosmos SDK, as Cosmovisor-specific tags did not exist before August 2021. The first of these was cosmovisor/v0.1.0, and the second is the current release, cosmovisor/v1.0.0.

git clone https://github.com/cosmos/cosmos-sdk
cd cosmos-sdk
git checkout v0.42.7
export PATH=$PATH:/usr/local/go/bin
export PATH=$PATH:$(go env GO cosmovisor/cosmovisor $GOPATH/bin/cosmovisor
cd $HOME

Add environment variables to your shell

In the .profile file, usually located at ~/.profile, add:

export DAEMON_NAME=kujirad
export DAEMON_HOME=$HOME/.kujira

Then source your profile to have access to these variables:

source ~/.profile

You can confirm success like so:

echo $DAEMON_NAME

It should return kujirad.

Set up folder structure

Cosmovisor expects a certain folder structure:

.
├── current -> genesis or upgrades/<name>
├── genesis
│   └── bin
│       └── $DAEMON_NAME
└── upgrades
    └── <name>
        └── bin
            └── $DAEMON_NAME

Don't worry about current - that is simply a symlink used by Cosmovisor. The other folders will need setting up, but this is easy:

mkdir -p $DAEMON_HOME/cosmovisor/genesis/bin
mkdir -p $DAEMON_HOME/cosmovisor/upgrades

Set up genesis binary

Cosmovisor needs to know which binary to use at genesis. We put this in $DAEMON_HOME/cosmovisor/genesis/bin.

First, find the location of the binary you want to use:

which kujirad

Then use the path returned to copy it to the directory Cosmovisor expects. Let's assume the previous command returned /home/your-user/go/bin/ kujirad:

cp /home/<your-user>/go/bin/kujirad $DAEMON_HOME/cosmovisor/genesis/bin

Once you're done, check the folder structure looks correct using a tool like tree.

Set up service

Commands sent to Cosmovisor are sent to the underlying binary. For example, cosmovisor version is the same as typing kujirad version.

Nevertheless, just as we would manage kujirad using a process manager, we would like to make sure Cosmovisor is automatically restarted if something happens, for example an error or reboot.

First, create the service file:

sudo nano /etc/systemd/system/cosmovisor.service

Change the contents of the below to match your setup - cosmovisor is likely at ~/go/bin/cosmovisor regardless of which installation path you took above, but it's worth checking.

[Unit]
Description=cosmovisor
After=network-online.target

[Service]
User=<your-user>
ExecStart=/home/<your-user>/go/bin/cosmovisor start
Restart=always
RestartSec=3
LimitNOFILE=4096
Environment="DAEMON_NAME=kujirad"
Environment="DAEMON_HOME=/home/<your-user>/.kujira"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="DAEMON_LOG_BUFFER_SIZE=512"

[Install]
WantedBy=multi-user.target

In addition, the same issue can be fixed by reducing the log via env variable. If you are unsure, ask on Discord.

Start Cosmovisor

If syncing from a snapshot, do not start Cosmovisor yet.

Finally, enable the service and start it.

sudo -S systemctl daemon-reload
sudo -S systemctl enable cosmovisor
sudo systemctl start cosmovisor

Check it is running using:

sudo systemctl status cosmovisor

If you need to monitor the service after launch, you can view the logs using:

sudo journalctl -u cosmovisor -f
PreviousTipsNextCommunity Tooling

Last updated 1 year ago

A description of what the environment variables do can be found . Change them depending on your setup.

Note also that we set buffer size explicitly because of a before version v1.0.0. If you are using v1.0.0, you may omit that line.

here
live bug in Cosmovisor
Page cover image