Highly available PostgreSQL 18 for Docker Swarm, built on Patroni, etcd and HAProxy and deployed with a
single docker stack deploy.
flowchart LR
apps([Apps]) --> haproxy[HAProxy]
haproxy --> pg
subgraph pg [Patroni + PostgreSQL]
pg1[pg-1]
pg2[pg-2]
pg3[pg-3]
end
pg --> etcd
subgraph etcd [etcd]
etcd1[etcd-1]
etcd2[etcd-2]
etcd3[etcd-3]
end
Note
hippo is pre-1.0, so a minor release may still contain breaking changes.
| Image | Contents |
|---|---|
ghcr.io/nicebots-xyz/hippo:18 |
PostgreSQL 18 with its contrib extensions, and Patroni |
ghcr.io/nicebots-xyz/hippo:18-ext |
18 plus pgvector, pg_cron, pg_partman, pgaudit, pg_repack, hypopg and pg_stat_kcache |
Each release also has immutable 18-<version> and 18-ext-<version> tags. Extensions are installed but
not enabled, and pg_cron, pgaudit and pg_stat_kcache need shared_preload_libraries.
Requirements:
- a Swarm with exactly three nodes labelled
hippo.pg=true - IP protocol 50 (ESP) allowed between nodes
docker node update --label-add hippo.pg=true <node>openssl rand -hex 32 | docker secret create hippo_superuser_password_v1 -openssl rand -hex 32 | docker secret create hippo_replication_password_v1 -git clone --depth 1 --branch hippo@<version> https://github.com/nicebots-xyz/hippo && cd hippo/deployexport HIPPO_IMAGE=ghcr.io/nicebots-xyz/hippo@$(docker buildx imagetools inspect ghcr.io/nicebots-xyz/hippo:18-<version> --format '{{ .Manifest.Digest }}')export HIPPO_NODE_1=<host> HIPPO_NODE_2=<host> HIPPO_NODE_3=<host>docker stack deploy -c stack.yml hippo| Variable | Default |
|---|---|
HIPPO_IMAGE |
required |
HIPPO_NODE_1, HIPPO_NODE_2, HIPPO_NODE_3 |
required, the hostnames of the hippo.pg=true nodes |
HIPPO_SUBNET |
10.77.0.0/24 |
HIPPO_NETWORK |
hippo |
HIPPO_CLIENT_NETWORK |
hippo-clients |
HIPPO_SUPERUSER_SECRET |
hippo_superuser_password_v1 |
HIPPO_REPLICATION_SECRET |
hippo_replication_password_v1 |
Each member is named after its node (pg-<host>, etcd-<host>) and keeps its data in that node's
hippo_pgdata and hippo_etcd-data volumes.
Updating means redeploying with a new HIPPO_IMAGE. PostgreSQL settings live in etcd after bootstrap
and are changed with patronictl edit-config.
Apps join the hippo-clients network.
| Address | Routes to |
|---|---|
haproxy:5000 |
the primary |
haproxy:5001 |
the replicas |
- backups
- PgBouncer
- PostgreSQL majors other than 18
docker buildx baketests/smoke/run.sh hippo-dev/hippo:18Pull requests changing images/, deploy/ or docker-bake.hcl need a changelog entry in .tegami/.
MIT. The images bundle third party software under its own licenses, listed in each image's SBOM attestation.