Need an enterprise-grade solution? Infisical offers managed Agent Vault with enterprise support, SLAs, and advanced features.
Book a demo with us to learn more.
Overview
Agent Vault uses an embedded SQLite database by default, which requires no setup. For production deployments, or when running multiple instances, switch to PostgreSQL. With Postgres, every instance is stateless — no local volumes, no sticky sessions — so you can scale horizontally behind a load balancer. Each instance runs the full Agent Vault binary (API on port 14321 + MITM proxy on port 14322), connects to the same Postgres database, shares the same CA root certificate (stored encrypted in the database), and uses advisory locks to prevent conflicting writes. Put an L7 load balancer in front of the API and an L4 (TCP) load balancer in front of the proxy.Prerequisites
- PostgreSQL 13 or later. Any managed Postgres service (AWS RDS, Cloud SQL, Fly Postgres, Neon, Supabase) works.
- A connection URL:
postgres://user:password@host:5432/dbname. Append?sslmode=require(orverify-full) when the server requires TLS.
Configuration
SetDATABASE_URL as an environment variable (or pass --database-url to the server command).
Master password
All instances must share the sameAGENT_VAULT_MASTER_PASSWORD. This is not the database password — it protects the encryption key that encrypts your stored credentials at rest.
For production, generate a strong random value:
fly secrets set, etc.) and set it as AGENT_VAULT_MASTER_PASSWORD on all instances. To rotate it later, see master-password change.
Fresh setup
Create the database
Start Agent Vault
Migrating from SQLite
migrate-db copies all data from an existing SQLite installation to Postgres in a single transaction. The source database is not modified.
Preview the migration
Need an enterprise-grade solution? Infisical offers managed Agent Vault with enterprise support, SLAs, and advanced features.
Book a demo with us to learn more.
Example: Kubernetes
A minimal setup with two replicas. The MITM proxy terminates TLS itself, so it needs a Layer-4 (TCP) load balancer. The API/UI can sit behind a standard HTTP Ingress.agent-vault-deployment.yaml
Example: Docker Compose
Two replicas sharing a single Postgres container. In production, replace the Postgres container with a managed database.docker-compose.yml
The Docker Compose examples use
?sslmode=disable because the local Postgres container does not serve TLS. For production with managed Postgres, use ?sslmode=require or ?sslmode=verify-full.Architecture
- Stateless instances: No local volume is needed. Scale up or down freely. Schema migrations run on startup and are safe to run concurrently from multiple instances.
- CA sharing: The CA root key is stored in the database (encrypted by the DEK), so all instances share the same root certificate. Agents only need to trust one CA regardless of which instance they connect to.
- Advisory locks: Service-config writes acquire a Postgres advisory lock scoped to the vault, preventing concurrent writes from producing an inconsistent config. Reads are lock-free.
- Two listener types: The API (
:14321) is standard HTTP — put it behind an L7 load balancer with TLS termination. The MITM proxy (:14322) does its own TLS handshake with upstreams, so the load balancer must do TCP (L4) passthrough.
Need an enterprise-grade solution? Infisical offers managed Agent Vault with enterprise support, SLAs, and advanced features.
Book a demo with us to learn more.
Rollback
If you need to revert to a single-instance deployment:- Stop all Agent Vault instances.
- Remove
DATABASE_URLfrom the environment. - Restart with the original SQLite data directory mounted.
Operational notes
- Health checks:
GET /healthpings the Postgres connection and returns{"status":"ok"}or 503. Use this for load-balancer health probes and Kubernetes liveness/readiness checks. - Connection pooling: Each instance maintains its own connection pool (default: 25 max open, 10 idle, 5-minute lifetime). Tune per-instance with
DB_MAX_OPEN_CONNS,DB_MAX_IDLE_CONNS, andDB_CONN_MAX_LIFETIMEenvironment variables. For large deployments (10+ instances), consider placing PgBouncer between Agent Vault and Postgres to limit the aggregate connection count. - Rate limiting is per-instance, not cluster-wide. If you run 3 replicas with the default profile, effective cluster-wide limits are roughly 3x the per-instance values. Adjust
AGENT_VAULT_RATELIMIT_PROFILEif needed. - Background tickers (log retention, credential sync) run independently on every instance. They are idempotent, so duplicate work is harmless.
- Instance management: When running multiple instances, manage them through your container orchestrator (e.g.
kubectl,docker compose).agent-vault server stoponly affects the local process.

