# On-prem install: Helm and Docker Compose

> Run MoreVoice in your own data centre or cloud account: on Kubernetes with the Helm chart, or on one Linux server with Docker Compose. Requirements, install, the values reference, networking, upgrades, backups and support bundles.

An on-prem install is MoreVoice in your own environment: your data centre, your private cloud, your Kubernetes cluster. It runs the same software as the cloud service, for one organisation, licensed with a [licence key](https://docs.morevoice.ai/enterprise/licence/) that is checked offline. There are two ways to install it:

| | Kubernetes (Helm) | One server (Docker Compose) |
| --- | --- | --- |
| **For** | Sites that run Kubernetes | Small sites without Kubernetes |
| **Database** | Your Postgres 16, or a bundled one for evaluation | Bundled Postgres 16 |
| **Storage** | Your S3-compatible store, a bundled MinIO, or a volume | Bundled MinIO |
| **TLS** | Your ingress controller and cert-manager | Caddy: an internal CA, ACME, or your certificate |
| **Size** | About 2 vCPU and 4 GB per 10 AI calls at once | 4 vCPU, 8 GB and 100 GB SSD for about 20 AI calls at once |

> **Escrow the storage key first**
>
> Every recording and file is encrypted with the install's `STORAGE_KEY` before it is stored. Without it, nothing can be read again, by you or by us. Put a copy somewhere safe and offline the moment it is generated.

## Kubernetes with Helm

The chart runs one control pod (with its media workers inside it), a migration job, and optionally Postgres and MinIO. The control pod is one replica on purpose: live calls are held in its memory, so two replicas would split them.

### Before you install

| You need | Notes |
| --- | --- |
| Kubernetes 1.27 or later | One node is enough. |
| An ingress controller | ingress-nginx by default; its namespace must be allowed by the network policy. |
| cert-manager and an issuer | Your internal CA, or ACME when the host is public. Or turn cert-manager off and give a TLS secret. |
| A StorageClass | For the data volume and the bundled Postgres and MinIO. |
| Postgres 16 (production) | With the `vector` and `pg_trgm` extensions created by a DBA. |
| The images | Mirror them into your registry and pin the app image by digest. |
| A licence | Issued by MoreVoice for this install's deployment ID. |

The namespace must meet the `restricted` Pod Security Standard, which every pod of the chart does:

```sh
kubectl create namespace morevoice
kubectl label namespace morevoice pod-security.kubernetes.io/enforce=restricted pod-security.kubernetes.io/warn=restricted
```

### Install

1. **Create the secrets yourself**, so they never pass through Helm values or your shell history, and escrow them:

   ```sh
   kubectl -n morevoice create secret generic morevoice-app \
     --from-literal=APP_SECRET="$(openssl rand -hex 32)" --from-literal=STORAGE_KEY="$(openssl rand -hex 32)" \
     --from-literal=METRICS_TOKEN="$(openssl rand -hex 16)" --from-literal=SETUP_TOKEN="$(openssl rand -hex 16)" \
     --from-literal=OPENAI_KEY=… --from-literal=GEMINI_KEY=… --from-literal=SONIOX_KEY=…
   kubectl -n morevoice create secret generic morevoice-db --from-literal=DATABASE_URL='postgres://morevoice:…@pg.example.internal:5432/morevoice'
   kubectl -n morevoice create secret generic morevoice-licence --from-file=licence.jwt=./licence.jwt
   ```

2. **Write your values**, with the deployment ID your licence names:

   ```yaml title="values-prod.yaml"
   publicUrl: https://voice.example.internal
   deployment: { id: acme-prod }
   image: { digest: sha256:… }
   global: { imageRegistry: registry.example.internal/mirror }
   secrets: { existingSecret: morevoice-app }
   licence: { existingSecret: morevoice-licence }
   postgres:
     bundled: { enabled: false }
     external: { existingSecret: morevoice-db, sslMode: verify-full }
   objectStorage:
     bucket: morevoice
     external: { enabled: true, endpoint: https://s3.example.internal, existingSecret: morevoice-s3, pathStyle: true }
   ingress: { certManager: { clusterIssuer: internal-ca } }
   ```

3. **Install and test:**

   ```sh
   helm install morevoice ./morevoice -n morevoice -f values-prod.yaml
   kubectl -n morevoice rollout status deploy/morevoice-control --timeout=15m
   helm test morevoice -n morevoice
   ```

4. **Create the first admin.** Open `publicUrl` and enter the setup token; the chart's notes print the command that reads it.

For a quick evaluation, `helm install morevoice ./morevoice -n morevoice --set publicUrl=https://… --set-file licence.token=licence.jwt` uses the bundled Postgres and generates the secrets, keeping them across upgrades and after an uninstall. Escrow `STORAGE_KEY` from the generated secret at once.

### Network

Every pod is covered by a network policy that denies everything except what MoreVoice needs: the ingress controller to the app, the app to the database and storage, DNS, and outbound HTTPS to the AI providers (turn that off for an air-gapped site, and allow your on-site AI endpoints instead). Add your SMTP relay and SIP carriers under `egress.extra`. The app answers only its own host names.

### Values

Chart `morevoice` version `0.1.0`, for MoreVoice `0.1.0`, on Kubernetes `>=1.27.0-0`. `values.schema.json` validates every value, so a typo fails `helm install` instead of being ignored.

| Value | Default | What it sets |
| --- | --- | --- |
| `global` | — | — |
| `global.imageRegistry` | `""` | A registry mirror for EVERY image of the chart (app, Postgres, MinIO, mc), e.g. "registry.bank.local/mirror". The image's own registry is replaced; its repository path is kept. |
| `global.imagePullSecrets` | `[]` | Pull secrets for private registries / mirrors: [{name: regcred}]. |
| `image` | — | — |
| `image.registry` | `ghcr.io` | The app image: ghcr.io/<owner>/morevoice:<tag>. |
| `image.repository` | `meni1904/morevoice` | — |
| `image.tag` | `""` | Default: v<Chart.appVersion>. Prefer a digest in production (it wins over the tag). |
| `image.digest` | `""` | — |
| `image.pullPolicy` | `IfNotPresent` | — |
| `publicUrl` | `https://morevoice.example.com` | The URL people and carriers' webhooks reach the install at (PUBLIC_URL). The ingress host defaults to its host. CHANGE IT: the placeholder only exists so `helm lint` renders. |
| `deployment` | — | — |
| `deployment.mode` | `onprem` | DEPLOYMENT_MODE. onprem: the single-org lockdown (no sign-up, no org switcher, manual billing). |
| `deployment.id` | `""` | DEPLOYMENT_ID: the fleet id the licence is bound to (a DNS label). Default: the Helm release name. |
| `deployment.singleOrgId` | `00000000-0000-0000-0000-000000000001` | SINGLE_ORG_ID: the install's one org. Must be org #1 today. |
| `appEnv` | `production` | APP_ENV: production (secrets required, fails closed) \| staging. |
| `trustProxy` | `"10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,127.0.0.1"` | TRUST_PROXY: the hops whose X-Forwarded-For / -Proto / -Host the app believes. The ingress controller's pods are in the cluster's pod range; the NetworkPolicy admits only the controller (networkPolicy.ingressFrom). |
| `hostGuard` | `true` | HOST_GUARD: 421 for any Host that is not PUBLIC_URL's, the pod's own IP or the Service's names (probes and in-cluster scrapes keep working). PUBLIC_HOSTS gets publicHosts on top. |
| `publicHosts` | `[]` | — |
| `control` | — | One replica, strategy Recreate: the live-call registry is in this process's memory and the media workers are forked inside the pod, so two pods would split calls (HA is a warm-standby design, not replicas). |
| `control.workers` | `2` | WORKERS: media worker processes forked inside the pod. |
| `control.jobs` | `true` | JOBS=1: background jobs (dialer, retention, reports …) run here; the install has no other node. |
| `control.terminationGracePeriodSeconds` | `1800` | Seconds Kubernetes waits after asking the pod to stop: the preStop drain waits for live calls to end until 30 s before this. Size it to the longest calls you expect; a call still running at the end is cut. |
| `control.drain` | — | — |
| `control.resources` | — | — |
| `control.readOnlyRootFilesystem` | `true` | Root filesystem read-only; /tmp, the node user's home and /run/morevoice are emptyDirs, /data is the volume. |
| `control.hostNetwork` | `false` | The node's network for the control pod. media.enabled with media.webrtc.mode=hostNetwork turns it on; set it by hand only for a custom media setup. |
| `control.probes` | — | — |
| `control.nodeSelector` | `{}` | — |
| `control.tolerations` | `[]` | — |
| `control.affinity` | `{}` | — |
| `control.podAnnotations` | `{}` | — |
| `control.podLabels` | `{}` | — |
| `control.priorityClassName` | `""` | — |
| `control.extraEnv` | `[]` | Extra environment: [{name: LOG_LEVEL, value: debug}] and envFrom sources ([{secretRef: {name: x}}]). |
| `control.extraEnvFrom` | `[]` | — |
| `sip` | — | SIP and WebRTC settings the app reads (the ports are only reachable with media networking, `media` below). |
| `sip.register` | `false` | SIP_REGISTER: register to the carrier (1 only when this install owns the trunk). |
| `sip.localPort` | `5070` | — |
| `sip.publicIp` | `""` | SIP_PUBLIC_IP. Empty: media.externalIp when media is on. |
| `webrtc` | — | — |
| `webrtc.portMin` | `41000` | — |
| `webrtc.portMax` | `44999` | — |
| `media` | — | Phone calls (SIP + RTP between carriers and FreeSWITCH) and browser calls (WebRTC between browsers and the control pod's media workers) are UDP port ranges, which Kubernetes Services carry poorly. Media therefore runs on the HOST network of a labelled media node, as docker/compose.linux.yml does on a VM: FreeSWITCH (a StatefulSet) and the control pod on the same node, ESL, SIP and RTP between them on loopback. The namespace needs the `privileged` Pod Security level (host network, a host path). Off (default): the install serves the API and UI only; no call media. |
| `media.enabled` | `false` | — |
| `media.nodeSelector` | — | The media node(s). Label one: kubectl label node <node> morevoice.ai/media=true. FreeSWITCH and the control pod run on the same one (the control pod follows FreeSWITCH). |
| `media.tolerations` | `[]` | For media nodes tainted to keep other workloads off: [{key: morevoice.ai/media, operator: Exists, effect: NoSchedule}] |
| `media.externalIp` | `""` | The address carriers and browsers reach the media node at: SIP_PUBLIC_IP, FreeSWITCH's carrier-side SDP / Contact address and the WebRTC ICE candidate (WEBRTC_PUBLIC_IP). Set it when the node is behind NAT (its public / VIP address). Empty: the node's own addresses (hostNetwork), or its InternalIP (nodePort). |
| `media.webrtc` | — | — |
| `media.freeswitch` | — | — |
| `secrets` | — | APP_SECRET, METRICS_TOKEN, STORAGE_KEY and SETUP_TOKEN. Either an existing Secret with exactly these keys (and optionally OPENAI_KEY, GEMINI_KEY, SONIOX_KEY), or generated once by the chart and kept across upgrades (lookup + resource-policy keep). ESCROW STORAGE_KEY: every stored file is encrypted with it and cannot be read without it. |
| `secrets.existingSecret` | `""` | — |
| `secrets.appSecret` | `""` | — |
| `secrets.metricsToken` | `""` | — |
| `secrets.storageKey` | `""` | — |
| `secrets.setupToken` | `""` | The first admin's setup token (the setup screen asks for it once; dead after the first admin exists). |
| `providers` | — | AI providers (ignored when secrets.existingSecret holds them). loadMock: every provider mocked (test installs only). |
| `providers.openaiKey` | `""` | — |
| `providers.geminiKey` | `""` | — |
| `providers.sonioxKey` | `""` | — |
| `providers.loadMock` | `false` | — |
| `licence` | — | The licence token MoreVoice issues for this install, mounted read-only at /etc/morevoice/licence/<key> (LICENCE_FILE). Either the token itself (a Secret is made) or an existing Secret holding it. |
| `licence.existingSecret` | `""` | — |
| `licence.key` | `licence.jwt` | — |
| `licence.token` | `""` | — |
| `licence.revocations` | `""` | [WS08] W4-07 the signed licence revocation list MoreVoice ships with an update (revocations.jwt), mounted next to the licence. Optional: every image also carries the list current at its release. With existingSecret, add the list to that Secret under the key revocations.jwt and set revocationsInExistingSecret: true. |
| `licence.revocationsInExistingSecret` | `false` | — |
| `postgres` | — | Postgres 16+ with the vector and pg_trgm extensions. The bundled one is on by default so a first install works out of the box; production installs set bundled.enabled=false and external.url (or external.existingSecret). |
| `postgres.external` | — | — |
| `postgres.bundled` | — | A single Postgres pod for small or evaluation installs (pgvector image, no TLS inside the namespace, the NetworkPolicy admits only this release's pods). Production: the bank's managed Postgres (external). |
| `objectStorage` | — | Recordings, IVR audio and KB originals (encrypted by the app with STORAGE_KEY before upload). Neither configured: files stay on the control pod's /data volume. |
| `objectStorage.bucket` | `morevoice` | — |
| `objectStorage.prefix` | `""` | STORAGE_PREFIX inside the bucket ("" = the bucket is this install's alone). |
| `objectStorage.external` | — | — |
| `objectStorage.minio` | — | A single MinIO pod (MinIO publishes source only; the default image is the community build the repo's testbed uses; mirror and pin it). The chart creates the bucket and a bucket-scoped app user (files/minio-init.sh). |
| `persistence` | — | /data on the control pod: recordings before upload, the phrase cache, FreeSWITCH runtime config. |
| `persistence.enabled` | `true` | — |
| `persistence.size` | `50Gi` | — |
| `persistence.storageClass` | `""` | — |
| `persistence.accessModes` | — | — |
| `persistence.existingClaim` | `""` | — |
| `service` | — | — |
| `service.type` | `ClusterIP` | — |
| `service.port` | `80` | — |
| `service.annotations` | `{}` | — |
| `ingress` | — | — |
| `ingress.enabled` | `true` | — |
| `ingress.className` | `nginx` | — |
| `ingress.host` | `""` | Default: publicUrl's host. |
| `ingress.annotations` | `{}` | — |
| `ingress.tls` | — | — |
| `ingress.certManager` | — | — |
| `networkPolicy` | — | — |
| `networkPolicy.enabled` | `true` | — |
| `networkPolicy.ingressFrom` | — | Who may reach the app on 8787: the ingress controller's namespace (and this release's own pods). |
| `networkPolicy.metricsFrom` | `[]` | Prometheus (or another scraper) namespace for /metrics: [{namespaceSelector: …}]. |
| `networkPolicy.nodeCidrs` | `[]` | [WS08] W4-16 the nodes' address range(s), e.g. [10.0.0.0/24]. Required when the control pod runs on the host network (media hostNetwork mode) with the bundled Postgres or MinIO: a host-network pod's connections carry the node's address, which no podSelector matches, so their policies admit these CIDRs. |
| `networkPolicy.egress` | — | — |
| `airgap` | — | AIRGAP=1: the app refuses every outbound connection and DNS lookup except loopback and EGRESS_ALLOW (counted in airgap_egress_refused_total and logged), turns telemetry off (Sentry, analytics, status heartbeat), and refuses to start while a configured endpoint or a cloud AI key points outside the allowlist. The bundled Postgres / MinIO Services are allowed for you; list the rest: the self-hosted AI servers, the SMTP relay, an external database or S3 (host[:port], *.domain[:port], an IP or a CIDR). The chart refuses airgap with networkPolicy.egress.allowHttpsToInternet. |
| `airgap.enabled` | `false` | — |
| `airgap.egressAllow` | `[]` | — |
| `serviceAccount` | — | — |
| `serviceAccount.create` | `true` | — |
| `serviceAccount.name` | `""` | — |
| `serviceAccount.annotations` | `{}` | — |
| `supportBundle` | — | — |
| `supportBundle.enabled` | `true` | FLAG_SUPPORT_BUNDLE=1: GET /api/admin/support-bundle for the org's owners/admins, with the log tail. |
| `supportBundle.publicKey` | `""` | SUPPORT_BUNDLE_PUBKEY: the X25519 public key bundles are sealed to (default: the key compiled into the app). |
| `migrations` | — | — |
| `migrations.hook` | — | A pre-upgrade hook Job runs the NEW image's migrations (build/server/migrate.js) while the old pod still serves (migrations are expand-only); the control pod's init container runs them on install and every start (a no-op once applied). |
| `migrations.onStart` | `true` | — |
| `tests` | — | A `helm test` pod that checks /api/health through the Service. |
| `tests.enabled` | `true` | — |

## One server with Docker Compose

The Compose bundle installs everything on one Ubuntu server (24.04, or 22.04), x86-64 or arm64: the app, Postgres with pgvector, MinIO, FreeSWITCH for SIP trunks and Caddy for HTTPS. From a clean server to the first call takes about 30 minutes.

1. **Docker.** Install Docker Engine and the Compose plugin (2.20 or later) from Docker's repository, or from the `.deb` files of the release bundle on an offline site.

2. **The bundle and the images.** Copy the `compose` directory to `/opt/morevoice/compose`. Online, log in to the registry with the read-only token we give you; offline, `docker load -i morevoice-images.tar` from the release bundle.

3. **Licence and settings.** Put the licence in `licence/licence.jwt` and run the installer. It writes `.env` (mode 0600) with fresh secrets, and never rotates a secret that is already there:

   ```sh
   sudo install -m 0640 /path/to/licence.jwt licence/licence.jwt
   sudo ./install.sh --url https://voice.example.internal --deployment-id acme --tls internal
   # behind NAT: --public-ip 203.0.113.7 · your certificate: --tls own · Let's Encrypt: --tls ops@example.com
   ```

   Then add the AI provider keys to `.env`, and **escrow `.env`**, above all `STORAGE_KEY`.

4. **Firewall.** Open only these:

   | Port | From | For |
   | --- | --- | --- |
   | 80, 443/tcp | your users | the web app, the API and WebSockets |
   | 41000–44999/udp | your users | browser call audio (WebRTC) |
   | 5097/udp | your SIP carrier only | SIP trunks through FreeSWITCH |
   | 40000–40999/udp | your SIP carrier's media | RTP through FreeSWITCH |

   Postgres, MinIO, the app's own port and the admin interfaces listen on 127.0.0.1 only.

5. **Start** with `sudo docker compose up -d`. The one-time services check the settings, prepare the directories and run the migrations; then `curl -s http://127.0.0.1:8787/api/health/ready` answers `{"ready":true,…}`.

6. **First admin and first call.** Open the URL, create the first admin with the setup token, connect a trunk and call in.

## Upgrades

Upgrade in a maintenance window. Both installs drain first: the app stops taking new calls and waits for the calls in progress to end (up to the time you allow), then the new version migrates the database and starts. Database changes only ever add, so the previous version still runs on the new schema, and rolling back is a matter of starting the previous image.

**Helm**

```sh
helm upgrade morevoice ./morevoice -n morevoice -f values-prod.yaml   # migrates with the new image, then drains and switches
helm rollback morevoice <revision> -n morevoice                       # back to the previous image
```

**Docker Compose**

```sh
sudo docker compose exec app node /opt/morevoice/drain.mjs      # refuse new calls, wait for live calls to end
sudo sed -i 's#^MV_APP_IMAGE=.*#MV_APP_IMAGE=<new image>#' .env
sudo docker compose up -d                                       # migrate, then start the new app
```

## Backups

Back up the database every night (`pg_dump`, or your database team's own backups for an external Postgres), the object storage (its objects are already encrypted) and the secrets (`.env`, or the Kubernetes secrets). Test a restore before you need one.

## Support bundles

When something goes wrong, an owner or admin can download a support bundle from the app (`/api/admin/support-bundle`), or produce one from the logs when the app is down. It holds no database rows, no secrets, no phone numbers, e-mail addresses or transcripts, and can be sealed so that only MoreVoice's support can open it. Send it to us with your ticket.
