Configuration
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
| 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) |
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
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)(wherememlimitcomes from--memlimitor 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.
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:
- Raise
SILO_PG_MAX_CONNSabove the expected concurrent S3 request count (for example,72for 64 concurrent clients, leaving 66 data connections after the 4 control and 2 coordination connections). - Ensure gateway memory accommodates
2 * SILO_PG_SEGMENT_SIZEper active slot (about 1.1 GiB for 72 slots at8MiBsegments). - Raise PostgreSQL
max_connectionsabove the sum ofSILO_PG_MAX_CONNSacross all gateways plus application SQL roles, replication, maintenance, andsuperuser_reserved_connections. - Restart the gateway.
Persistent vs. runtime parameters
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
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.
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:
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 for systemd unit setup.
Region selection
The gateway determines its effective S3 region from the first non-empty source in this order:
MINIO_REGION- Legacy
MINIO_REGION_NAME MINIO_SITE_REGION, falling back to the database-persistedsite regionsetting when unset or empty- 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
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_USERandMINIO_ROOT_PASSWORDdefine 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) usesMINIO_KMS_SECRET_KEY(key-name:base64-key) orMINIO_KMS_SECRET_KEY_FILE. Back up the static key before enabling default bucket encryption; losing the key makes encrypted objects permanently unreadable. See 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.
