GREEN PACKAGE SKILL · POSTGRESQL 17 · PATRONI · ETCD
postgres-agy
3-node PostgreSQL 17 High Availability cluster on DigitalOcean with Patroni quorum, colocated etcd v3, HAProxy client routing, and pgBackRest continuous WAL archiving to Cloudflare R2.
- PostgreSQL 17
- Patroni 4.1.5
- etcd v3.5
- pgBackRest to R2
- HAProxy 2.8
#Introduction
This package provides a production-grade, self-healing PostgreSQL 17 cluster managed via Patroni and colocated etcd consensus. It features multi-A DNS routing via HAProxy, continuous WAL archiving to Cloudflare R2, and automated restore verification drills.
./green build renders OpenTofu and Ansible templates locally, and ./green create --dry-run verifies execution boundaries without contacting cloud providers.#Quick start
npx skills add https://github.com/getcolors/postgres-agy --skill package-postgres-agy-green
cp .agents/skills/package-postgres-agy-green/green ./green
./green build
./green create --dry-run
# After review:
./green create#Architecture & Quorum
Node 1 (Leader / Standby) Node 2 (Standby) Node 3 (Standby)
┌───────────────────────┐ ┌───────────────────────┐ ┌───────────────────────┐
│ PostgreSQL 17 + Patroni│ │ PostgreSQL 17 + Patroni│ │ PostgreSQL 17 + Patroni│
│ colocated etcd v3 │──│ colocated etcd v3 │──│ colocated etcd v3 │
│ HAProxy (5432/5433) │ │ HAProxy (5432/5433) │ │ HAProxy (5432/5433) │
│ pgBackRest → R2 │ │ pgBackRest → R2 │ │ pgBackRest → R2 │
└───────────────────────┘ └───────────────────────┘ └───────────────────────┘
▲ ▲ ▲
└───────────────────────────┴───────────────────────────┘
Cloudflare DNS Multi-A (postgres-agy.bigconfig.online)#Client Routing
Every node runs local HAProxy. Port 5432 routes write traffic to the active primary node; port 5433 round-robins read queries to available standby replicas.
#Backups & PITR
pgBackRest streams WAL archives continuously to Cloudflare R2 with encryption and compression. Scheduled systemd timers execute verified standby restore drills against live heartbeat tables.
#Command Reference
| Command | Description |
|---|---|
./green build | Render OpenTofu and Ansible configurations locally |
./green create --dry-run | Validate execution DAG and cloud resources without changes |
./green create | Provision infrastructure, converge cluster, and run acceptance tests |
./green status | Query Patroni cluster health and leader state |
./green delete | Guarded teardown (requires COLORS_PAR_COMPUTE_PREVENT_DESTROY=false) |
#Safety & Credentials
- All credentials indirected through gitignored
COLORS_PAR_*environment variables. - Never export
COLORS_PAR_PROFILE. - Protected by
compute-prevent-destroy: true.