ManyLayers ships as one container image holding four services and a database tool. Run the gateway close to your applications for the lowest latency and to keep prompts inside your network; run Workspace beside it for the console and admin API.
You only need this page to run your own installation. On ManyLayers Cloud the gateway is already running at https://app.manylayers.io/v1 and the console at https://app.manylayers.io. In a self-hosted install those addresses are your own: expose the gateway (port 8180) and the workspace (port 8190) on hostnames you control, and use them wherever the docs show the hosted ones.

How it works

The gateway, workspace and deployer also serve /health, /healthz, /ready, /readyz, /version and /metrics; the worker serves /health, /ready and /metrics (its /ready is 503 until its consumers attach). All services read the same config file and the same PostgreSQL database.

Run it

The repository has three stacks in infra/docker/, each one compose file plus one env file:
make prod-deploy runs pull, migrate, start and health check in one step. Pin IMAGE_TAG to a real tag rather than latest. Put the gateway behind your TLS ingress or load balancer; keep Workspace and Deployer on a private network or behind a VPN. For local development run make dev-migrate then make dev-up.
No service migrates the schema on startup. Run dbtool migrate (the compose migrate job) before starting or upgrading, so several gateway replicas never race on a migration.
The Helm chart under infra/helm deploys only the gateway and predates the three-service split, so it does not install Workspace or Deployer. For Kubernetes, translate the production compose file: a Deployment per service, the env file as a Secret, the config file as a ConfigMap, and the migrate job as a Kubernetes Job.

Health and readiness

Never point liveness at /ready: a database blip would restart healthy replicas. The image has no shell or curl, so container health checks run the binary itself — /gateway -readycheck (or -healthcheck) probes its own port over loopback and exits 0 or 1. /workspace and /deployer take the same flags.

Graceful shutdown

On SIGTERM each service:
  1. Marks itself draining — /ready returns 503, /health stays 200.
  2. Keeps serving for SHUTDOWN_DRAIN_DELAY (default 0s) so load balancers stop sending new requests.
  3. Stops accepting connections and lets in-flight requests finish for up to SHUTDOWN_TIMEOUT (default 20s; YAML server.shutdown_timeout). If the deadline passes it logs shutdown deadline exceeded and exits non-zero.
Set SHUTDOWN_DRAIN_DELAY to 5–10s behind a real load balancer or in Kubernetes, and keep your orchestrator’s grace period above SHUTDOWN_DRAIN_DELAY + SHUTDOWN_TIMEOUT (the production compose file uses stop_grace_period: 40s).

Scaling

  • Gateway: add replicas behind a load balancer; they hold no local state. Configure Redis so rate limits, budgets and the exact cache are shared — without it each replica enforces limits independently.
  • One Redis: run a single Redis (or one logical cluster). Several independent Redis instances would each keep their own limiter state, multiplying every caller’s limit.
  • Workspace and Deployer: one instance each; Workspace runs the workflow, connector, billing and sweep workers.
  • Credential key: set MANYLAYERS_ENCRYPTION_KEY explicitly. Without it each service generates data/credentials.key locally, and replicas cannot read each other’s stored provider keys. In the production compose stack the root filesystem is read-only, so nothing can be generated: pasted provider keys are refused (encryption_not_configured) until the variable is set (make env-files generates one).

Environment variables

Environment variables override the config file. Inside the file, ${VAR}, ${VAR:-default} and ${vault:secret/data/path#key} are expanded at load time. The shipped container config (configs/gateway.container.yaml) also reads these through ${…} references:

Container config overrides

The baked-in configs/gateway.container.yaml overrides several built-in defaults, so an installation from the image will not see the values printed on Routing and Caching:

Next steps

Metrics

Scrape /metrics on every replica.

gateway.yaml reference

Every config key the services read.

Caching

Share the cache across replicas with Redis.

Request Logging & Audit

Retention and body capture for your deployment.