NHI Security is a separate set of services from TRUSTIVAN AppSec: its own API, its own console and its own PostgreSQL database. You deploy it in one of two shapes. Beside AppSec, it has no hostname of its own: the AppSec dashboard proxies /nhi to it and TRUSTIVAN signs people in. Standalone, it brings its own TLS edge and its own password sign-in.
NHI Security has not been deployed to production. The deployment files on this page ship in the repository under nhi/deploy/. The standalone Compose shape has been run only in local containers and the Kubernetes manifests only against a local k3s cluster. No certificate has been issued through the shipped edge configuration, and deploy.sh has not been run on a remote host. Treat every standalone procedure here as unproven until you have run it yourself, and read what is not proven first.

What you run

The browser only ever talks to the console’s origin. The console forwards /nhi/api/* to the API’s /api/*, so the session cookie stays first-party and the API needs no public address. That is why these docs spell one route two ways: /api/v1/findings is the route as the API serves it, and /nhi/api/v1/findings is the same route as a browser or a script reaches it through the console’s origin. internal and data are internal Docker networks: the edge cannot reach the API or the database, and the console cannot reach the database. The api and web containers run with a read-only root filesystem, no-new-privileges, and memory, CPU and process limits. The defaults suit a host with 4 vCPU and 8 GB of memory; the variables that change them are in the configuration reference.

Three database connections

NHI Security uses three PostgreSQL roles, and the split is what makes organization isolation enforceable:

Choose a sign-in mode

AUTH_MODE decides who signs people in. Set the same value on both the api and the web service: the API needs it to authenticate requests, and the console needs it to know where to send someone with no session. In trustivan mode a state-changing request must carry an X-CSRF-Token header equal to the trustivan_csrf cookie, and must come from an origin listed in CORS_ALLOWED_ORIGINS. If TRUSTIVAN cannot be reached, errors or times out, the request is refused. An earlier answer is never reused in its place. Overview describes what the user experiences.

Run it beside TRUSTIVAN AppSec

This is the shape https://app.trustivan.com/nhi describes: one origin, one session, two consoles. It uses the same Compose file as the standalone shape with an overlay, infra/docker/nhi.override.yml, that changes three things: the api and web services join the Docker network the AppSec containers share (trustivan-public, which must already exist), both are put into trustivan mode, and scheduled discovery is turned off.
1

Point the dashboard at the NHI Security console

The AppSec dashboard proxies /nhi and everything under it to the address in NHI_WEB_URL. Left empty (the default), the dashboard is built without NHI Security: it hides the NHI Security switch and /nhi says NHI Security is not enabled on this deployment. The value is read when the dashboard is built, so changing it means rebuilding the dashboard image, not restarting it.
2

Write the environment file

Copy nhi/deploy/.env.production.example, fill it in as described in the configuration reference, and add the overlay’s own variables:
Set PUBLIC_ORIGIN to the address people open the dashboard at. The API accepts state-changing requests only from that origin. NHI_WEB_URL in the previous step must name the console by NHI_WEB_ALIAS and port 3100.
3

Build the images from the repository root

Both Dockerfiles (nhi/deploy/docker/api.Dockerfile, nhi/deploy/docker/web.Dockerfile) expect the repository root as their build context, which is how the Compose file builds them.
4

Start four services by name

Name the services. A bare up -d also starts caddy, which publishes ports 80 and 443 and collides with whatever already terminates TLS for the dashboard.
If you run two NHI Security stacks on one Docker network, never address either by its Compose service name. Both register api and web, and Docker’s DNS returns either one. That is what the two aliases are for.
If signed-in people see an error on /nhi and GET /nhi/api/v1/auth/session answers 503 with reason: identity_provider_unavailable, NHI Security cannot reach TRUSTIVAN_API_ORIGIN, usually because a redeploy took the AppSec API container off the shared Docker network. Every container still reports healthy. Reconnect it with docker network connect. infra/scripts/smoke.sh fails a deploy in this state, and infra/scripts/edge-reconcile.sh reattaches the container if you run it on a timer.
For evaluation on one machine, the repository’s root docker-compose.yml already includes the four NHI Security services in trustivan mode (make docker-up), with the API on 127.0.0.1:4000 and the console on 127.0.0.1:3100. See Install with Docker Compose for the AppSec side.

Run it standalone

Standalone, NHI Security serves https://<your domain>/nhi from its own Caddy edge and signs people in itself.
1

Prepare the host

Install Docker with the Compose plugin. Point your domain at the host’s public address before the first start: Caddy proves control of the domain to the certificate authority on ports 80 and 443, and a domain that does not resolve yet fails issuance.
2

Write the environment file

Fill in PUBLIC_DOMAIN, PUBLIC_ORIGIN, TLS_EMAIL, the three database passwords and CREDENTIAL_ENCRYPTION_KEY. APP_ENV must be production or staging. Every variable is described in the configuration reference.
3

Deploy

deploy/scripts/deploy.sh checks the environment file, builds both images from the working tree, starts PostgreSQL, applies migrations, starts the API, then the console, then Caddy, and waits until GET /api/v1/readyz reports ready. If migrations fail, nothing is restarted and the running version is untouched. --no-build starts images that are already built or pulled.
4

Create the first platform operator

The command prints a generated password once and stores only its verifier. It refuses to run once any operator exists. The operator then provisions your organization and invites its first administrator: see Platform operators.
deploy/caddy/Caddyfile still health-checks the console at /sign-in. The console serves its pages under /nhi, and its own container health check asks for /nhi/platform/sign-in. Confirm that the edge reports the console healthy on your build, and correct health_uri if it does not, before you rely on this shape.

Kubernetes

nhi/deploy/kubernetes/ holds Kustomize manifests for the same topology: a base (namespace, API, console, Caddy, a migration Job and default-deny NetworkPolicies), an in-cluster PostgreSQL component with a backup CronJob, and local and production overlays. make k8s-validate renders every overlay offline and holds it to the deployment’s invariants, and make k8s-deploy OVERLAY=production validates, applies, waits for migrations and verifies from inside the Pods. Two constraints are enforced by that validation rather than left to convention: the production overlay must name both images by digest (a tag or :latest is refused), and the API must run exactly one replica. There is no Helm chart, and no Kubernetes equivalent of restore.sh.

Health checks

Both routes are unauthenticated, so an orchestrator can call them.

Back up and restore

The scripts in nhi/deploy/scripts/ read deploy/.env.production themselves. Each has a make target. Three things to plan for:
  • Nothing schedules any of this. No cron entry or timer ships. Until you install one, no backup is taken and nothing notices.
  • A backup is plaintext unless you set BACKUP_PUBLIC_KEY. It is an age recipient (a public key). When set, backup.sh encrypts the dump, checks the result and removes the plaintext; the host then holds nothing that can read its own backups. When unset, the script says so on every run. Restoring an encrypted dump needs BACKUP_IDENTITY_FILE.
  • A dump does not contain CREDENTIAL_ENCRYPTION_KEY. Stored connector credentials are in the dump as ciphertext. Back the key up separately, somewhere the database backup is not. A restore onto a host with a different key completes, and every stored credential in it is unreadable.

What is not proven

  • No standalone deployment has run on a public host. Certificate issuance, the HSTS edge and deploy.sh on a remote machine are untested.
  • The Kubernetes path has run against one local, single-node k3s cluster and no other.
  • deploy.sh builds from the working tree. Running a published image through it is a manual procedure: set IMAGE_API and IMAGE_WEB, pull, then run with --no-build. That procedure has not been exercised.
  • postgres:16-alpine and caddy:2-alpine are not pinned in the Compose file, and deploy.sh never pulls them.
  • Remediation execution cannot be switched on from the environment file. docker-compose.prod.yml does not pass REMEDIATION_EXECUTION_ENABLED to the API, so it stays off unless you edit the Compose file as well. See Remediation.
  • The API runs as one replica. The rate limiter counts per process, so a second replica would double every client’s ceiling, and scheduled discovery runs inside the same process. See Discovery and synchronization.

Next steps

Configuration reference

Every environment variable, its default, and what refuses to start.

Platform operators

Create the first operator and provision an organization.

Administration

Users, teams, roles and organization settings.

Limitations

What NHI Security does not do today.