> For the complete documentation index, see [llms.txt](https://docs.zerve.ai/self-managed/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zerve.ai/self-managed/configuration/postgres.md).

# Postgres

Zerve uses [Postgres](https://www.postgresql.org/) (version 16+) as its primary database. Several deployment options are supported.

## Bundled Postgres

The chart can install Postgres on your cluster for you. It is meant for evaluation and testing only: a single replica, with no high availability, backups or TLS.

Setting `postgres.enabled: true` creates the database, but the services still read `POSTGRES_*` from their own environment and secrets. The chart ships a values file with that wiring already in place, so layer it on top of your own values and keep it last:

```
helm upgrade --install zerve . -f my-values.yaml -f examples/bundled-postgres.yaml
```

Besides enabling Postgres, it points every service at the bundled instance and defers the migration Jobs to `post-install`/`post-upgrade`, so they don't run before the database exists.

For production, we recommend an external Postgres managed outside the cluster. Fully managed services such as AWS RDS and Aurora are supported.

## External Postgres

The most common setup is a single database host with one logical database per Zerve service. It requires the following values in the Helm chart:

```yaml
# my-values.yaml
global:
  workload:
    common:
      secrets:
        POSTGRES_PASSWORD:
          secretName: zerve-creds
          key: db_password                        # optional, defaults to POSTGRES_PASSWORD
      env:
        POSTGRES_HOST: "postgres.acme.internal"
        POSTGRES_USERNAME: "zerve"
        POSTGRES_PORT: 5432                       # optional
```

Values under `global` propagate to all backend workloads.

Create the four databases on the host before installing. Each service defaults `POSTGRES_DB` to its own name — `asset_service`, `canvas_service`, `executor_service` and `user_service` — so no service needs `POSTGRES_DB` set unless you name the databases differently.

Organizations running mission-critical workloads that require higher availability may prefer a dedicated database host per Zerve service. Zerve has four independent backend services, each of which can be pointed at its own host:

```yaml
# my-values.yaml
asset:
  workloads:
    common:
      secrets:
        POSTGRES_PASSWORD:
          secretName: zerve-asset-creds
          key: db_password
      env:
        POSTGRES_HOST: "asset-postgres.acme.internal"
        POSTGRES_USERNAME: "zerve"

user:
  workloads:
    common:
      secrets:
        POSTGRES_PASSWORD:
          secretName: zerve-user-creds
          key: db_password
      env:
        POSTGRES_HOST: "user-postgres.acme.internal"
        POSTGRES_USERNAME: "zerve"

executor:
  workloads:
    common:
      secrets:
        POSTGRES_PASSWORD:
          secretName: zerve-executor-creds
          key: db_password
      env:
        POSTGRES_HOST: "executor-postgres.acme.internal"
        POSTGRES_USERNAME: "zerve"

canvas:
  workloads:
    common:
      secrets:
        POSTGRES_PASSWORD:
          secretName: zerve-canvas-creds
          key: db_password
      env:
        POSTGRES_HOST: "canvas-postgres.acme.internal"
        POSTGRES_USERNAME: "zerve"
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.zerve.ai/self-managed/configuration/postgres.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
