Skip to content

masih/libp2p-relay-daemon

Repository files navigation

libp2p-relay-daemon

Build

This repository provides a Cloud Native ready to deploy libp2p relay daemon, including:

Additionally, it provides:

  • Example deployment manifest to run the daemon with stable libp2p identity
  • Development utilities to run the daemon on a local Kubernetes cluster

See:

  • examples/stable-identity - example manifests to run relay in a self contained Kubernetes namespace, with stable libp2p identity and default JSON configuration file.

Running relay locally

Install the following prerequisites:

  • Docker Desktop -- to build and run containers
  • kind - to run a local Kubernetes cluster
  • skaffold - to aid build and deployment orchestration.
  • kustomize - to render Kubernetes manifests, used internally by skaffold.
  • kubectl - to interact with the local Kubernetes cluster.

Run:

  1. kind create cluster
  2. skaffold dev --profile local

The commands above will:

  • creates a new local Kubernetes cluster using kind.
  • configures the current kubectl context to the local kind cluster.
  • builds the Dockerfile
  • generates a random libp2p identity
  • renders the example manifests at examples/stable-identity
  • deploys the manifests onto the local Kubernetes cluster
  • tails the output from the running container onto the terminal session.
  • port-forwards the running instance onto localhost
    • Two ports are forwarded:
      1. 4001 - the libp2p host running the relay, and
      2. 6060 - the debug pprof HTTP server reachable at http://localhost:6060/debug/pprof/.

To stop the running instance and delete the deployment, interrupt the session by pressing Ctrl-C.

To destroy the local cluster along with the deployed instance, run:

  • kind delete cluster