nostr-rs-relay

by kriegalex

Helm chartv1.0.1App 0.9.0Verified publisher

A Helm chart for deploying a Nostr RS Relay

About this chart

nostr-rs-relay

A Helm chart for deploying a Nostr RS Relay

Introduction

This Helm chart deploys a nostr-rs-relay instance on a Kubernetes cluster. The Nostr relay provides a server for the Nostr (Notes and Other Stuff Transmitted by Relays) protocol, a decentralized social network with no central authority.

Prerequisites

  • Kubernetes 1.29+
  • Helm 3.16+
  • PV provisioner support in the underlying infrastructure (if persistence is enabled)

Installing the Chart

To install the chart with the release name nostr-rs-relay:

helm repo add k8s-charts https://kriegalex.github.io/k8s-charts/
helm repo update
helm install nostr-rs-relay k8s-charts/nostr-rs-relay

Uninstalling the Chart

To uninstall/delete the nostr-rs-relay deployment:

helm delete nostr-rs-relay

Configuration

The following table lists the configurable parameters for the nostr-relay chart and their default values.

KeyTypeDefaultDescription
config.info.descriptionstring"A nostr-rs-relay on kubernetes."Description of your relay (required)
config.info.namestring"nostr-rs-relay"Name of your relay (required)
config.info.relay_urlstring"wss://nostr.k3s.home/"The public-facing URL of your relay with the websocket schema (required)
config.limits.limit_scrapersboolfalseRejects imprecise requests (kind only and author only etc)
config.networkobject{"address":"0.0.0.0","port":8080}Whether the event admission server denies writes restricts_write: false Network settings
config.network.addressstring"0.0.0.0"Network binding address
config.network.portint8080Network port
config.options.reject_future_secondsint1800Reject events that claim to be created too far in the future (seconds)
fullnameOverridestring""String to fully override nostr-relay.fullname template
image.pullPolicystring"IfNotPresent"Nostr relay Docker image pull policy
image.repositorystring"scsibug/nostr-rs-relay"Nostr relay Docker image repository
image.tagstring""Overrides the image tag. Default is the chart appVersion
imagePullSecretslist[]Specify imagePullSecrets if your Docker repository requires authentication
ingress.annotationsobject{}Additional ingress annotations
ingress.classNamestring""Ingress class name
ingress.enabledboolfalseEnable ingress resource
ingress.hostslist[{ host: nostr.k3s.home }]List of ingress hosts
ingress.tlslist[]Ingress TLS configuration
nameOverridestring""String to partially override nostr-relay.fullname template
persistence.accessModestring"ReadWriteOnce"Access mode for the persistent volume
persistence.enabledbooltrueEnable persistent storage for the database
persistence.sizestring"10Gi"Size of the persistent volume
persistence.storageClassstring""StorageClass name. If empty, uses the default provisioner.
podAnnotationsobject{}Annotations to be added to the pod
podSecurityContext.fsGroupint1000Group ID for filesystem access
podSecurityContext.runAsGroupint1000Group ID for the pod
podSecurityContext.runAsUserint1000User ID for the pod
replicaCountint1Number of nostr-relay replicas
resourcesobject{}Resource limits and requests for the relay
securityContext.runAsGroupint1000Group ID to run the container
securityContext.runAsNonRootbooltrueRun container as non-root user
securityContext.runAsUserint1000User ID to run the container
service.portint8080Kubernetes Service port
service.typestring"ClusterIP"Kubernetes Service type
serviceAccount.createboolfalseSpecifies whether a service account should be created
serviceAccount.namestring""The name of the service account to use. If not set and create is true, a name is generated using the fullname template.

Persistence

This chart mounts a Persistent Volume for the database. The volume is created using dynamic volume provisioning. If you want to disable this (and instead use an emptyDir volume), set persistence.enabled to false.

Ingress and Reverse Proxy

This chart includes support for Ingress resources. If you have an Ingress controller installed on your cluster, such as nginx-ingress or traefik, you can utilize the ingress controller to serve your Nostr relay.

For proper WebSocket support in an ingress configuration, you may need to add specific annotations. For example, with NGINX:

ingress:
  enabled: true
  annotations:
    nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
    nginx.ingress.kubernetes.io/proxy-body-size: "64m"
  hosts:
    - host: relay.example.com
      paths:
        - path: /
          pathType: Prefix
  tls:
    - secretName: relay-tls
      hosts:
        - relay.example.com

NIP-05 Verification

To enable NIP-05 verification, set config.nip05.enabled to true and configure your domain and users:

config:
  nip05:
    enabled: true
    domain: "example.com"
    users:
      alice: "pubkey1"
      bob: "pubkey2"

This will allow users to verify their identities using the format [email protected] or [email protected].

Using with Kubernetes

Once your relay is deployed, you can access it using the service endpoint. The default configuration creates a ClusterIP service, which means it's only accessible within the cluster.

Accessing the Relay

  1. For internal cluster access:

    ws://RELEASE-NAME-nostr-relay.NAMESPACE.svc.cluster.local:8080
    
  2. To access from your local machine:

    kubectl port-forward --namespace NAMESPACE svc/RELEASE-NAME-nostr-relay 8080:8080
    

    Then connect to ws://localhost:8080

  3. If you enabled Ingress, use the domain you specified.

Checking Logs

To view the logs of your relay:

kubectl logs -f deployment/RELEASE-NAME-nostr-relay -n NAMESPACE

Notes on Production Use

For production deployments, consider:

  1. Using a specific image tag rather than latest
  2. Setting appropriate resource limits and requests
  3. Enabling TLS via Ingress or another method
  4. Setting up proper monitoring and backup strategies for the database
  5. Configuring blacklists and rate limits to protect against abuse

Autogenerated from chart metadata using helm-docs v1.14.2

Deploy nostr-rs-relay with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has nostr-rs-relay on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartnostr-rs-relay is pinned at v1.0.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply