This repository provides a Cloud Native ready to deploy libp2p relay daemon, including:
- Containerised
go-libp2p-relay-daemon
- Kubernetes manifests to run the daemon as a deployment object
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.
Install the following prerequisites:
- Docker Desktop -- to build and run containers
kind
- to run a local Kubernetes cluster- Alternatively, you may use the local
cluster provided by Docker Desktop. The
instructions here use
kind
.
- Alternatively, you may use the local
cluster provided by Docker Desktop. The
instructions here use
skaffold
- to aid build and deployment orchestration.kustomize
- to render Kubernetes manifests, used internally byskaffold
.kubectl
- to interact with the local Kubernetes cluster.
Run:
kind create cluster
skaffold dev --profile local
The commands above will:
- creates a new local Kubernetes cluster using
kind
. - configures the current
kubectl
context to the localkind
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:
4001
- the libp2p host running the relay, and6060
- the debug pprof HTTP server reachable athttp://localhost:6060/debug/pprof/
.
- Two ports are forwarded:
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