PostgreSQL
PostgreSQL is the most flexible shared driver in AlmaForge. The same postgres driver field works for cluster state and audit events. It needs PostgreSQL 13 or later, the wal2json logical decoding plugin for the state backend, and a database user with the REPLICATION role attribute.
| Storage concern | Supported |
|---|---|
Cluster state (name: state) | yes |
Audit events (name: audit-*) | yes |
Session recordings (name: recordings) | no |
TL;DR
- Provision PostgreSQL 13+ with
wal2json,wal_level = logical, and enough replication slots for your Auth Service instances. - Write a
StorageConfigwithspec.postgresforname: state, and a separate database plusStorageConfigfor anyaudit-*instances. - Restart the Auth Service and verify with
alma get storageconfig/stateandalma get storageconfig/audit-primary.
Prerequisites
Before you start, make sure you have:
- PostgreSQL 13 or later.
wal2json2.1 or later for the state backend.wal_level = logicalinpostgresql.conf.max_replication_slotsset to at least the number of Auth Service instances you plan to run, with extra headroom for reconnects.- An AlmaForge database user with the
REPLICATIONrole attribute for the state backend. - Static credentials, PostgreSQL TLS client certificates, or Azure AD authentication for the database user.
Azure Database for PostgreSQL ships with wal2json pre-installed. Debian and Ubuntu hosts can install it from the official PostgreSQL APT repository with apt-get install postgresql-<version>-wal2json. RHEL, CentOS, and Rocky hosts can install it from the official PostgreSQL YUM repository with dnf install wal2json_<version>. For other distributions, build from source per the wal2json README.
For dev, stand up a throwaway PostgreSQL instance with wal2json installed and discard it when you are done.
Configuration
Step 1. Pick the database layout
PostgreSQL is a portable shared driver that does not tie the control plane to one cloud provider. It fits self-hosted deployments, bare metal, Azure Database for PostgreSQL, Aurora PostgreSQL, and Cloud SQL for PostgreSQL.
Use one PostgreSQL database for cluster state and a different PostgreSQL database for audit events. Logical decoding works per database, not per table. Running state and audit in the same database forces the state change feed to sift through audit rows it does not care about.