Run in Docker
Prequirements: This guide assumes your running a Linux based operating system and have Docker already installed.
Docker image details
Liberland's node docker image is hosted on GitHub Container Registry: ghcr.io/liberland/blockchain-node. It's build automatically from public Dockerfile. Configuration:
Node binary is stored at
/nodeExposed ports:
30333,9944.Runs as unpriviledged user with UID 1000
Usage examples
Minimal Bastiat (testnet) node with persistent data
To make sure your node's data is persistant, mount a host directory as a volume using -v argument:
$ mkdir $HOME/liberland_data
$ sudo chown 1000:1000 $HOME/liberland_data
$ docker run -it --rm -v $HOME/liberland_data:/data ghcr.io/liberland/blockchain-node:latest -d /data --chain bastiatUsing custom chain spec
To use custom chain spec, you must mount it into the container:
$ mkdir $HOME/liberland_data
$ sudo chown 1000:1000 $HOME/liberland_data
$ docker run -it --rm -v $HOME/liberland_data:/data -v $HOME/custom_chain_spec.raw.json:/custom_chain_spec.raw.json ghcr.io/liberland/blockchain-node:latest -d /data --chain /custom_chain_spec.raw.jsonAccessing your node locally via Polkadot.js Apps
To be able to access your node locally via Polkadot.js Apps, pass --network=host argument so that RPC port is accessible:
$ mkdir $HOME/liberland_data
$ sudo chown 1000:1000 $HOME/liberland_data
$ docker run -it --rm --network=host -v $HOME/liberland_data:/data ghcr.io/liberland/blockchain-node:latest -d /data --chain bastiatYou'll now be able to access your node via https://polkadotjs.blockchain.liberland.org/?rpc=ws://localhost:9944.
Complete example of running a validator on mainnet
This example:
passes
-v $HOME/liberland_data:/datato make data persistent on the hostpasses
--network=hostto make RPC accessible locally and P2P accessible on all interfacespasses
-dto run in backgroundpasses
--restart alwaysto automatically restart node on reboot / crashuses mainnet chain spec
passes
--validatoroption to node to enable acting as validator
$ mkdir $HOME/liberland_data
$ sudo chown 1000:1000 $HOME/liberland_data
$ docker run --name liberland -d --network=host --restart always -v $HOME/liberland_data:/data ghcr.io/liberland/blockchain-node:latest -d /data --chain mainnet --validatorYou can:
monitor this instance with
docker ps -asee its logs with
docker logs liberlandstop with
docker stop liberland- note that it will restart automatically on reboot / Docker restartrestart with
docker restart liberlandremove with
docker rm liberland
Generate session keys
See regenerate session keys document.
With an instance running like this you may now follow the Run a validator starting with Wait for your node to sync section.
Last updated