# Deploy with Pigsty

> The Pigsty role for Silo with a PostgreSQL backend, and its status.

---

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

---

> [!IMPORTANT]
> The `minio_backend: postgres` branch in the Pigsty `minio` Ansible role is pinned to an **unpublished** coordination commit (`5633285b2b8d40321e458026abe2656944674ed3`) and depends on the unpublished `silo` DEB/RPM packages (`MVP in progress`). Released versions of Pigsty do not yet include this backend branch.

The coordinated Pigsty `minio` role adds a `minio_backend: postgres` execution path to `minio.yml`. It deploys `silo` systemd services connected to an existing PostgreSQL database without inheriting erasure-coded disk arguments or local volume mounts.

## Scope and prerequisites {#scope-and-prerequisites}

- The role deploys stateless `silo` gateways only; it does **not** create the PostgreSQL cluster, database owner (`silo_owner`), or `silo` database, and it does not configure database backups. Complete the database setup in [Install](/docs/s3/operations/install/#prepare-database) first.
- `minio_pg_dsn` must be a single-host `postgresql://` URI with an explicit username, database name, `sslmode=verify-full`, and `sslrootcert` matching `minio_pg_ca_file` (located under `/etc/silo/`). The role rejects multi-host fallback URIs and query parameters that override connection identity.
- Certificates used by the gateway must include `127.0.0.1` in their IP SANs because the role's post-start health check probes `https://127.0.0.1:9000/minio/health/cluster` (for writable gateways) or `/minio/health/cluster/read` (for read-only gateways) with strict TLS verification.

## Example two-gateway inventory {#example-inventory}

Store credentials (`vault_silo_root_user`, `vault_silo_root_password`, and URL-encoded `vault_silo_pg_dsn`) in an encrypted Ansible Vault file (`vault.yml`), and define the two-gateway `silo_pg` group in `inventory.yml`:

```yaml
all:
  children:
    silo_pg:
      hosts:
        10.10.10.11: { minio_seq: 1 }
        10.10.10.12: { minio_seq: 2 }
      vars:
        minio_cluster: silo-pg
        minio_type: silo
        minio_backend: postgres
        minio_https: true
        minio_domain: s3.example.net
        minio_access_key: "{{ vault_silo_root_user }}"
        minio_secret_key: "{{ vault_silo_root_password }}"
        minio_pg_dsn: "{{ vault_silo_pg_dsn }}"
        minio_pg_ca_src: /srv/pgsilo-pki/postgres-ca.crt
        minio_pg_ca_file: /etc/silo/postgres-ca.crt
        minio_pg_max_conns: 32
        minio_pg_control_conns: 4
        minio_pg_coord_conns: 2
        minio_pg_acquire_timeout: 5s
        minio_pg_request_timeout: 15m
        minio_pg_segment_size: 8MiB
        minio_pg_max_object_size: 256MiB
        minio_pg_package_src: /srv/artifacts/silo_<version>_<arch>.deb
        minio_pg_package_sha256: REPLACE_WITH_PACKAGE_SHA256
        minio_pg_binary_sha256: REPLACE_WITH_BINARY_SHA256
        minio_extra_vars: |
          MINIO_REGION=us-east-1
        minio_buckets: []
        minio_users: []
```

Setting `minio_buckets: []` and `minio_users: []` skips Pigsty's default `pgbackrest` backup bucket/user creation so database backups are never stored inside the `pgsilo` service that depends on that same database.

Deploy the first writable gateway alone (`-l 10.10.10.11 -e minio_provision=false`) so it initializes the PostgreSQL schema without racing a second node, then run the playbook across the group:

```bash
ansible-playbook -i inventory.yml -l 10.10.10.11 --ask-vault-pass \
  -e minio_provision=false -e @vault.yml minio.yml

ansible-playbook -i inventory.yml -l silo_pg --ask-vault-pass \
  -e @vault.yml minio.yml
```

## What the role configures {#role-behavior}

| Component | Behavior in `minio_backend: postgres` |
| --- | --- |
| Package & binary verification | Copies the local `.deb`/`.rpm` from `minio_pg_package_src`, verifies `minio_pg_package_sha256`, installs it, and verifies `/usr/bin/silo` against `minio_pg_binary_sha256` |
| OS account | Runs the service as `minio:minio` (`minio_user` defaults to `minio`, whereas manual DEB installation uses `silo:silo`) |
| Service & environment | Writes `/etc/systemd/system/silo.service` and `/etc/default/silo` (`root:minio`, mode `0640`) with `no_log` secret protection |
| TLS certificates | Places `public.crt` and `private.key` in `/home/<minio_user>/.minio/certs/` and the PostgreSQL CA at `/etc/silo/postgres-ca.crt` |
| Read-only gateways | Setting `minio_pg_read_only: true` on a standby gateway host configures `SILO_PG_READ_ONLY=on`, skips bucket/user provisioning, and probes `/minio/health/cluster/read` |
| Monitoring | Defaults `MINIO_PROMETHEUS_AUTH_TYPE=public` in the environment template and provides the `files/grafana/minio/silo-pg.json` dashboard; restrict metrics network access or override to `jwt` authentication |
{.wide}

Note that re-running `minio.yml` across nodes does not replace the stop-all-writers procedure required for a schema migration; follow [Upgrade](/docs/s3/operations/upgrade/) whenever `schema_version` changes.

---

Backlinks:

- [Operations](/docs/s3/operations/)
