Vultr Deployment Playbook

Prerequisites

Whitelist your IP

You must whitelist your IP address with Vultr.

1

Get to the Vultr Settings API dashboard

Go to the Vultr Settings API dashboard: https://my.vultr.com/settings/#settingsapi

2

Retrieve your IPv4 address

Run this on your host machine:

curl ifconfig.me
3

Update Access Control

Update the Access Control list with {IPv4_OUTPUT_ABOVE}/32 and click Add.

IP Whitelist

Screenshot Example

Image

API Key

Obtain your API key from https://my.vultr.com/settings/#settingsapi

export VULTR_API_KEY="your-api-key-here"

Managing Instances

Create the Vultr Instance

The command below creates a new instance with the following parameters:

  • plan vc2-6c-16gb: 6 vCPUs w/ 16GB RAM and 320GB SSD

  • os_id 2136: Debian 12 x64

  • region sea: Seattle, WA, USA

curl "https://api.vultr.com/v2/instances" \
  -X POST \
  -H "Authorization: Bearer ${VULTR_API_KEY}" \
  -H "Content-Type: application/json" \
  --data '{
    "region" : "sea",
    "plan" : "vc2-6c-16gb",
    "label" : "${REPLACE_ME_WITH_SOME_INSTANCE_NAME}",
    "os_id" : 2136,
    "backups" : "disabled",
    "hostname": "${REPLACE_ME_WITH_SOME_HOST_NAME}",
    "tags": ["personal", "test", "cli", "${REPLACE_ME_WITH_SOME_LABEL}"]
  }' \
  > vultr_create.json

Retrieve the Vultr Instance Configuration

Check the instance status at https://my.vultr.com/subs/?id=VULTR_INSTANCE_ID

export VULTR_INSTANCE_ID=$(cat vultr_create.json | jq -r '.instance.id')

echo "##############\nVisit your instance at https://my.vultr.com/subs/?id=${VULTR_INSTANCE_ID} \n##############"

Get the instance details:

curl "https://api.vultr.com/v2/instances/${VULTR_INSTANCE_ID}" \
  -X GET \
  -H "Authorization: Bearer ${VULTR_API_KEY}" \
  > vultr_get.json

Environment Setup

Once you've created and retrieved your instance details, set up environment variables:

export VULTR_INSTANCE_ID=$(cat vultr_create.json | jq -r '.instance.id')
export VULTR_INSTANCE_IP=$(cat vultr_get.json | jq -r '.instance.main_ip')
export VULTR_PASSWORD=$(cat vultr_create.json | jq -r '.instance.default_password')

Connect to Your Instance

Connect to your instance:

ssh root@$VULTR_INSTANCE_IP

The password is in vultr_create.json under instance.default_password.

Copy password to clipboard (macOS example):

cat vultr_create.json | jq -r '.instance.default_password' | pbcopy

Setup password-less ssh:

ssh-copy-id root@$VULTR_INSTANCE_IP

[Optional] Streamline your configs

One option is to create a directory and move the JSON files there:

mkdir -p ~/workspace/vultr/server
mv vultr_create.json ~/workspace/vultr/server
mv vultr_get.json ~/workspace/vultr/server
cd ~/workspace/vultr/server

Example opinionated .env:

cat <<EOF > .env
export VULTR_INSTANCE_ID=\$(cat vultr_create.json | jq -r '.instance.id')
export VULTR_INSTANCE_IP=\$(cat vultr_get.json | jq -r '.instance.main_ip')
export VULTR_PASSWORD=\$(cat vultr_create.json | jq -r '.instance.default_password')
export VULTR_API_KEY=""
echo "##############"
echo "Visit your instance at https://my.vultr.com/subs/?id=\${VULTR_INSTANCE_ID}"
echo "##############"
echo "ssh root@\${VULTR_INSTANCE_IP}"
echo "##############"
echo "Get password by running"
echo "cat vultr_create.json | jq -r '.instance.default_password' | pbcopy"
echo "##############"
echo "Check logs by running"
echo "sudo journalctl -u cosmovisor-pocket.service -f"
echo "##############"
echo "Check height by running"
echo "curl -X GET http://localhost:26657/block | jq '.result.block.header.height'"
echo "##############"
EOF

Delete Instance

curl "https://api.vultr.com/v2/instances/${VULTR_INSTANCE_ID}" \
  -X DELETE \
  -H "Authorization: Bearer ${VULTR_API_KEY}"

[Optional] Prepare your instance for Pocket

Install pocketd

curl -sSL https://raw.githubusercontent.com/pokt-network/poktroll/main/tools/scripts/pocketd-install.sh | bash -s -- --tag v0.1.12-dev1 --upgrade

Import or create an account

Export a key from your local machine:

pocketd keys export {key-name} --unsafe --unarmored-hex --yes

Import it into your instance:

pocketd keys import {key-name} {hex-priv-key}

Or create a new one:

pocketd keys add {key-name}

Run a full node

See the instructions in the full node cheatsheet: https://dev.poktroll.com/operate/cheat_sheets/full_node_cheatsheet


Additional Resources

Explore Available Plans

curl "https://api.vultr.com/v2/plans" \
  -X GET \
  -H "Authorization: Bearer ${VULTR_API_KEY}" \
  > vultr_plans.json

Explore the JSON:

cat vultr_plans.json | jq

Explore Available Operating Systems

curl "https://api.vultr.com/v2/os" \
  -X GET \
  -H "Authorization: Bearer ${VULTR_API_KEY}" \
  > vultr_os.json

Explore the JSON:

cat vultr_os.json | jq
  • Vultr API Documentation: https://www.vultr.com/api

  • Vultr CLI GitHub Repository: https://github.com/vultr/vultr-cli

Was this helpful?