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).
| Host | Path | Forward to |
|---|---|---|
| visitors.example.comPortal | /auth/*/graphql/v1/*/g/*/webhooks/* | svc/entrivia-apiAPI |
| visitors.example.comPortal | everything else | svc/entrivia-portalPortal |
| visit.example.comGuest UI | /graphql/v1/*/g/* | svc/entrivia-apiAPI |
| visit.example.comGuest UI | everything else | svc/entrivia-guestGuest UI |
| files.example.comFiles | everything | svc/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
kubectlandhelmconfigured 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 setnetworkPolicy.enabled=falseknowingly. - Three DNS names pointing at the ingress. This guide uses
visitors.example.comfor the portal,visit.example.comfor the guest UI andfiles.example.comfor 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.
opensslto 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
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:shhelm repo add cnpg https://cloudnative-pg.github.io/charts helm upgrade --install cnpg cnpg/cloudnative-pg --namespace cnpg-system --create-namespaceIf the operator runs in a namespace other than
cnpg-system, setnetworkPolicy.cnpgOperatorNamespacein step 5. To use a PostgreSQL server you already run instead, skip this step and see “External database, cache or object store” below. - 2
Get the chart
Filescharts/entrivia/
Clone the repository; the chart is the
charts/entriviadirectory. All laterhelmcommands run from the repository’s root. - 3
Choose the images
Filescharts/entrivia/values.yaml
By default the chart pulls
ghcr.io/entrivia/api,ghcr.io/entrivia/portalandghcr.io/entrivia/guestat the chart’sappVersion.image.registrysets the registry for all three,api.image.repositoryandapi.image.tag(and the same forportalandguest) the rest.Published images are not available yet. Until they are, build the three images from the repository’s root:
shdocker 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.registryto it, andglobal.imagePullSecretsif it needs credentials), or import them on every node, for k3s:shdocker 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.yamlimage: registry: localhost api: image: tag: local portal: image: tag: local guest: image: tag: localDo not pass
VITE_API_BASEto the portal and guest builds; the install relies on same-origin API calls. - 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:shkubectl 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-smtpfor a relay without authentication. Add--from-literal=METRICS_TOKEN="$(openssl rand -hex 32)"toentrivia-appif you turn onconfig.metricsEnabled. With the in-chart store,S3_ACCESS_KEYandS3_SECRET_KEYare 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 intoentrivia-db-app.The Secrets may come from anywhere that produces them in the namespace (sealed-secrets, External Secrets, your vault); several
existingSecretvalues may name the same Secret. Keep a copy ofJWT_SECRETandENCRYPTION_KEYoutside the cluster: withoutENCRYPTION_KEY, stored connector credentials cannot be decrypted. While you replaceENCRYPTION_KEY,entrivia-appalso holdsENCRYPTION_KEY_PREVIOUS; see “Rotate the encryption key” below. - 5
Write your values
Filescharts/entrivia/values.yaml
Create
entrivia-values.yamloutside the repository. It holds no secret, but it is yours:entrivia-values.yamlconfig: 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.comThe three URLs carry
https://and no trailing slash; the Ingress takes its host names from them. Every emailed link is built fromportalUrlandguestUrl. ChooseportalUrlfor good before anyone signs in: passkeys are bound to its host name, and changing it later makes every registered passkey unusable.workspaceSetupis the first run: company name, default language (en-US,de-DEorfr-FR), IANA time zone, first site and its two-letter country code, and the email of the first owner. The chart reads it once, onhelm install; you may delete the block afterwards.config.connectorsstays empty unless you use integrations (Slack, Teams, calendars). - 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.yamlingress: 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-tlsin the namespace and set onlyingress.tls. The files host must accept request bodies of at least 25 MB (the largest upload); ingress-nginx needsnginx.ingress.kubernetes.io/proxy-body-size: 25mfor 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
Install
Filescharts/entrivia/templates/
shhelm install entrivia ./charts/entrivia --namespace entrivia -f entrivia-values.yaml --timeout 15mA 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 installreturns once both finished; the first install waits for CloudNativePG to create the database and for the images to pull, hence the longer timeout. - 8
Watch it come up
In a second terminal while
helm installruns, or afterwards:shkubectl -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 logThe API becomes ready once
/readyzreaches PostgreSQL and Valkey. Until CloudNativePG has created the database, themigrateinit 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
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:shkubectl -n entrivia logs job/entrivia-workspace-setupWhoever 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):
shkubectl -n entrivia delete job entrivia-workspace-setupThe 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):shkubectl -n entrivia exec deploy/entrivia-api -- dotnet Entrivia.Api.dll workspace:reissue-ownerWith
workspaceSetup.enabled=false, create the workspace by hand instead; the command prints the same link:shkubectl -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.comExit codes of
workspace:setup:0done,1a workspace already exists (nothing changed; the hook Job treats this as done),2invalid input,3any 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.
| Value | Required | Example | Purpose |
|---|---|---|---|
config.portalUrl | Required | https://visitors.example.com | Public origin of the portal and the API. The Ingress takes the portal host from it. |
config.guestUrl | Required | https://visit.example.com | Public origin of the guest UI. Both origins form the allowed CORS origins. |
config.s3Endpoint | Required | https://files.example.com | Public HTTPS origin of the object store; also the files host on the Ingress. |
config.smtp.host | Optional | smtp.example.com | Your SMTP relay; without it no mail is delivered. |
config.smtp.from | Optional | no-reply@example.com | Sender address on a domain you control. |
secrets.app.existingSecret | Required | entrivia-app | Your Secret with JWT_SECRET and ENCRYPTION_KEY, plus ENCRYPTION_KEY_PREVIOUS while you rotate the key. |
secrets.s3.existingSecret | Required | entrivia-s3 | Your Secret with S3_ACCESS_KEY and S3_SECRET_KEY; the in-chart store’s root credentials. |
secrets.smtp.existingSecret | Optional | entrivia-smtp | Your Secret with SMTP_USER and SMTP_PASSWORD; empty for a relay without authentication. |
ingress.className | Optional | traefik | The IngressClass; empty for the cluster’s default. |
ingress.tls | Optional | entrivia-tls | The Ingress tls list, passed through. |
workspaceSetup.* | Required | name, timeZone, siteName, … | Company, language, time zone, first site and owner email for the post-install setup Job. Required on install. |
Upgrade
- Read the release notes of the new version.
- Back up (below).
- Set the new image tags (or a new chart version), then:
helm upgrade entrivia ./charts/entrivia --namespace entrivia -f entrivia-values.yaml --timeout 15mThe 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.
helm upgrade entrivia ./charts/entrivia --namespace entrivia -f entrivia-values.yaml --set suspended=trueThe database keeps running while suspended. To stop it too, use CloudNativePG’s hibernation:
kubectl -n entrivia annotate cluster entrivia-db cnpg.io/hibernation=onBack 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:
kubectl -n entrivia exec entrivia-db-1 -- pg_dump -Fc entrivia > entrivia.dumpRotate 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:
Back up (above) and keep the current
entrivia-appSecret with that backup: the backup stays readable only with the current key.Generate a new key with
openssl rand -hex 32. Put the current key into theentrivia-appSecret asENCRYPTION_KEY_PREVIOUSand the new one asENCRYPTION_KEY, then runkubectl -n entrivia rollout restart deploy/entrivia-api. The chart passesENCRYPTION_KEY_PREVIOUSto 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.Encrypt every stored value again with the new key:
shkubectl -n entrivia exec deploy/entrivia-api -- dotnet Entrivia.Api.dll encryption:rotateThe command prints how many values it rewrote of each kind and records
encryption.rotatedin the audit log. It is safe to run while Entrivia is in use, and safe to run again; a second run reports zeros.Exit code
0: removeENCRYPTION_KEY_PREVIOUSfrom the Secret and restart the API again. Exit code1: some values open with neither key and were left as they are; keepENCRYPTION_KEY_PREVIOUSand check that it is the key the install used before. Exit code2means invalid input,3any 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=falseand name a Secret holding the URL insecrets.database.existingSecret(keyDATABASE_URL, or another viasecrets.database.key):postgres://user:password@host:5432/db, with parameters such as?sslmode=requirepassed through. The database must be PostgreSQL 16 and empty on the firstmigrate. A CloudNativePG cluster you run yourself works the same way: name its<cluster>-appSecret and setsecrets.database.key=uri. - Valkey or Redis
- Set
valkey.enabled=falseand name a Secret holdingREDIS_URL(redis://:password@host:6379) insecrets.valkey.existingSecret. - S3-compatible store
- Set
objectStorage.server=""; the Ingress then drops the files host. Setconfig.s3Endpointto the store’s public HTTPS origin,config.s3Bucketto an existing bucket,config.s3Region, andconfig.s3ForcePathStyle=falsefor stores with per-bucket DNS names;secrets.s3.existingSecretholds the store’s keys. Browsers must reach the endpoint over HTTPS, and the store’s CORS rules must allowPUTandGETfrom 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.
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=entriviaTroubleshooting
helm installfails with “… is required”- The named value is missing from your values file; nothing was created.
helm installtimes out on a hook- The first install waits for CloudNativePG and the image pulls. See
kubectl -n entrivia get podsand the logs of the-bucketor-workspace-setupJob, then runhelm upgradewith 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-appappears once the cluster is created. - Photo uploads or images fail
config.s3Endpointmust be the publichttps://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.