# Configuration

> Environment variables, connection pools, limits and startup options.

---

LLMS index: [llms.txt](/llms.txt)

---

Set `SILO_PG_DSN` to enable the PostgreSQL backend. In PostgreSQL mode, `silo server` takes no filesystem directory arguments. Alternatively, pass a single `postgres://` or `postgresql://` URI on the command line. Do not combine both methods or add disk paths. For systemd services, store `SILO_PG_DSN` in a protected environment file so database passwords do not appear in process arguments.

## PostgreSQL backend variables {#pg-settings}

| Variable | Default | Range and semantics |
| --- | --- | --- |
| `SILO_PG_DSN` | None | Direct connection to PostgreSQL 16+ as a trusted ordinary database owner |
| `SILO_PG_READ_ONLY` | `off` | `on` enforces read-only gateway mode; skips initialization, schema migration, and background maintenance |
| `SILO_PG_MAX_CONNS` | `32` | Total database connection budget per gateway (`5`–`1024`) |
| `SILO_PG_CONTROL_CONNS` | `4` | Control-plane connection pool (`1`–`64`) |
| `SILO_PG_COORD_CONNS` | `2` | Coordination pool (`2`–`64`), including the dedicated revision `LISTEN` connection |
| `SILO_PG_SEGMENT_SIZE` | `8MiB` | Segment size (`1MiB`–`64MiB`), persisted in the database at initial setup |
| `SILO_PG_MAX_OBJECT_SIZE` | `256MiB` | Maximum object size (`1MiB`–`1GiB`), persisted at initial setup; applies to single PUT, copy, and completed multipart objects |
| `SILO_PG_ACQUIRE_TIMEOUT` | `5s` | Connection pool acquisition deadline (`1ms`–`1m`) |
| `SILO_PG_REQUEST_TIMEOUT` | `15m` | Storage request deadline (`1ms`–`24h`) |
| `SILO_PG_QUEUE_TIMEOUT` | `5s` | Maximum wait for a free concurrent request slot (`0s`–`1m`; `0s` disables waiting). Added in `1d387725c` (2026-11-08) |
{.wide}

The data connection pool size equals `SILO_PG_MAX_CONNS - SILO_PG_CONTROL_CONNS - SILO_PG_COORD_CONNS`. The result must be at least `2` (`26` with default settings). All three settings are validated together at startup: for example, `SILO_PG_MAX_CONNS=5` is rejected if `CONTROL_CONNS` (`4`) and `COORD_CONNS` (`2`) remain at their defaults.

Use explicit byte units (`MiB`, `GiB`) and Go duration strings (`500ms`, `5s`, `15m`). Empty or unset variables use defaults; invalid values fail startup rather than silently falling back.

### Concurrent request limit and queueing {#concurrency}

Each gateway bounds the number of S3 requests executing concurrently to the smallest of three values:

- `SILO_PG_MAX_CONNS`
- Gateway memory limit divided by two segment buffers: `memlimit / (2 * SILO_PG_SEGMENT_SIZE)` (where `memlimit` comes from `--memlimit` or available system memory)
- Configured `api requests_max`, if set

Starting with `1d387725c` on `feat/pg-backend` (2026-11-08), requests above the limit wait in an admission queue for up to `SILO_PG_QUEUE_TIMEOUT` (`5s` by default). Queued requests do not hold database connections, and disconnected clients abort waiting immediately. When the queue timeout expires, the gateway returns HTTP 503 `SlowDown`, which AWS SDK for Go v2 and `boto3` retry by default. Setting `SILO_PG_QUEUE_TIMEOUT=0s` disables queueing and returns HTTP 503 `SlowDown` immediately.

> [!NOTE]
> Builds before `1d387725c`, including `299378b` and the frozen October 8, 2026 local schema 14 checkpoint (`3c7fdc03`), do not queue: requests above the limit receive HTTP 429 `TooManyRequests` immediately, which the AWS SDK for Go v2 and `boto3` do not retry by default.

Admission queueing only absorbs short bursts. To sustain higher client concurrency:

1. Raise `SILO_PG_MAX_CONNS` above the expected concurrent S3 request count (for example, `72` for 64 concurrent clients, leaving 66 data connections after the 4 control and 2 coordination connections).
2. Ensure gateway memory accommodates `2 * SILO_PG_SEGMENT_SIZE` per active slot (about 1.1 GiB for 72 slots at `8MiB` segments).
3. Raise PostgreSQL `max_connections` above the sum of `SILO_PG_MAX_CONNS` across all gateways plus application SQL roles, replication, maintenance, and `superuser_reserved_connections`.
4. Restart the gateway.

## Persistent vs. runtime parameters {#persistent-vs-runtime}

Initial store creation writes `SILO_PG_SEGMENT_SIZE` and `SILO_PG_MAX_OBJECT_SIZE` into `silo.meta`. Every subsequent gateway startup (both read-write and read-only) must match the persisted values or the gateway refuses to start. Never edit `silo.meta` directly to alter segment or object size on an existing store.

Connection pool sizes and timeouts are per-gateway runtime parameters that take effect on gateway restart. Operation-specific bounds can terminate a request earlier than `SILO_PG_REQUEST_TIMEOUT` (for example, read-only ZIP extraction enforces a 1-minute ceiling).

An explicitly configured read-only gateway (`SILO_PG_READ_ONLY=on`) never promotes itself to writable. A writable gateway connected to a PostgreSQL standby in recovery also fails write transactions, but with database read-only errors rather than explicit gateway rejection.

## Environment file example {#env-example}

The following template is suitable for a systemd `EnvironmentFile` (`/etc/silo/silo-pg.env`). Replace all placeholder values and restrict file permissions to `0600`. Do not execute this file with `source`.

```ini
SILO_PG_DSN="postgresql://silo_owner:URL_ENCODED_PASSWORD@pg.example.net:5432/silo?sslmode=verify-full&sslrootcert=/etc/silo/postgres-ca.crt"
MINIO_ROOT_USER="REPLACE_WITH_ROOT_ACCESS_KEY"
MINIO_ROOT_PASSWORD="REPLACE_WITH_LONG_RANDOM_SECRET"
MINIO_REGION="us-east-1"
SILO_PG_READ_ONLY="off"
SILO_PG_MAX_CONNS="32"
SILO_PG_CONTROL_CONNS="4"
SILO_PG_COORD_CONNS="2"
SILO_PG_SEGMENT_SIZE="8MiB"
SILO_PG_MAX_OBJECT_SIZE="256MiB"
SILO_PG_ACQUIRE_TIMEOUT="5s"
SILO_PG_REQUEST_TIMEOUT="15m"
SILO_PG_QUEUE_TIMEOUT="5s"
```

URL-encode special characters in the DSN password. `sslmode=verify-full` validates both the PostgreSQL server certificate chain and hostname. Connections must connect directly to PostgreSQL or through a session-mode proxy that preserves `LISTEN/NOTIFY`, session state, and transactions; do not use a transaction-pooling proxy.

Start the gateway with:

```bash
silo server --address :9000 --console-address :9001 --certs-dir /etc/silo/certs
```

Place `public.crt` and `private.key` inside `--certs-dir` for S3 HTTPS termination. The PostgreSQL client CA (`/etc/silo/postgres-ca.crt`) and the S3 server TLS certificate (`/etc/silo/certs/public.crt`) secure different links. See [Installation](/docs/s3/operations/install/) for systemd unit setup.

## Region selection {#region-selection}

The gateway determines its effective S3 region from the first non-empty source in this order:

1. `MINIO_REGION`
2. Legacy `MINIO_REGION_NAME`
3. `MINIO_SITE_REGION`, falling back to the database-persisted `site region` setting when unset or empty
4. Legacy database-persisted `region name`

Surrounding whitespace is trimmed from environment values, and a whitespace-only `MINIO_SITE_REGION` bypasses the persisted site region. Unset unused variables rather than setting them to spaces. If the selected non-empty value is invalid, startup fails immediately without falling back to lower-priority sources. All gateways sharing a database must resolve the same effective region.

## Root credentials, encryption, and compatibility names {#credentials-and-encryption}

`MINIO_*` environment variable names are retained for compatibility with existing S3 tools and service templates. PGSTY and Silo are not affiliated with MinIO, Inc.

- `MINIO_ROOT_USER` and `MINIO_ROOT_PASSWORD` define the S3 root credentials. All gateways attached to the same database must share identical root credentials, effective region, and SSE-S3 keys.
- Built-in static SSE-S3 (`AES256`) uses `MINIO_KMS_SECRET_KEY` (`key-name:base64-key`) or `MINIO_KMS_SECRET_KEY_FILE`. Back up the static key before enabling default bucket encryption; losing the key makes encrypted objects permanently unreadable. See [Encryption](/docs/s3/tutorial/encryption/).
- General Silo flags for erasure-coded disks, S2 object compression, external etcd IAM, SSE-KMS, and remote tiering do not apply to the PostgreSQL backend. See [Compatibility](/docs/s3/compatibility/).

---

Backlinks:

- [Architecture](/docs/s3/architecture/)
- [Compatibility](/docs/s3/compatibility/)
- [Troubleshooting](/docs/s3/operations/troubleshooting/)
- [Upgrade](/docs/s3/operations/upgrade/)
- [Quick start](/docs/s3/quickstart/)
- [Reference](/docs/s3/reference/)
