Skip to content

Running a Worker Node

Derek Anderson edited this page May 13, 2024 · 17 revisions

Prerequisites

Before you begin, ensure you have the following prerequisites:

  • A machine with Docker installed and running.
  • Optional: Valid AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY for an S3-compatible storage provider if you choose to back up your node's keys and configuration to S3-compatible storage.
  • A specified KEY_PATH and KEY_PASSWORD for accessing your backup data, if using S3-compatible storage.

Alternative Backup Options

If you are not using S3-compatible storage, you can back up your data using Kubernetes or a Docker-managed persistent disk. Here are some general steps to consider:

  • Kubernetes: Utilize persistent volumes in your pod specifications to ensure data persists across pod restarts and deployments. Consider using StatefulSets for applications that require stable, unique network identifiers.
  • Docker: Configure volume mappings in your Docker commands to link container storage to a persistent disk on the host system. Ensure the host's disk is backed up regularly using your preferred system backup tools.

Running the b7s Docker Image

Step 1: Pull the Docker Image

First, you need to pull the latest version of the b7s Docker image from the public registry. Open your terminal and run the following command:

docker pull ghcr.io/blocklessnetwork/b7s:v0.0.25

Step 2: Run the Worker Node

Worker Node Configuration with AWS Backup

To run the node as a worker using AWS for backups, configure the Docker container with the environment variables for AWS and port mappings. Use the following command, replacing the placeholders with your actual values:

docker run -d --name b7s-worker-aws \
  -e AWS_ACCESS_KEY_ID=<YOUR_AWS_ACCESS_KEY_ID> \
  -e AWS_SECRET_ACCESS_KEY=<YOUR_AWS_SECRET_ACCESS_KEY> \
  -e KEY_PATH=<YOUR_S3_KEY_PATH> \
  -e KEY_PASSWORD=<YOUR_S3_KEY_PASSWORD> \
  -e NODE_ROLE=worker \
  -e P2P_PORT=9527 \
  -v /var/tmp/b7s/db:/var/tmp/b7s/db \
  -p 9527:9527 \
  ghcr.io/blocklessnetwork/b7s:v0.0.25

Worker Node Configuration with Local Key Path Mount

To run the node as a worker using a local or Docker-managed mount for key storage, omit the AWS environment variables and map the key storage directory directly. Use the following command, replacing the placeholders with your actual paths:

docker run -d --name b7s-worker-local \
  -e NODE_ROLE=worker \
  -e P2P_PORT=9527 \
  -v /path/to/your/local/keys:/keys \
  -v /var/tmp/b7s/db:/var/tmp/b7s/db \
  -p 9527:9527 \
  ghcr.io/blocklessnetwork/b7s:v0.0.25

Additional Configuration

Volume Configuration

The command includes volume mappings that map directories on your host machine to the Docker container. These mappings are used to persist the database data and, optionally, key storage used by your b7s node. Ensure the directories exist on your host or Docker will create them for you, which might not have the desired permissions.

Network Configuration

The port 9527 is mapped from the host to the container (-p 9527:9527). This is the peer-to-peer (P2P) communication port. Ensure that this port is open in your firewall settings to allow incoming and outgoing connections to and from other nodes.

Monitoring and Logs

To monitor the logs of your b7s worker node, use the Docker logs command:

docker logs -f b7s-worker-aws

docker logs -f b7s-worker-local

These commands will follow the log output in the terminal, allowing you to monitor the operational status of your worker node in real-time.

Clone this wiki locally