swarm-keydb

Deployment

The repository includes Docker and Kubernetes assets for running SwarmKeyDb with a colocated Bee node.

Defaults

Docker Compose

  1. Copy .env.example to .env and update the placeholder values.
  2. Pull and start the stack:
docker compose pull
docker compose up

The stack starts:

Redis migration demo (Docker Compose)

A self-contained migration demo is available at deploy/migration/docker-compose.yml.

docker compose -f deploy/migration/docker-compose.yml up --build --abort-on-container-exit

The migration demo provisions a source Redis container, seeds sample data, migrates keys into SwarmKeyDb, and runs validation.

Kubernetes

Manifests are under deploy/k8s/.

kubectl apply -f deploy/k8s/namespace.yaml
kubectl apply -f deploy/k8s/configmap.yaml
kubectl apply -f deploy/k8s/secrets.example.yaml
kubectl apply -f deploy/k8s/swarm-bee.yaml
kubectl apply -f deploy/k8s/swarm-keydb.yaml

Bee API traffic stays internal to the cluster by default. If you need internet-reachable P2P connectivity, set a public BEE_NAT_ADDR and adjust the swarm-bee-p2p service for your cluster networking model.

Helm

The production Helm chart is under helm/swarm-keydb/.

1) Install Bee (Swarm)

Install Bee first so SwarmKeyDb can reach a live Bee API.

helm repo add ethersphere https://ethersphere.github.io/helm
helm repo update
helm install --generate-name ethersphere/bee \
  --namespace swarm-keydb \
  --create-namespace

The SwarmKeyDb chart default env.beeUrl is https://bzz.limo. Override it with your Bee service DNS name when you want in-cluster Bee writes.

2) Install or upgrade SwarmKeyDb

helm repo add swarm-keydb https://scholtz.github.io/swarm-keydb/
helm repo update
helm upgrade --install swarm-keydb swarm-keydb/swarm-keydb \
  --namespace swarm-keydb \
  --create-namespace \
  --set secret.beePostageBatchId=<your-postage-batch-id>

Override for a generated Bee release service name:

kubectl -n swarm-keydb get svc
helm upgrade --install swarm-keydb swarm-keydb/swarm-keydb \
  --namespace swarm-keydb \
  --create-namespace \
  --set env.beeUrl=http://<bee-service-name>.swarm-keydb.svc.cluster.local:1633 \
  --set secret.beePostageBatchId=<your-postage-batch-id>

3) Verify connectivity

kubectl -n swarm-keydb get pods
kubectl -n swarm-keydb get svc
kubectl -n swarm-keydb logs deploy/swarm-keydb --tail=100

The env.beeUrl value must resolve to the Bee API service from inside the swarm-keydb pod.

Monitoring

SwarmKeyDb exposes:

Default ports:

Example Prometheus scrape config:

scrape_configs:
  - job_name: swarm-keydb
    metrics_path: /metrics
    static_configs:
      - targets: ['swarm-keydb.default.svc.cluster.local:9090']

Example Grafana panel JSON:

{
  "title": "SwarmKeyDb error rate",
  "type": "timeseries",
  "targets": [
    {
      "expr": "rate(swarmkeydb_operations_total{status=\"error\"}[5m])",
      "legendFormat": "errors/sec"
    }
  ]
}