feat(stalwart): switch config/data store from RocksDB to PostgreSQL (DEV-476)

Following the DEV-473 rocksdb-to-postgres migration, point Stalwart's bootstrap
config at the PostgreSQL store and expose PGPASSWORD to the container so the
`authSecret: EnvironmentVariable` lookup resolves.

- stalwart-bootstrap-config.yaml: config.json switches @type RocksDb -> PostgreSql
  (host=stalwart-postgres, db=stalwart, authUsername=stalwart,
  authSecret=EnvironmentVariable/PGPASSWORD, useTls=false).
- stalwart-fresh-deployment.yaml: adds PGPASSWORD env from
  secret/stalwart-postgres-credentials.POSTGRES_PASSWORD on the stalwart container.
- stalwart-config.yaml: mirrors the switch in stalwart.toml as documentation
  (the running pod uses `--config /etc/stalwart/config.json`, not the toml).

Board (DEV-476) explicitly asked for the manifest-level switch after the web UI
save failed with a `Permission denied` on the read-only bootstrap emptyDir.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
paperclip 2026-08-15 14:46:29 +00:00
parent c4551495e0
commit 8cd2829cd8
3 changed files with 24 additions and 5 deletions

View file

@ -5,4 +5,7 @@ metadata:
name: stalwart-bootstrap-config name: stalwart-bootstrap-config
namespace: stalwart namespace: stalwart
data: data:
config.json: '{"@type":"RocksDb","path":"/var/lib/stalwart"}' # DEV-476: Bootstrap now points at the PostgreSQL config/data store.
# PGPASSWORD is injected into the stalwart container from
# secret/stalwart-postgres-credentials (see stalwart-fresh-deployment.yaml).
config.json: '{"@type":"PostgreSql","host":"stalwart-postgres","port":5432,"database":"stalwart","authUsername":"stalwart","authSecret":{"@type":"EnvironmentVariable","variableName":"PGPASSWORD"},"useTls":false}'

View file

@ -10,12 +10,22 @@ data:
# Stalwart Mail Server Configuration # Stalwart Mail Server Configuration
# #
# DEV-476: primary store is PostgreSQL (see stalwart-bootstrap-config.yaml).
# Note: the container starts with `--config /etc/stalwart/config.json`, so
# this stalwart.toml is not read at runtime for a live pod — the bootstrap
# JSON is authoritative. Kept in sync here as documentation and for any
# one-shot tooling that references the toml.
[store] [store]
data = "rocksdb" data = "postgres"
[store.rocksdb] [store.postgres]
type = "rocksdb" type = "postgresql"
path = "/var/lib/stalwart" host = "stalwart-postgres"
port = 5432
database = "stalwart"
user = "stalwart"
password = "%{env:PGPASSWORD}%"
tls.enable = false
# #
# Server Configuration # Server Configuration

View file

@ -145,6 +145,12 @@ spec:
value: "/etc/stalwart/certs/tls.crt" value: "/etc/stalwart/certs/tls.crt"
- name: TLS_PRIVATE_KEY - name: TLS_PRIVATE_KEY
value: "/etc/stalwart/certs/tls.key" value: "/etc/stalwart/certs/tls.key"
# DEV-476: bootstrap config.json resolves authSecret via this env var.
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: stalwart-postgres-credentials
key: POSTGRES_PASSWORD
volumeMounts: volumeMounts:
- name: data - name: data
mountPath: /var/lib/stalwart mountPath: /var/lib/stalwart