- Docker and Docker Compose (Tested on Linux only)
Create required external network and volume, which will be shared between different instances of nodes and providers
docker network create lava && docker network create public && docker volume create lava && docker volume create lava_binaries
Create acme.json file to store certificates
touch traefik/acme.json && chmod 600 traefik/acme.json
Copy environment file sample to .env and set your configs.
Most users only need to edit ACCOUNT_NAME
and MONIKER_NAME
cp .env.sample .env
run below command and follow the instructions to import your wallet or create a new one.
if you intend to create a new wallet, you keys will be displayed on screen only one time!
Don't forget to backup your newly generated account keys. Store it somewhere safe
docker compose run --rm validator init
this will also create a new priv_json_validator.json
file, if you want to import your previous validator copy it into the volume as follow :
- inside the repository directory, create a folder called
backup_validator_keys
, then put yourpriv_json_validator.json
andnode_key.json
inside it - run the copy helper command
./helpers.sh node:restore
otherwise make a backup from newly generated files and keep them safe
THESE KEYS CANNOT BE RESTORED USING MNEMONIC so make a backup from these too
./helpers.sh node:backup
Generally, to run any lavad
commands, prefix it like this:
docker compose exec [service name] lavad [command args]
where service name can be either validator
or rpcprovider
. based on which docker-compose.yml file you are working with
for example to test our lava rpc using our own node, inside the rpc provider directory:
cd providers/lava
docker compose exec rpcprovider lavad test rpcprovider --node tcp://validator:26657 --from foo --endpoints "lava.example.com:443,LAV1"
To a run node inside root directory of project, run this:
docker compose up -d validator
check logs
docker compose logs -f --tail 300 validator
get test tokens from faucet using your public address
Wait for your node to catch up with the rest of network before you proceeding. you can check validator's current info by running this:
docker compose exec validator /opt/helpers.sh validator:sync-info
When catching_up
became false
then proceed.
Verify that your account has funds in it in order to perform staking
docker compose exec validator /opt/helpers.sh wallet:balance
Sign a transaction to become a validator
docker compose exec validator /opt/helpers.sh validator:connect
first get the valoper address:
docker compose exec validator /opt/helpers.sh node:valoper
then use the valoper address and amount in ulava , e.g to delegate 325ulava:
docker compose exec validator /opt/helpers.sh validator:delegate VALOPER_ADDRESS_HERE "325ulava"
The newly released lavavisor
heavily depends on systemd
which is not available in containers. so i did some nasty things to achieve something
like auto-update
feature of lavavisor
. i explain it shortly :
lavavisor
container which periodically scans for new versions oflavap
and download if any is available. the binaries are shared amongst all RPC services.- a supervisor setup with 2 process for each RPC service. one runs the
lavap
service as normal, and a watcher process, which detects new installed versions oflavap
and restarts the sibling RPC service accordingly
WARNING I didn't test Consumer yet. maybe it doesn't work
Each directory inside the providers directory represents only ONE rpc service. lava provider included by default.
copy .env.sample
to .env
modify RPC_CONTAINER_LABEL
and RPC_URL
, ACCOUNT_NAME
in .env file
also if you are running a node using this repository, leave LAVA_NODE
as it is, otherwise set public node url.
IMPORTANT
The given rpc.yml
example files assumes you are running you own lava node. if you are not running your own node, make sure to change all node_urls in rpc.yml
to a public node url
cd providers/lava
cp .env.sample .env
Set desired configs in rpc.yml
file then run:
docker compose up -d
That's it. your rpc provider is up and running, fully isolated from other process. traefik will automatically detect this container and generates a certificate using lets encrypt and
routes all traffic from RPC_URL
to this container. just don't forget stake lava token your provider.
To test your provider :
docker compose exec rpcprovider lavap test rpcprovider --node tcp://validator:26657 --from ACCOUNT_NAME_HERE --endpoints "lava.example.com:443,LAV1"
To add more providers/consumers, clone this lava directory with a new name. repeat the same steps