Services & Databases
Eve services follow Docker Compose conventions with Eve-specific extensions for ingress, roles, managed databases, and storage. This guide covers every aspect of service configuration — from basic container definitions through platform-managed databases and persistent volumes.
Service basics
Each key under services in your manifest defines a named service. At minimum, a service needs either an image to pull or a build context to build from:
services:
api:
build:
context: ./apps/api
image: acme-api
ports: [3000]
environment:
NODE_ENV: production
x-eve:
ingress:
public: true # declare ingress on every service with ports
port: 3000
When both build and image are present, Eve builds the image from the context and pushes it to the registry using the image value as the tag. When only image is present, Eve pulls the image directly.
Build configuration
The build block defines how to build the container image:
services:
api:
build:
context: ./apps/api # Build context path (relative to repo root)
dockerfile: Dockerfile.prod # Optional: defaults to Dockerfile
args: # Optional: build arguments
NODE_VERSION: "20"
image: acme-api
If a service has build but no image field and a usable registry is configured, Eve automatically derives the image name from the service name. Explicitly setting image is still recommended for clarity.
Environment variables
Environment variables are declared as a key-value map. Values support secret interpolation and platform variables:
services:
api:
environment:
NODE_ENV: production
DATABASE_URL: postgres://app:${secret.DB_PASSWORD}@db:5432/app
LOG_LEVEL: info
Eve also injects platform variables (EVE_API_URL, EVE_PROJECT_ID, EVE_ENV_NAME, etc.) automatically into every deployed service. You can override any injected variable by declaring it explicitly.
Ports
Ports follow Docker Compose conventions. You can specify them as numbers or strings:
ports: [3000] # Container port only
ports: ["3000:3000"] # host:container mapping
ports: [3000, 8080] # Multiple ports
Declare an x-eve.ingress block on every service that lists ports: public: true for services reached from outside, public: false for internal ones.
A service with ports and no x-eve.ingress block is public under the audit security profile but private under strict, where it gets no Ingress and the ingress controller cannot reach it. Do not rely on the default.
HTTP ingress tuning
App HTTP ingresses support portable tuning fields under x-eve.ingress:
services:
api:
ports: [3000]
x-eve:
ingress:
public: true
port: 3000
timeout: 600s
max_body_size: 50m
timeout controls request/response timeout and max_body_size controls upload size. On nginx-backed clusters, Eve renders the native ingress annotations for the default host, alias, and custom domains. Other controllers keep routing unchanged; eve env diagnose <project> <env> --json reports .http_ingress[] with requested and effective values.
Use these knobs for long-running HTTP requests and larger uploads. For batch work that can exceed 30 minutes, prefer an Eve job plus polling endpoint.
Public TCP listeners
Use x-eve.tcp_ingress when a service needs public raw TCP, such as device protocols that cannot speak HTTP:
services:
device-edge:
ports: [33400, 33500]
x-eve:
ingress:
public: false # no HTTP ingress for a raw TCP service
tcp_ingress:
listeners:
- name: a1-gt06
port: 33400
- name: mictrack-mt700
port: 33500
The deployer keeps the normal ClusterIP service for in-cluster traffic and creates a sibling public LoadBalancer service for the TCP listeners. eve env diagnose reports listener state, host, provider, and port; eve tcp-ingress test <project> <env> --listener <name> opens a TCP probe from your machine.
Public TCP listeners are not admitted under the strict security profile, because they reach the pods through a load balancer rather than the ingress controller.
Health checks
Health checks tell Eve when a service is ready to receive traffic. They use the standard Docker Compose format:
services:
api:
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
| Field | Default | Description |
|---|---|---|
test | — | Command to run. Array form (["CMD", ...]) or string |
interval | — | Time between checks (e.g., 10s, 30s) |
timeout | — | Maximum time for a single check |
retries | 3 | Consecutive failures before marking unhealthy |
start_period | — | Grace period before health checks begin |
For database services, use the engine's built-in readiness tool:
services:
db:
image: postgres:16
healthcheck:
test: ["CMD", "pg_isready", "-U", "app"]
interval: 5s
timeout: 3s
retries: 5
Always define health checks for services that other services depend on. Without a health check, condition: service_healthy dependencies cannot be satisfied.
Service dependencies and ordering
Use depends_on to declare startup ordering between services:
services:
api:
depends_on:
db:
condition: service_healthy
cache:
condition: service_started
Two conditions are supported:
| Condition | Also accepted as | Behavior |
|---|---|---|
service_started | started | Wait until the container starts |
service_healthy | healthy | Wait until the health check passes |
Dependencies form a directed acyclic graph. Eve resolves the graph and starts services in the correct order. Circular dependencies are rejected at validation time.
The following diagram shows how dependencies control startup ordering for a typical web application:
Eve service roles
The x-eve.role field determines how Eve treats a service at deploy time:
| Role | Description |
|---|---|
component | Default. Long-running service deployed to Kubernetes |
worker | Worker pool service (uses worker_type for routing) |
job | One-off task — migrations, seed scripts, cleanup. Not deployed as a long-running service |
managed_db | Platform-provisioned database. Not deployed to Kubernetes |
Component (default)
The default role. Services without an explicit role are treated as long-running components:
services:
api:
build:
context: ./apps/api
ports: [3000]
x-eve:
role: component # Optional — this is the default
ingress:
public: false # internal; use true for services reached from outside
Worker
Worker services participate in a worker pool. Specify worker_type to route work appropriately:
services:
processor:
build:
context: ./apps/processor
x-eve:
role: worker
worker_type: default
Environments can configure worker pools with replica counts:
environments:
staging:
workers:
- type: default
service: processor
replicas: 2
Job
Job services run as one-off tasks. They are not deployed as persistent containers — instead, they are executed on demand by pipeline steps or CLI commands:
services:
migrate:
image: ghcr.io/eve-horizon/eve-horizon/migrate:0.1.332
environment:
DATABASE_URL: ${managed.db.url}
MIGRATIONS_DIR: /migrations
depends_on:
db:
condition: service_healthy
x-eve:
role: job
files:
- source: db/migrations
target: /migrations
Job services may use the database owner URL (${managed.db.url}); long-running services should use a declared role (see Database roles).
Reference job services from pipeline steps using the job action type:
pipelines:
deploy:
steps:
- name: migrate
action: { type: job, service: migrate }
- name: deploy
depends_on: [migrate]
action: { type: deploy }
Recommended migration pattern (Eve-native)
For the simplest setup, use ghcr.io/eve-horizon/eve-horizon/migrate:0.1.332 as a role: job service:
services:
migrate:
image: ghcr.io/eve-horizon/eve-horizon/migrate:0.1.332
environment:
DATABASE_URL: ${managed.db.url}
MIGRATIONS_DIR: /migrations
x-eve:
role: job
files:
- source: db/migrations
target: /migrations
Migration file conventions:
- Keep SQL files in
db/migrations/ - Use
YYYYMMDDHHmmss_description.sqlnaming - Regex pattern:
^(\d{14})_([a-z0-9_]+)\.sql$ - One migration file per logical migration (may contain multiple SQL statements)
Eve migration behavior:
- Tracks applied migrations in
schema_migrations(name,checksum,applied_at) - Re-runs with
ROLLBACKsafety for failed scripts - Auto-creates
pgcryptoanduuid-ossp - Auto-baseline when the database already contains existing schema objects
Local development example
For docker-compose workflows:
services:
migrate:
image: ghcr.io/eve-horizon/eve-horizon/migrate:0.1.332
environment:
DATABASE_URL: postgres://app:app@db:5432/myapp
volumes:
- ./db/migrations:/migrations:ro
depends_on:
db:
condition: service_healthy
db:
image: postgres:16
environment:
POSTGRES_USER: app
POSTGRES_PASSWORD: app
POSTGRES_DB: myapp
healthcheck:
test: ["CMD", "pg_isready", "-U", "app"]
interval: 5s
timeout: 3s
retries: 5
docker compose run --rm migrate # Apply migrations
docker compose down -v && docker compose up -d db && docker compose run --rm migrate
You can still run a BYO migration tool if your org requires it, but the Eve-migrate container is the recommended default for documentation parity.
Managed databases
For production workloads, use Eve's managed database provisioning instead of running your own Postgres container. Managed databases are declared as services with x-eve.role: managed_db:
services:
db:
x-eve:
role: managed_db
managed:
class: db.p1
engine: postgres
engine_version: "16"
roles:
- name: app
grants: readwrite
Configuration fields
| Field | Description |
|---|---|
class | Database tier — db.p1 (small), db.p2 (medium), db.p3 (large) |
engine | Database engine — currently only postgres is supported |
engine_version | Engine version string (e.g., "16") |
roles | Optional least-privilege logins for app services (see Database roles) |
Provisioning lifecycle
Managed databases are provisioned when you deploy an environment for the first time. They are not rendered into Kubernetes manifests — the platform handles provisioning, credentials, and networking separately.
The lifecycle flow looks like this:
Credentials and connection
The platform manages credentials automatically. Other services can reference managed database values using interpolation placeholders:
services:
api:
environment:
DATABASE_URL: ${managed.db.roles.app.url} # a declared role
migrate:
environment:
DATABASE_URL: ${managed.db.url} # the owner, for migration jobs
These placeholders are resolved at deploy time when the managed database is available. ${managed.db.url} and ${managed.db.password} are the owner's credential; host, port, database and username are also available, and roles.<name>.url, .username and .password for each declared role.
Database roles
Every managed database has one owner login. roles declares extra logins for your app services:
grants | What the role gets |
|---|---|
readwrite | Read and write on tables and sequences in public, including tables the owner creates later. Cannot create objects. |
readonly | Read on the same. Cannot create objects. |
{ schema: <name>, owner: true } | Owns one schema: it can create, change and drop objects there, and gets no grants of its own in public (from 0.1.330). |
roles:
- name: app
grants: readwrite
- name: auth
grants: { schema: auth, owner: true }
- Run migrations for
publicas arole: jobservice with the owner URL. Give a component that runs its own migrations in its own schema, such as an auth server, a schema-owner role instead of the owner credential. - Role names match
^[a-z][a-z0-9_]{0,15}$; a database declares at most 8 roles. Roles added later are created on the next deploy, and removed roles are dropped. eve db rotate-credentialsrotates every role's password with the owner's.- Roles need the local managed database provider.
Under the strict security profile, a long-running service whose environment, command or entrypoint reads ${managed.<db>.url} or ${managed.<db>.password} is refused at deploy. Use a declared role's URL in long-running services, and keep the owner credential for role: job services.
Connection limits
Each managed database accepts only its own logins. Each login gets its class's connection limit unless it already has one: 25 for db.p1, 100 for db.p2 and 200 for db.p3. Size each service's connection pool within its login's limit, and scale the class with eve db scale when you need more. See Database Operations for how the database-wide limit works.
Managing your database
Use the eve db CLI commands to interact with managed databases:
# Check provisioning status
eve db status --env staging
# View the current schema
eve db schema --env staging
# Run a read-only query
eve db sql --env staging --sql "SELECT count(*) FROM users"
# Run a write query (requires --write flag)
eve db sql --env staging --sql "UPDATE settings SET value='v2'" --write
# Run SQL from a file
eve db sql --env staging --file ./scripts/seed.sql
# Run migrations
eve db migrate --env staging --path db/migrations
# List applied migrations
eve db migrations --env staging
# Create a new migration file
eve db new create_users_table --path db/migrations
Migration files follow the naming convention YYYYMMDDHHmmss_description.sql and live under db/migrations/ by default.
Scaling and maintenance
# Scale to a larger tier
eve db scale --env staging --class db.p2
# Rotate database credentials
eve db rotate-credentials --env staging
# Destroy the managed database (irreversible)
eve db destroy --env staging --force
eve db destroy permanently deletes the managed database and all its data. This action cannot be undone. Always ensure you have a backup before running this command.
Persistent storage
For services that need to persist data across container restarts (without using a managed database), attach a persistent volume with x-eve.storage:
services:
minio:
image: minio/minio:latest
ports: [9000]
x-eve:
ingress:
public: false
storage:
mount_path: /data
size: 50Gi
access_mode: ReadWriteOnce
storage_class: standard
| Field | Description |
|---|---|
mount_path | Absolute path inside the container |
size | Volume size (e.g., 10Gi, 50Gi) |
access_mode | ReadWriteOnce, ReadWriteMany, or ReadOnlyMany |
storage_class | Kubernetes storage class name |
Persistent volumes survive container restarts but are scoped to the environment. Deleting an environment removes its volumes.
File mounts
Mount files from your repository directly into a container using x-eve.files:
services:
nginx:
image: nginx:alpine
x-eve:
files:
- source: ./config/nginx.conf
target: /etc/nginx/nginx.conf
- source: ./config/certs/
target: /etc/nginx/certs/
| Field | Description |
|---|---|
source | Relative path in the repository |
target | Absolute path in the container |
File mounts are read from the repository at the deployed git SHA, ensuring the container always receives the version of the file that matches the deployed code.
Private endpoints
Some services live outside your cluster — a GPU machine on your office network, an LM Studio instance on a Mac Mini, an internal API behind a VPN. Eve's private endpoints make these Tailscale-connected services accessible to every pod in the cluster without sidecars, proxies, or per-pod networking configuration.
How it works
Private endpoints use the Tailscale Kubernetes Operator to create an egress proxy in a dedicated eve-tunnels namespace. Eve manages the K8s ExternalName Service that bridges cluster DNS to the tailnet device. Your apps connect using a stable, predictable in-cluster URL — no Tailscale configuration needed in application code.
Every private endpoint gets a DNS name following this pattern:
http://<orgSlug>-<name>.eve-tunnels.svc.cluster.local:<port>
This URL works from app pods, agent runtime pods, and worker runner pods alike.
Registering an endpoint
Use the eve endpoint CLI to register a private endpoint backed by a Tailscale device:
# Register a private endpoint
eve endpoint add \
--name lmstudio \
--tailscale-hostname mac-mini.tail12345.ts.net \
--port 1234
# List registered endpoints
eve endpoint list
# Show endpoint details and connectivity status
eve endpoint show lmstudio
# Run diagnostics
eve endpoint diagnose lmstudio
# Remove an endpoint
eve endpoint remove lmstudio
On success, eve endpoint add prints the in-cluster URL. The endpoint is org-scoped — names must be DNS-safe and are unique per organization.
Connecting your services
Wire the endpoint URL into your services via secrets. This follows the standard BYOK (bring your own key) pattern — Eve provides the connectivity, you configure the environment variables:
# Store the endpoint URL as a secret
eve secrets set LLM_BASE_URL \
"http://myorg-lmstudio.eve-tunnels.svc.cluster.local:1234/v1" \
--scope project
# Store any auth keys the service requires
eve secrets set LLM_API_KEY "your-api-key" --scope project
Then reference the secrets in your manifest:
services:
api:
environment:
LLM_BASE_URL: ${secret.LLM_BASE_URL}
LLM_API_KEY: ${secret.LLM_API_KEY}
Your application code uses these environment variables directly — no Eve-specific SDK or client is needed:
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: process.env.LLM_BASE_URL,
apiKey: process.env.LLM_API_KEY,
});
Prerequisites
The Tailscale Kubernetes Operator must be installed in the cluster before eve endpoint add can create tunnel services. The command checks for the operator and fails with guidance if it is not found. Operator installation is a one-time infrastructure task — see your cluster administrator or the Tailscale operator docs for setup.
For local k3d development where the host machine is already on the tailnet, k3d containers can often route to Tailscale IPs directly via Docker bridge networking. In this case you can skip the operator and set the Tailscale IP in your secrets with eve secrets set. Validate connectivity with kubectl run curl --image=curlimages/curl --rm -it -- curl http://100.x.x.x:1234/v1/models before relying on this shortcut.
External services
Mark a service as external when it represents a dependency that Eve should not deploy — such as a third-party API or a database hosted elsewhere:
services:
stripe:
x-eve:
external: true
url: https://api.stripe.com
legacy-db:
x-eve:
external: true
url: postgres://user:pass@legacy-host:5432/mydb
External services appear in the dependency graph and can be referenced by other services, but Eve skips them during deployment. This is useful for documenting the full system topology in a single manifest.
API spec registration
Register your service's API specification so Eve can discover and catalog it:
services:
api:
x-eve:
api_spec:
type: openapi
spec_url: /openapi.json
Supported spec types:
| Type | Default spec URL | Description |
|---|---|---|
openapi | /openapi.json | OpenAPI / Swagger specification |
postgrest | / | PostgREST auto-generated API |
graphql | /graphql | GraphQL schema introspection |
When on_deploy is true (the default), Eve fetches the spec after each deployment and registers it for agent discovery. Set auth: "none" if the spec endpoint does not require Eve authentication.
For services with multiple APIs, use api_specs instead:
services:
api:
x-eve:
api_specs:
- type: openapi
spec_url: /v1/openapi.json
name: v1
- type: openapi
spec_url: /v2/openapi.json
name: v2
Environment overrides for services
Environments can override service configuration without changing the base definitions. This lets you keep a single service block while varying behavior per environment:
services:
api:
build:
context: ./apps/api
image: acme-api
ports: [3000]
environment:
NODE_ENV: production
LOG_LEVEL: info
x-eve:
ingress: { public: true, port: 3000 }
environments:
staging:
pipeline: deploy
overrides:
services:
api:
environment:
NODE_ENV: staging
LOG_LEVEL: debug
production:
pipeline: deploy
Overrides are merged with the base service configuration at deploy time. Only the specified fields are overridden — unmentioned fields retain their base values. This pattern is especially useful for tuning resource limits, log levels, or feature flags per environment without duplicating your entire service definition.
Putting it all together
Here is a complete services block for a typical fullstack application with a managed database, an API server, a web frontend, and a migration job:
services:
db:
x-eve:
role: managed_db
managed:
class: db.p1
engine: postgres
engine_version: "16"
roles:
- name: app
grants: readwrite
api:
build:
context: ./apps/api # Dockerfile sets a numeric USER, e.g. USER 1000:1000
image: acme-api
ports: [3000]
environment:
DATABASE_URL: ${managed.db.roles.app.url}
NODE_ENV: production
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 10s
timeout: 5s
retries: 3
x-eve:
ingress:
public: true
port: 3000
api_spec:
type: openapi
spec_url: /openapi.json
web:
build:
context: ./apps/web
image: acme-web
ports: [8080] # a non-root web server listens on a port >= 1024
depends_on:
api:
condition: service_healthy
x-eve:
ingress:
public: true
port: 8080
migrate:
image: ghcr.io/eve-horizon/eve-horizon/migrate:0.1.332
environment:
DATABASE_URL: ${managed.db.url}
MIGRATIONS_DIR: /migrations
depends_on:
db:
condition: service_healthy
x-eve:
role: job
files:
- source: db/migrations
target: /migrations
This configuration gives you a managed Postgres database provisioned by the platform, an API with public ingress and OpenAPI discovery that connects as a declared role, a web frontend, and a migration job that runs before deployments via pipeline steps. All secrets and managed connection strings are resolved at deploy time, and, with numeric non-root users in the API and web images, the same block deploys under the strict security profile.
What's next?
- Wire up your build pipeline: Pipelines & CI/CD
- Manage deploy targets: Environments & Promotion
- See the full service schema: Manifest Schema