Docker Compose Cheat Sheet
- Results
- Deploy your server
- Install Dependencies
- Retrieve the source code
- Update your environment
- Start up the full node
- Create new addresses for all your accounts and update .env
- Fund your accounts
- Stake a Supplier & Deploy a RelayMiner
- Stake an Application & Deploy an AppGate Server
- Send a Relay
- [BONUS] Deploy a PATH Gateway
- Managing a re-genesis
Results
This is a text heavy walkthrough, but if all goes well, you should have something like the following:
Deploy your server
- Go to vultr's console
- Choose
Cloud Compute - Shared CPU
- Choose
Debian 12 x64
- Select
AMD High Performance
- Choose the
100GB NVMe
storage w/4GB
memory and2 vCPU
- Disable
Auto Backups
- Deploy
Install Dependencies
See docker's official instructions here.
Prepare the system:
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
# Check if UFW is installed and add rules if it is
if command -v ufw > /dev/null 2>&1; then
sudo ufw allow from 172.16.0.0/12
sudo ufw allow from 192.168.0.0/16
echo "UFW rules added for Docker networks"
else
echo "UFW is not installed, skipping firewall configuration"
fi
And then install docker:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Retrieve the source code
Then pull the github repo
mkdir ~/workspace && cd ~/workspace
git clone https://github.com/pokt-network/poktroll-docker-compose-example.git
cd poktroll-docker-compose-example
Update your environment
cp .env.sample .env
EXTERNAL_IP=$(curl -4 ifconfig.me/ip)
sed -i -e s/NODE_HOSTNAME=/NODE_HOSTNAME=$EXTERNAL_IP/g .env
echo "source $(pwd)/helpers.sh" >> ~/.bashrc
echo "source $(pwd)/.env" >> ~/.bashrc
source ~/.bashrc
Start up the full node
docker compose up -d full-node
# Optional: watch the block height sync up & logs
docker logs -f --tail 100 full-node
watch_height
Create new addresses for all your accounts and update .env
Supplier:
poktrolld keys add supplier > /tmp/supplier
mnemonic=$(tail -n 1 /tmp/supplier | tr -d '\r'); sed -i "s|SUPPLIER_MNEMONIC=\".*\"|SUPPLIER_MNEMONIC=\"$mnemonic\"|" .env
address=$(awk '/address:/{print $3; exit}' /tmp/supplier | tr -d '\r'); sed -i "s|SUPPLIER_ADDR=\".*\"|SUPPLIER_ADDR=\"$address\"|g" .env
Application:
poktrolld keys add application > /tmp/application
mnemonic=$(tail -n 1 /tmp/application | tr -d '\r'); sed -i "s|APPLICATION_MNEMONIC=\".*\"|APPLICATION_MNEMONIC=\"$mnemonic\"|" .env
address=$(awk '/address:/{print $3; exit}' /tmp/application | tr -d '\r'); sed -i "s|APPLICATION_ADDR=\".*\"|APPLICATION_ADDR=\"$address\"|g" .env
Gateway:
poktrolld keys add gateway > /tmp/gateway
mnemonic=$(tail -n 1 /tmp/gateway | tr -d '\r'); sed -i "s|GATEWAY_MNEMONIC=\".*\"|GATEWAY_MNEMONIC=\"$mnemonic\"|" .env
address=$(awk '/address:/{print $3; exit}' /tmp/gateway | tr -d '\r'); sed -i "s|GATEWAY_ADDR=\".*\"|GATEWAY_ADDR=\"$address\"|g" .env
FINALLY, source .env
to update the environment variables.
Fund your accounts
Run the following:
show_actor_addresses
For each one, fund the accounts using the faucet
Next, run this helper (it's part of helpers.sh
) to find each of them on the explorer:
show_explorer_urls
Stake a Supplier & Deploy a RelayMiner
Stake the supplier:
sed -i -e s/YOUR_NODE_IP_OR_HOST/$NODE_HOSTNAME/g ./stake_configs/supplier_stake_config_example.yaml
sed -i -e s/YOUR_OWNER_ADDRESS/$SUPPLIER_ADDR/g ./stake_configs/supplier_stake_config_example.yaml
poktrolld tx supplier stake-supplier --config=/poktroll/stake_configs/supplier_stake_config_example.yaml --from=supplier --chain-id=poktroll --yes
# OPTIONALLY check the supplier's status
poktrolld query supplier show-supplier $SUPPLIER_ADDR
# Start the relay miner (please update the grove app ID if you can)
sed -i -e s/YOUR_NODE_IP_OR_HOST/$NODE_HOSTNAME/g relayminer/config/relayminer_config.yaml
sed -i -e "s|backend_url: \".*\"|backend_url: \"https://eth-mainnet.rpc.grove.city/v1/c7f14c60\"|g" relayminer/config/relayminer_config.yaml
Start the supplier
docker compose up -d relayminer
# OPTIONALLY view the logs
docker logs -f --tail 100 relayminer
Stake an Application & Deploy an AppGate Server
Stake the application:
poktrolld tx application stake-application --config=/poktroll/stake_configs/application_stake_config_example.yaml --from=application --chain-id=poktroll --yes
# OPTIONALLY check the application's status
poktrolld query application show-application $APPLICATION_ADDR
Start the appgate server:
docker compose up -d appgate
# OPTIONALLY view the logs
docker logs -f --tail 100 appgate
Send a Relay
curl http://$NODE_HOSTNAME:85/0021 \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}'
Ensure you get a response
To ensure you get a response, run the request a few times.
for i in {1..10}; do
curl http://$NODE_HOSTNAME:85/0021 \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}' \
--max-time 1
echo ""
done
[BONUS] Deploy a PATH Gateway
If you want to deploy a real Gateway, you can use Grove's PATH after running the following commands:
# Stake the gateway
poktrolld tx gateway stake-gateway --config=/poktroll/stake_configs/gateway_stake_config_example.yaml --from=gateway --chain-id=poktroll --yes
# Delegate from the application to the gateway
poktrolld tx application delegate-to-gateway $GATEWAY_ADDR --from=application --chain-id=poktroll --chain-id=poktroll --yes
# OPTIONALLY check the gateway's and application's status
poktrolld query gateway show-gateway $GATEWAY_ADDR
poktrolld query application show-application $APPLICATION_ADDR
Managing a re-genesis
Assuming you already had everything functioning following the steps above, this is a quick way to reset everything (without recreating keys) after a re-genesis.
Full Nodes
# Stop all containers
docker compose down
docker rm $(docker ps -aq) -f
# Remove existing data
rm -rf poktrolld-data/config/addrbook.json poktrolld-data/config/genesis.json poktrolld-data/config/genesis.seeds poktrolld-data/data/ poktrolld-data/cosmovisor/ poktrolld-data/config/node_key.json poktrolld-data/config/priv_validator_key.json
Update POKTROLLD_IMAGE_TAG
in .env
based on the releases here.
# Start the full
docker compose up -d full-node
# Sanity check the logs
docker logs full-node -f --tail 100
Fund the same accounts
Go to the faucet and fund the same accounts:
echo $APPLICATION_ADDR
echo $GATEWAY_ADDR
echo $SUPPLIER_ADDR
Faucet is not ready and you need to fund the accounts manually
# Import the faucet using the mnemonic
poktrolld keys add --recover -i faucet
poktrolld tx bank multi-send faucet $APPLICATION_ADDR $GATEWAY_ADDR $SUPPLIER_ADDR 100000upokt --chain-id=poktroll --yes
Start the RelayMiner
# Stake
poktrolld tx supplier stake-supplier --config=/poktroll/stake_configs/supplier_stake_config_example.yaml --from=supplier --chain-id=poktroll --yes
# Check
poktrolld query supplier show-supplier $SUPPLIER_ADDR
# Start
docker compose up -d relayminer
# View
docker logs -f --tail 100 relayminer
Start the AppGate Server
# Stake
poktrolld tx application stake-application --config=/poktroll/stake_configs/application_stake_config_example.yaml --from=application --chain-id=poktroll --yes
# Check
poktrolld query application show-application $APPLICATION_ADDR
# Start
docker compose up -d appgate
# View
docker logs -f --tail 100 appgate