Skip to main content
Run the Mnemom Gateway on your own infrastructure for full data residency control. Prompt and response content is never sent to Mnemom’s cloud, though prompts are forwarded to your configured LLM providers — see Data residency for exact traffic boundaries. The self-hosted gateway is a Node.js adapter that runs the same code as the managed Cloudflare Workers service — identical behavior, your infrastructure.
Self-hosted deployment requires an Enterprise license. Contact us to obtain a license key. Enterprise includes hybrid analysis mode, SSO/SAML integration, and dedicated support.

Deployment options

Prerequisites

  • An Enterprise license JWT from mnemom.ai/dashboard
  • An Anthropic API key (required for AIP integrity analysis)
  • Optional: OpenAI and Gemini API keys for multi-provider tracing
AIP defaults to fail-open mode. If the analysis LLM is unreachable, integrity checks will silently pass. For production deployments handling sensitive operations, set failure_policy: { mode: "fail_closed" } in your AIP configuration.

Quick start: Docker compose

The fastest way to get a self-hosted gateway running. Includes PostgreSQL, Redis, and automatic database migrations.

Requirements

  • Docker 24+ and Docker Compose v2+
  • 2 GB RAM minimum, 4 GB recommended
  • 10 GB disk space
1

Clone the repository

2

Configure environment

Copy the example environment file and fill in your credentials:
Edit .env and set the required values:
If your .env.example shows SMOLTBOT_ROLE, rename it to MNEMOM_ROLE — the file carries a stale branding name but the entrypoint reads MNEMOM_ROLE.
3

Start the stack

This starts four services in order:
  1. PostgreSQL — database with health check
  2. Redis — caching layer with persistence
  3. Gateway — HTTP proxy on port 8787 (applies database migrations on startup)
  4. Observer — background scheduler for trace processing
4

Verify health

Wait about 30 seconds, then check the gateway health:
Expected response
5

Connect an agent

Point the mnemom CLI at your self-hosted gateway:
Make a test request:
If you configured OPENAI_API_KEY, the same gateway serves OpenAI at the /openai path:
And Gemini at the /gemini path, if you configured GEMINI_API_KEY:
Verify the agent is connected:

Production: Kubernetes with Helm

For production deployments with auto-scaling, high availability, and monitoring.

Requirements

  • Kubernetes 1.27+
  • Helm 3.12+
  • kubectl configured for your cluster
1

Add the Helm chart

2

Create a Kubernetes Secret

Store sensitive credentials in a Secret:
3

Install the chart

4

Verify the deployment

What the chart deploys

  • Gateway Deployment (2 replicas by default) — HTTP proxy with liveness, readiness, and startup probes
  • Observer Deployment (1 replica) — background scheduler for trace processing
  • Migration Job — Helm pre-install/pre-upgrade hook that applies database migrations
  • Service — ClusterIP on port 8787
  • NetworkPolicy — deny-all default with explicit allows for ingress, Redis, PostgreSQL, and upstream LLM APIs
  • PodDisruptionBudget — ensures at least 1 replica during rolling updates
  • Optional: Ingress with TLS, HPA, ServiceMonitor for Prometheus

Scaling

Enable the HorizontalPodAutoscaler for automatic scaling:

Architecture

In self-hosted mode, a Node.js adapter layer replaces Cloudflare-specific APIs while running the exact same gateway code:
Adaptation layer — zero modifications to gateway source code:

Data residency

Prompt and response content is never sent to Mnemom’s cloud. However, prompts are forwarded to your configured LLM providers — see the table below for exact traffic boundaries. Traces, integrity checkpoints, and all prompt/response content remain in your database and are never sent to Mnemom’s cloud.

Configuration reference

Required

Optional: Providers

Optional: Hybrid analysis

In hybrid mode, only thinking/reasoning blocks are sent for analysis — raw prompts and responses never leave your infrastructure.

Optional: Infrastructure


Health endpoints

Three Kubernetes-standard probes:

Prometheus metrics

The gateway exposes a /metrics endpoint with:
  • gateway_requests_total{provider,status} — request counter
  • gateway_request_duration_seconds{provider} — latency histogram
  • gateway_aip_checks_total{verdict} — integrity check counter
  • gateway_cache_operations_total{operation,result} — cache hit/miss
  • Standard process_* and nodejs_* metrics
For Kubernetes, enable the ServiceMonitor in values.yaml:

Upgrading

Docker compose

Migrations run automatically as part of the gateway startup.

Helm

The migration job runs as a pre-upgrade Helm hook.
Always back up your database before upgrading. For Docker: docker compose exec postgres pg_dump -U mnemom mnemom > backup.sql. For Kubernetes: use your standard PostgreSQL backup procedure.

Troubleshooting

A required environment variable is missing. Check the error message for which variable, then verify your .env file or Kubernetes Secret.
  • Docker Compose: ensure the redis service is healthy (docker compose ps)
  • Kubernetes: verify REDIS_URL in your Secret points to a reachable Redis instance
  • Without Redis, the gateway falls back to in-memory KV (single-node only)
  • Verify MNEMOM_LICENSE_JWT is set and not expired
  • Check /health/ready for the specific license error
  • Contact [email protected] for license reissuance
  • Verify your API keys are correct and have sufficient credits
  • The gateway proxies directly to provider APIs — ensure outbound HTTPS (port 443) is allowed
  • In Kubernetes, check the NetworkPolicy allows egress to 0.0.0.0/0:443
  • Increase container memory limits (512Mi minimum, 1Gi recommended for high traffic)
  • If using in-memory KV, switch to Redis to reduce memory pressure
  • Set NODE_OPTIONS=--max-old-space-size=768 for fine-grained heap control

Next steps