Entrivia
Self-hosting

Self-hosting · Kubernetes

Install Entrivia with Helm.

The charts/entrivia chart installs one workspace on Kubernetes: the API, the portal and the guest UI, with PostgreSQL as a CloudNativePG cluster and, as small reference deployments, Valkey and an S3-compatible store (RustFS or VersityGW) on persistent volumes. Each of the three stores can be switched to one you run yourself.

The chart recommends no hosting setup. Ingress controller, storage class, certificates, secret management, the SMTP relay, DNS and backups stay your choice; hosting-specific pieces fit through generic values such as ingress.className, ingress.annotations, extraObjects and postgresql.cnpg.extraSpec.

At a glance

Chart version
0.1.0
Installs Entrivia 0.1.0.
Needs
Kubernetes 1.31+
And Helm 3.8 or newer.
Registry
Not published yet
Until it is, install from a checkout of the repository (step 2).
Interface
The values
Renaming or removing a value is a breaking change and bumps the chart’s major version.

How the pieces fit

The portal and guest images serve static files and call the API on their own origin: /auth, /graphql and /v1 from the portal, /graphql, /g and /v1 from the guest UI. Same-origin calls keep the sign-in cookies first-party, so the Ingress routes those paths to the API on each host. Kiosks, the print agent, OAuth callbacks, webhooks and the REST API all use the portal host, which is why the chart sets API_BASE_URL to config.portalUrl.

Uploads never pass through the API: it hands out short-lived presigned URLs on config.s3Endpoint, and the browser or kiosk talks to the store directly. That is why the store needs its own public HTTPS host. The API reaches the store at that same address, so pods must be able to resolve and reach the cluster’s public names.

The API runs as one replica with the Recreate strategy: live updates are held in its memory, and every pod start runs migrate in an init container before the API starts, so an upgrade stops the old version before the new one migrates the database. PostgreSQL and Valkey are reachable only from the API and the setup Job (NetworkPolicy).

HostPathForward to
visitors.example.comPortal/auth/*/graphql/v1/*/g/*/webhooks/*svc/entrivia-apiAPI
visitors.example.comPortaleverything elsesvc/entrivia-portalPortal
visit.example.comGuest UI/graphql/v1/*/g/*svc/entrivia-apiAPI
visit.example.comGuest UIeverything elsesvc/entrivia-guestGuest UI
files.example.comFileseverythingsvc/entrivia-rustfsObject store

The chart’s Ingress renders this routing from the three URLs in your values; with release name entrivia the Services are entrivia-api, entrivia-portal, entrivia-guest and entrivia-rustfs (entrivia-versitygw with objectStorage.server=versitygw).

What you need

  • A Kubernetes cluster (1.31 or newer; one node is enough), with kubectl and helm configured for it.
  • The CloudNativePG operator for the default database (step 1), unless you bring your own PostgreSQL 16.
  • An ingress controller and a default storage class (k3s ships Traefik and local-path). A CNI that enforces NetworkPolicy, or set networkPolicy.enabled=false knowingly.
  • Three DNS names pointing at the ingress. This guide uses visitors.example.com for the portal, visit.example.com for the guest UI and files.example.com for the object store.
  • A way to get TLS certificates for those names into the cluster: cert-manager, or a certificate you already have.
  • An SMTP relay that accepts mail from the cluster, with a sender address on a domain you control.
  • openssl to generate secrets.

Valkey and RustFS run inside the chart as a small-install default; objectStorage.server=versitygw runs VersityGW instead. For production the chart expects an S3-compatible store you operate (objectStorage.server=""); Valkey and PostgreSQL can be switched out the same way.

Install

Nine steps to the first sign-in.

  1. 1

    Install CloudNativePG

    The chart’s default database is a CloudNativePG Cluster, which needs the operator once per Kubernetes cluster. Install it as its project documents, for example with its Helm chart:

    sh
    helm repo add cnpg https://cloudnative-pg.github.io/charts
    helm upgrade --install cnpg cnpg/cloudnative-pg --namespace cnpg-system --create-namespace

    If the operator runs in a namespace other than cnpg-system, set networkPolicy.cnpgOperatorNamespace in step 5. To use a PostgreSQL server you already run instead, skip this step and see “External database, cache or object store” below.

  2. 2

    Get the chart

    Filescharts/entrivia/

    Clone the repository; the chart is the charts/entrivia directory. All later helm commands run from the repository’s root.

  3. 3

    Choose the images

    Filescharts/entrivia/values.yaml

    By default the chart pulls ghcr.io/entrivia/api, ghcr.io/entrivia/portal and ghcr.io/entrivia/guest at the chart’s appVersion. image.registry sets the registry for all three, api.image.repository and api.image.tag (and the same for portal and guest) the rest.

    Published images are not available yet. Until they are, build the three images from the repository’s root:

    sh
    docker build -f apps/api/Dockerfile    -t localhost/entrivia/api:local .
    docker build -f apps/portal/Dockerfile -t localhost/entrivia/portal:local .
    docker build -f apps/guest/Dockerfile  -t localhost/entrivia/guest:local .

    Then push them to a registry your cluster pulls from (set image.registry to it, and global.imagePullSecrets if it needs credentials), or import them on every node, for k3s:

    sh
    docker save localhost/entrivia/api:local localhost/entrivia/portal:local localhost/entrivia/guest:local \
      | sudo k3s ctr images import -

    and set the registry and the tag in your values (step 5):

    entrivia-values.yaml
    image:
      registry: localhost
    api:
      image:
        tag: local
    portal:
      image:
        tag: local
    guest:
      image:
        tag: local

    Do not pass VITE_API_BASE to the portal and guest builds; the install relies on same-origin API calls.

  4. 4

    Create the namespace and the Secrets

    Filescharts/entrivia/values.yaml

    The chart never generates or stores a secret: it reads them from Secrets you create and name in secrets.*.existingSecret. Create the namespace and three Secrets with generated values:

    sh
    kubectl create namespace entrivia
    
    kubectl -n entrivia create secret generic entrivia-app \
      --from-literal=JWT_SECRET="$(openssl rand -hex 64)" \
      --from-literal=ENCRYPTION_KEY="$(openssl rand -hex 32)"
    
    kubectl -n entrivia create secret generic entrivia-s3 \
      --from-literal=S3_ACCESS_KEY=entrivia \
      --from-literal=S3_SECRET_KEY="$(openssl rand -hex 32)"
    
    kubectl -n entrivia create secret generic entrivia-smtp \
      --from-literal=SMTP_USER='your-relay-user' \
      --from-literal=SMTP_PASSWORD='your-relay-password'

    Skip entrivia-smtp for a relay without authentication. Add --from-literal=METRICS_TOKEN="$(openssl rand -hex 32)" to entrivia-app if you turn on config.metricsEnabled. With the in-chart store, S3_ACCESS_KEY and S3_SECRET_KEY are its root credentials (the secret needs 8 or more characters); with your own store, they are its keys. The database password needs no Secret of yours: CloudNativePG generates it into entrivia-db-app.

    The Secrets may come from anywhere that produces them in the namespace (sealed-secrets, External Secrets, your vault); several existingSecret values may name the same Secret. Keep a copy of JWT_SECRET and ENCRYPTION_KEY outside the cluster: without ENCRYPTION_KEY, stored connector credentials cannot be decrypted. While you replace ENCRYPTION_KEY, entrivia-app also holds ENCRYPTION_KEY_PREVIOUS; see “Rotate the encryption key” below.

  5. 5

    Write your values

    Filescharts/entrivia/values.yaml

    Create entrivia-values.yaml outside the repository. It holds no secret, but it is yours:

    entrivia-values.yaml
    config:
      portalUrl: https://visitors.example.com
      guestUrl: https://visit.example.com
      s3Endpoint: https://files.example.com
      smtp:
        host: smtp.example.com
        port: 587
        from: no-reply@example.com
    
    secrets:
      app:
        existingSecret: entrivia-app
      s3:
        existingSecret: entrivia-s3
      smtp:
        existingSecret: entrivia-smtp
    
    ingress:
      className: traefik
    
    workspaceSetup:
      name: Example GmbH
      locale: de-DE
      timeZone: Europe/Berlin
      siteName: Berlin HQ
      siteCountry: DE
      ownerEmail: owner@example.com

    The three URLs carry https:// and no trailing slash; the Ingress takes its host names from them. Every emailed link is built from portalUrl and guestUrl. Choose portalUrl for good before anyone signs in: passkeys are bound to its host name, and changing it later makes every registered passkey unusable.

    workspaceSetup is the first run: company name, default language (en-US, de-DE or fr-FR), IANA time zone, first site and its two-letter country code, and the email of the first owner. The chart reads it once, on helm install; you may delete the block afterwards. config.connectors stays empty unless you use integrations (Slack, Teams, calendars).

  6. 6

    Arrange TLS

    Your ingress controller terminates TLS for the three hosts; how the certificate gets there is your choice. As an example only, with cert-manager and a ClusterIssuer named letsencrypt, add to your values:

    entrivia-values.yaml
    ingress:
      annotations:
        cert-manager.io/cluster-issuer: letsencrypt
      tls:
        - secretName: entrivia-tls
          hosts: [visitors.example.com, visit.example.com, files.example.com]

    With a certificate you already have, create a TLS Secret named entrivia-tls in the namespace and set only ingress.tls. The files host must accept request bodies of at least 25 MB (the largest upload); ingress-nginx needs nginx.ingress.kubernetes.io/proxy-body-size: 25m for that, Traefik accepts them by default. The controller must pass WebSocket upgrades on /graphql (live updates), which Traefik and ingress-nginx do by default.

  7. 7

    Install

    Filescharts/entrivia/templates/

    sh
    helm install entrivia ./charts/entrivia --namespace entrivia -f entrivia-values.yaml --timeout 15m

    A missing required value fails the command before anything is created, naming the value. Then the chart creates the workloads and runs two hooks, one after the other: the bucket Job creates the bucket in the in-chart store and allows the portal and guest origins to use it (CORS), and the workspace-setup Job migrates the database (if the API pod has not yet) and creates the workspace. helm install returns once both finished; the first install waits for CloudNativePG to create the database and for the images to pull, hence the longer timeout.

  8. 8

    Watch it come up

    In a second terminal while helm install runs, or afterwards:

    sh
    kubectl -n entrivia get pods -w                          # entrivia-api, -portal, -guest, -db-1, -valkey-0, -rustfs-0: Running
    kubectl -n entrivia logs deploy/entrivia-api -c migrate  # "Applied n migration(s)" or "The database is up to date."
    kubectl -n entrivia logs deploy/entrivia-api             # the API's log

    The API becomes ready once /readyz reaches PostgreSQL and Valkey. Until CloudNativePG has created the database, the migrate init container fails and is retried; that is expected for the first minute. If the API restarts right away, its log names the missing or invalid variable.

  9. 9

    First sign-in

    The workspace-setup Job ran as a post-install hook from your workspaceSetup.* values. It printed an accept link to its log, valid for 24 hours, and emailed it to the owner:

    sh
    kubectl -n entrivia logs job/entrivia-workspace-setup

    Whoever opens the link first becomes the owner, so keep it out of shared chats. Once the owner has it, delete the Job and its log (it deletes itself after a day):

    sh
    kubectl -n entrivia delete job entrivia-workspace-setup

    The owner opens the link, sets a password and lands in the portal at config.portalUrl, where onboarding continues. If the link expires or gets lost before it is accepted, issue a new one (the old one stops working; the new one is printed and emailed):

    sh
    kubectl -n entrivia exec deploy/entrivia-api -- dotnet Entrivia.Api.dll workspace:reissue-owner

    With workspaceSetup.enabled=false, create the workspace by hand instead; the command prints the same link:

    sh
    kubectl -n entrivia exec deploy/entrivia-api -- dotnet Entrivia.Api.dll workspace:setup \
      --name "Example GmbH" --locale de-DE --time-zone Europe/Berlin \
      --site-name "Berlin HQ" --site-country DE --owner-email owner@example.com

    Exit codes of workspace:setup: 0 done, 1 a workspace already exists (nothing changed; the hook Job treats this as done), 2 invalid input, 3 any other failure (nothing written, run it again).

Values

The values you always set.

Filescharts/entrivia/values.yamlcharts/entrivia/ci/

Your entrivia-values.yaml from step 5 carries these. Everything else has a default, values.schema.json rejects unknown keys and wrong types, and any other environment variable goes into api.extraEnv.

ValueRequiredExamplePurpose
config.portalUrlRequiredhttps://visitors.example.comPublic origin of the portal and the API. The Ingress takes the portal host from it.
config.guestUrlRequiredhttps://visit.example.comPublic origin of the guest UI. Both origins form the allowed CORS origins.
config.s3EndpointRequiredhttps://files.example.comPublic HTTPS origin of the object store; also the files host on the Ingress.
config.smtp.hostOptionalsmtp.example.comYour SMTP relay; without it no mail is delivered.
config.smtp.fromOptionalno-reply@example.comSender address on a domain you control.
secrets.app.existingSecretRequiredentrivia-appYour Secret with JWT_SECRET and ENCRYPTION_KEY, plus ENCRYPTION_KEY_PREVIOUS while you rotate the key.
secrets.s3.existingSecretRequiredentrivia-s3Your Secret with S3_ACCESS_KEY and S3_SECRET_KEY; the in-chart store’s root credentials.
secrets.smtp.existingSecretOptionalentrivia-smtpYour Secret with SMTP_USER and SMTP_PASSWORD; empty for a relay without authentication.
ingress.classNameOptionaltraefikThe IngressClass; empty for the cluster’s default.
ingress.tlsOptionalentrivia-tlsThe Ingress tls list, passed through.
workspaceSetup.*Requiredname, timeZone, siteName, …Company, language, time zone, first site and owner email for the post-install setup Job. Required on install.
Every value in the chart README

Upgrade

  1. Read the release notes of the new version.
  2. Back up (below).
  3. Set the new image tags (or a new chart version), then:
sh
helm upgrade entrivia ./charts/entrivia --namespace entrivia -f entrivia-values.yaml --timeout 15m

The API pod is replaced; its init container applies only the pending migrations, and running it on an up-to-date database is harmless. Migrations are forward-only: going back to an older version needs the backup taken before the upgrade. If a migration fails, the pod stays in Init:Error and kubectl -n entrivia logs deploy/entrivia-api -c migrate says why. A changed config value restarts the API on its own.

Suspend

--set suspended=true on helm upgrade scales every Deployment and StatefulSet to zero: nothing serves, nothing runs jobs. PersistentVolumeClaims, Secrets and the CloudNativePG cluster stay as they are; --set suspended=false resumes.

sh
helm upgrade entrivia ./charts/entrivia --namespace entrivia -f entrivia-values.yaml --set suspended=true

The database keeps running while suspended. To stop it too, use CloudNativePG’s hibernation:

sh
kubectl -n entrivia annotate cluster entrivia-db cnpg.io/hibernation=on

Back up

Back up three things. The database: with CloudNativePG, configure its backups (object store or volume snapshots) through postgresql.cnpg.extraSpec.backup and a ScheduledBackup in extraObjects, as the CloudNativePG backup documentation describes. The contents of the bucket, with any S3 tool (for example rclone sync). And the Secrets of step 4. Schedule, retention, encryption and where the copies go are your decisions.

A logical dump works for any setup:

sh
kubectl -n entrivia exec entrivia-db-1 -- pg_dump -Fc entrivia > entrivia.dump

Rotate the encryption key

ENCRYPTION_KEY encrypts the stored connector credentials, webhook signing secrets and the links in queued emails, and sanctions screening uses it for the hashes by which it recognises a visitor it has checked before. To replace the key without losing any of them:

  1. Back up (above) and keep the current entrivia-app Secret with that backup: the backup stays readable only with the current key.

  2. Generate a new key with openssl rand -hex 32. Put the current key into the entrivia-app Secret as ENCRYPTION_KEY_PREVIOUS and the new one as ENCRYPTION_KEY, then run kubectl -n entrivia rollout restart deploy/entrivia-api. The chart passes ENCRYPTION_KEY_PREVIOUS to the API whenever the Secret holds it. Everything keeps working: stored values open with either key, and new ones are encrypted with the new key.

  3. Encrypt every stored value again with the new key:

    sh
    kubectl -n entrivia exec deploy/entrivia-api -- dotnet Entrivia.Api.dll encryption:rotate

    The command prints how many values it rewrote of each kind and records encryption.rotated in the audit log. It is safe to run while Entrivia is in use, and safe to run again; a second run reports zeros.

  4. Exit code 0: remove ENCRYPTION_KEY_PREVIOUS from the Secret and restart the API again. Exit code 1: some values open with neither key and were left as they are; keep ENCRYPTION_KEY_PREVIOUS and check that it is the key the install used before. Exit code 2 means invalid input, 3 any other failure; run it again.

Two things in sanctions screening cannot move to the new key: a check whose guest details changed after it ran, and a false positive whose checks were already deleted at the end of their retention period. Once the previous key is gone, the next screening of that visitor asks the screening service again, and a reviewer may have to clear the same match once more. The details are in docs/env-reference.md.

Use an external database, cache or object store

PostgreSQL
Set postgresql.cnpg.enabled=false and name a Secret holding the URL in secrets.database.existingSecret (key DATABASE_URL, or another via secrets.database.key): postgres://user:password@host:5432/db, with parameters such as ?sslmode=require passed through. The database must be PostgreSQL 16 and empty on the first migrate. A CloudNativePG cluster you run yourself works the same way: name its <cluster>-app Secret and set secrets.database.key=uri.
Valkey or Redis
Set valkey.enabled=false and name a Secret holding REDIS_URL (redis://:password@host:6379) in secrets.valkey.existingSecret.
S3-compatible store
Set objectStorage.server=""; the Ingress then drops the files host. Set config.s3Endpoint to the store’s public HTTPS origin, config.s3Bucket to an existing bucket, config.s3Region, and config.s3ForcePathStyle=false for stores with per-bucket DNS names; secrets.s3.existingSecret holds the store’s keys. Browsers must reach the endpoint over HTTPS, and the store’s CORS rules must allow PUT and GET from the portal and guest origins.

Moving an existing install means copying the data first (a pg_dump and pg_restore, an rclone sync of the bucket); Valkey holds nothing that needs copying.

Uninstall

helm uninstall removes the workloads and keeps the data: the CloudNativePG cluster carries helm.sh/resource-policy: keep, and the Valkey and object store volumes outlive their StatefulSets. Delete them by hand when you mean it. kubectl delete namespace entrivia deletes everything, data included.

sh
helm uninstall entrivia --namespace entrivia

# only when you mean to delete the data:
kubectl -n entrivia delete cluster entrivia-db
kubectl -n entrivia delete pvc -l app.kubernetes.io/instance=entrivia

Troubleshooting

helm install fails with “… is required”
The named value is missing from your values file; nothing was created.
helm install times out on a hook
The first install waits for CloudNativePG and the image pulls. See kubectl -n entrivia get pods and the logs of the -bucket or -workspace-setup Job, then run helm upgrade with the same values once the cause is fixed. The workspace-setup hook runs only on install; create the workspace by hand as in step 9.
The API restarts with “… must be set in production”
The named key is missing from the Secret its value names. “JWT_SECRET is a public development secret” means a placeholder was used.
The API pod stays in Init:Error
See kubectl -n entrivia logs deploy/entrivia-api -c migrate. Exit code 1 means the database has Entrivia tables but no migration history; nothing was changed.
The pods wait in CreateContainerConfigError
A Secret or key they read does not exist yet. With CloudNativePG, entrivia-db-app appears once the cluster is created.
Photo uploads or images fail
config.s3Endpoint must be the public https:// origin of the files host, pods must reach it (kubectl -n entrivia exec deploy/entrivia-api -- getent hosts files.example.com), and the ingress must accept 25 MB bodies.
No email arrives
Check the API log for SMTP errors. Mail is sent by a background job, so the API keeps running.