Become a Lavanet Provider in 15 minutes 🌋
Deploying a Lava Network Provider via Ansible
Deploying a Lava network provider can be complex, but Ansible, a powerful automation tool, can streamline this process, making it efficient and scalable.
This article outlines the steps and considerations for deploying a Lava network provider via Ansible, leveraging the official Lavanet Ansible repository.
What is Lava Network?
Lava Network is revolutionizing blockchain access by providing a decentralized and modular framework that optimizes how developers and users interact with blockchain ecosystems. Acting as a universal data access layer, Lava Network allows seamless and reliable interactions across multiple blockchains.
Providers in Lavanet’s Protocol
Providers are the backbone of the Lava network, servicing relay requests by staking on the network and operating RPC nodes on Relay Chains queried by Consumers (e.g., Cosmos, Ethereum, Osmosis, Polygon, etc.). In return, they earn fees in the form of LAVA tokens from the Consumers for servicing these requests.
Understanding Ansible
Ansible is an open-source automation tool that configures systems, deploys software, and orchestrates advanced IT tasks such as continuous deployments or zero-downtime rolling updates. It uses a simple syntax written in YAML called playbooks, which are easy to read and write.
The Provider Ansible role deploys three major components
- Provider — The provider service itself, is based on
lavap
andlavavisor
. - Cache — An optional component to speed up provider response time and cut costs.
- Nginx — As a reverse proxy, controls the traffic to the provider and also responsible for SSL termination.
Prerequisites
Before setting up the provider, ensure you have the following prerequisites in place:
- Install the Ansible CLI.
- Install the latest release of lavap CLI.
- Clone the official Lavanet’s Ansible repository:
git clone https://github.com/lavanet/ansible.git
4. Ensure you have SSH, access to the target nodes you plan to deploy the provider.
5. For Ansible to work, make sure the root users are not promoted for passwords, for example in Ubuntu:
echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/dont-prompt-$USER-for-sudo-password
6. An exported wallet address for the provider to work with. if you don’t have one, a wallet can simply be created and exported by running the following commands:
lavap keys add <wallet-name> --keyring-backend test
lavap keys export <wallet-name> --keyring-backend test
# Promoted for password.
⚠️ Note both the address and the password for later.
Also, note that the wallet needs funds to stake the provider later.
Steps for Deploying a Provider
After we make sure our environment is ready we can deploy the provider:
- Update the
inventory/hosts.yml
file to point to the desired servers:
# inventory/hosts.yml
my-provider:
hosts:
192.168.1.10:
hostname: my-provider-hostname
vars:
geo_location: "2"
wallet_name: wallet
user_name: ubuntu
subdomain: lava
Let’s go over the parameters:
hostname
— Your preferred Linux hostname for the servergeo_location
— Geolocation of the provider, here’s the full list.wallet_name
— This is the name of the wallet you exported in previous steps, you’ll need to import it later on the target server using this name.user_name
— Your operating system username.subdomain
— A subdomain is mandatory as the provider is serving on GRPC, the Ansible role usessubdomain
together with thedomain
andgeo_location
variables to create the full Nginx server name:subdomain.geo_location.domain
2. Run the bootstrap playbook:
ansible-playbook -i inventory -l my-provider lava_bootstrap.yml --diff
After that configure SSL certificates. You can create your certificates with Certbot or use your DNS hosting solution certificates.
3. Update the provider.yml
. Here’s a bare-minimum example of how the provider.yml
vars section should look like:
# vars\main.yml
vars:
chain_id: testnet
domain: mycooldomain.com
lavavisor:
enabled: true
version: v2.2.0
cache:
enabled: true
Again, let’s review some of the parameters:
chain_id
— The Lava chain id, can betestnet
ormainnet
, Ansible will translate it to the proper names.domain
— Your primary domain, together with the subdomain andgeo_location
, the full Nginx server name will be:lava.2.mycooldomain.com
lavavisor.version
— The version of the lavavisor binary. Always use the latest version.cache.enabled
— If true, lavap cache be installed and enabled.
For full configuration visit the docs.
4. Prepare the provider configuration, here we’ll use the example listed in the docs. Replace the full domain on the filename and node addresses with your real values:
# roles/provider/var/lava.2.mycooldomain.com.yml
provider:
chains:
lav1:
metrics_port: 3300
interfaces:
- interface: rest
port: 1500
nodes:
- endpoint: https://endpoint.com:443/rest/
type: full
- endpoint: https://endpoint_with_archive.com:443/rest/
type: archive
- interface: tendermintrpc
port: 1500
nodes:
- endpoint: https://endpoint.com:443/rpc
type: full
- endpoint: https://endpoint_with_archive.com:443/rpc
type: archive
- interface: grpc
port: 1500
nodes:
- endpoint: endpoint.com:443
type: full
- endpoint: endpoint_with_archive.com:443
type: archive
⚠️ DO NOT commit the plain configuration to source control as the nodes’ address can sometimes contain private keys for restricted access.
You can encrypt the config file using the ansible-vault encrypt
command.
5. On the remote server import your wallet’s key with the following command:
lavap keys import <wallet-name> <key-file> --keyring-backend test
key-file
is the result of the keys export
command from the previous step.
6. Finally, run the provider playbook, using the following command:
ansible-playbook -i inventory provider.yml --diff
Login to the machine and verify that the lavavisor
service is up and running with no errors in the logs:
sudo journalctl -n 100 -u provider-lav1.service
7. To stake the provider so consumers use it, expose the provider to the world using services like CloudFlare, Route 53, OpenDNS, or other DNS hosting solutions. For this guide, we’ll assume lava.2.mycooldomain.com
is the FQDN.
8. From outside of the server, test the provider by running:
lavap test rpcprovider --from <wallet-name> --endpoints "lava.2.mycooldomain.com:433,LAV1" --node https://lava-api.w3coins.io:443 --keyring-backend test
9. Now that the provider is up and available we need to stake it, this is an example of a provider stake command:
lavap tx pairing stake-provider "LAV1" \
"50000000000ulava" \
"lava.2.mycooldomain.com:443,LAV1" LAV1 \
--from "<wallet-name>" \
--provider-moniker "my-moniker" \
--keyring-backend test \
--chain-id lava-mainnet-1 \
--gas "auto" \
--gas-adjustment "1.5" \
--node https://lava-api.w3coins.io:443
--delegate-limit 0 \
--description-details "provider desc" \
--website "https://my-provider-site.com" \
--identity "provider icon"
For a detailed explanation and more staking examples view the official docs.
You can also verify that your provider is part of the pairing process by running:
lavap q pairing account-info --from <wallet-name> --node https://lava-api.w3coins.io:443 --keyring-backend test
Congratulations! You now have an operational Lavanet provider🌋
Conclusion
Becoming a Lavanet provider is a straightforward process that can be accomplished easily with Ansible. This not only allows you to participate in a decentralized network but also provides an opportunity to earn rewards for your contributions.
Whether you are new to blockchain or an experienced user, becoming a Lavanet provider is a rewarding endeavor that enhances your understanding and engagement with decentralized technologies.
Useful Links:
🟣 Join our Discord community for real-time support and discussions
⚫️ Follow us on X for the latest updates