{"id":18604092,"url":"https://github.com/pgsty/pigsty","last_synced_at":"2026-03-06T03:04:10.456Z","repository":{"id":37240793,"uuid":"268680961","full_name":"pgsty/pigsty","owner":"pgsty","description":"Free \u0026 OSS PostgreSQL RDS / DBaaS, Self-Host PG like a Pro","archived":false,"fork":false,"pushed_at":"2026-02-21T13:44:08.000Z","size":38361,"stargazers_count":4709,"open_issues_count":16,"forks_count":330,"subscribers_count":53,"default_branch":"main","last_synced_at":"2026-02-21T20:15:57.363Z","etag":null,"topics":["graphics","infra","postgres","service","toolbox","yours"],"latest_commit_sha":null,"homepage":"https://pigsty.io","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pgsty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-06-02T02:22:09.000Z","updated_at":"2026-02-21T13:45:41.000Z","dependencies_parsed_at":"2023-10-17T07:54:12.912Z","dependency_job_id":"bec8ac41-d6a8-4a56-b564-ac2bafe24eb1","html_url":"https://github.com/pgsty/pigsty","commit_stats":{"total_commits":2513,"total_committers":17,"mean_commits":147.8235294117647,"dds":"0.16792678074015122","last_synced_commit":"fe02696559a5cb977036b4ecbfc544bbdd17802b"},"previous_names":["pgsty/pigsty","vonng/pigsty"],"tags_count":98,"template":false,"template_full_name":null,"purl":"pkg:github/pgsty/pigsty","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgsty%2Fpigsty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgsty%2Fpigsty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgsty%2Fpigsty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgsty%2Fpigsty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgsty","download_url":"https://codeload.github.com/pgsty/pigsty/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgsty%2Fpigsty/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30160043,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T22:39:40.138Z","status":"online","status_checked_at":"2026-03-06T02:00:08.268Z","response_time":250,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphics","infra","postgres","service","toolbox","yours"],"created_at":"2024-11-07T02:16:36.099Z","updated_at":"2026-03-06T03:04:10.418Z","avatar_url":"https://github.com/pgsty.png","language":"Shell","readme":"# PIGSTY - Self-Host Postgres like a Pro\n\n[![Website: pigsty.io](https://img.shields.io/badge/website-pigsty.io-slategray?style=flat\u0026logo=cilium\u0026logoColor=white)](https://pigsty.io)\n[![CN: pigsty.cc](https://img.shields.io/badge/CN-pigsty.cc-slategray?style=flat\u0026logo=cilium\u0026logoColor=white)](https://pigsty.cc)\n[![Version: v4.2.1](https://img.shields.io/badge/version-v4.2.1-slategray?style=flat\u0026logo=cilium\u0026logoColor=white)](https://github.com/pgsty/pigsty/releases)\n[![License: Apache-2.0](https://img.shields.io/github/license/pgsty/pigsty?logo=opensourceinitiative\u0026logoColor=green\u0026color=slategray)](https://pigsty.io/docs/about/license/)\n[![GitHub Stars](https://img.shields.io/github/stars/pgsty/pigsty?style=flat\u0026logo=github\u0026logoColor=black\u0026color=slategray)](https://star-history.com/#pgsty/pigsty\u0026Date)\n[![Extensions: 461](https://img.shields.io/badge/extensions-461-%233E668F?style=flat\u0026logo=postgresql\u0026logoColor=white\u0026labelColor=3E668F)](https://pgext.cloud/list)\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/pgsty/pigsty)\n\nEnterprise-Grade Open-Source **PostgreSQL** Distribution with HA, PITR, IaC, Monitor, and 460 PG extensions.\n\n\u003e \"**P**ostgreSQL **I**n **G**reat **STY**le\": **P**ostgres, **I**nfras, **G**raphics, **S**ervice, **T**oolbox, it's all **Y**ours.\n\n[Website](https://pigsty.io) | [ORG](https://github.com/pgsty) | [PGEXT.CLOUD](https://pgext.cloud) | [AI INFRA](https://pigsty.io/docs/piglet) | [Public Demo](https://demo.pigsty.io) | [Blog](https://pigsty.io/blog/) | [Discuss](https://github.com/orgs/pgsty/discussions) | [Support](https://pigsty.io/price) | [中文](https://pigsty.cc/)\n\n[![banner](https://pigsty.io/img/pigsty/banner.png)](https://pigsty.io)\n\nPigsty scales from [**laptop**](https://pigsty.io/docs/setup) to [**datacenter**](https://pigsty.io/docs/deploy). Enterprise-grade. Developer-friendly. [**Get Started**](https://pigsty.io/docs/setup/install) with the latest [**v4.2.1**](https://github.com/pgsty/pigsty/releases):\n\n```bash\ncurl -fsSL https://repo.pigsty.io/get | bash -s v4.2.1\n```\n\n\n## Features\n\n- **Extensible**:   **461+** [**PG Extensions**](https://pgext.cloud/list) \u0026 **12** [**PG Kernels**](https://pigsty.io/docs/pgsql/kernel) available, Packed for [**14 Linux Platforms**](https://pigsty.io/docs/ref/linux), Battery-Included.\n- **Reliable**:     Self-healing [**HA**](https://pigsty.io/docs/concept/ha) clusters with pre-configured [**PITR**](https://pigsty.io/docs/pgsql/backup) and built-in [**ACL**](https://pigsty.io/docs/pgsql/config/acl), [**CA \u0026 SSL**](https://pigsty.io/docs/infra/admin/cert) secure best practice.\n- **Observable**:   SOTA monitoring for [**PG**](https://demo.pigsty.io/ui/d/pgrds-instance/pgrds-instance) / [**Infra**](https://pigsty.io/docs/infra) / [**Node**](https://pigsty.io/docs/node) based on the **Victoria** \u0026 **Grafana** stack: [**Demo**](https://demo.pigsty.io) \u0026 [**Gallery**](https://github.com/pgsty/pigsty/wiki/Gallery).\n- **Scalable**:     Auto-routed \u0026 pooled customizable database [**Services**](https://pigsty.io/docs/pgsql/service) [**Access**](https://pigsty.io/docs/pgsql/service#access-service) with **haproxy**, **pgbouncer**, and **VIP**.\n- **Maintainable**: [**One-Cmd Deploy**](https://pigsty.io/docs/setup/install), [**Admin SOP**](https://pigsty.io/docs/pgsql/admin), **Auto-Tune**, **Local Repo**, [**IaC**](https://pigsty.io/docs/pgsql/config) and [**Vagrant**](https://pigsty.io/docs/deploy/vagrant) / [**Terraform**](https://pigsty.io/docs/deploy/terraform) support.\n- **Composable**:   Bonus [**Modules**](https://pigsty.io/docs/ref/module) such as [**Redis**](https://pigsty.io/docs/redis), [**MinIO**](https://pigsty.io/docs/minio), [**Etcd**](https://pigsty.io/docs/etcd), [**Docker**](https://pigsty.io/docs/app), [**DuckDB**](https://pigsty.io/docs/pilot/duckdb), [**FerretDB**](https://pigsty.io/docs/ferret), [**Supabase**](https://pigsty.io/docs/app/supabase), [**\u0026 More**](https://pigsty.io/docs/ref/module).\n- **Controllable**: Self-sufficient [**Infra Closure**](https://pigsty.io/docs/infra), Cloud Neutral FOSS. Run on [**bare Linux**](https://pigsty.io/docs/ref/linux) without [**Docker \u0026 K8S**](https://vonng.com/en/db/db-in-k8s/).\n- **Affordable**:   Self-Hosting like a [**Pro**](https://pigsty.io/price/), without the cost of [**RDS**](https://vonng.com/en/cloud/rds/). Empowering Cloud-Exit for Ultra [**Cost Saving!**](https://pigsty.io/docs/about/compare/)\n\nYou can even use many exotic [**PG Kernel Forks**](https://pigsty.io/docs/pgsql/kernel) as in-place replacement and wrap it as a full RDS service: \n\n[![POSTGRESQL](https://img.shields.io/badge/POSTGRESQL-3E668F?style=flat\u0026logo=postgresql\u0026labelColor=3E668F\u0026logoColor=white)](https://pigsty.io/docs/pgsql/kernel/postgres)\n[![SUPABASE](https://img.shields.io/badge/SUPABASE-3FCF8E?style=flat\u0026logo=supabase\u0026labelColor=3FCF8E\u0026logoColor=white)](https://pigsty.io/docs/app/supabase)\n[![CITUS](https://img.shields.io/badge/CITUS-21A368?style=flat\u0026logo=postgresql\u0026labelColor=21A368\u0026logoColor=white)](https://pigsty.io/docs/pgsql/kernel/citus)\n[![BABELFISH](https://img.shields.io/badge/BABELFISH-88A3CA?style=flat\u0026logo=postgresql\u0026labelColor=88A3CA\u0026logoColor=black)](https://pigsty.io/docs/pgsql/kernel/babelfish)\n[![IVORYSQL](https://img.shields.io/badge/IVORYSQL-E8AC52?style=flat\u0026logo=postgresql\u0026labelColor=E8AC52\u0026logoColor=black)](https://pigsty.io/docs/pgsql/kernel/ivorysql)\n[![OPENHALO](https://img.shields.io/badge/OPENHALO-66D9C6?style=flat\u0026logo=mysql\u0026labelColor=66D9C6\u0026logoColor=black)](https://pigsty.io/docs/pgsql/kernel/openhalo)\n[![FERRETDB](https://img.shields.io/badge/FERRETDB_/_DOCUMENTDB-042133?style=flat\u0026logo=ferretdb\u0026labelColor=042133\u0026logoColor=white)](https://pigsty.io/docs/ferret)\n[![PERCONA](https://img.shields.io/badge/PERCONA_TDE-1A93E8?style=flat\u0026logo=postgresql\u0026labelColor=1A93E8\u0026logoColor=white)](https://pigsty.io/docs/pgsql/kernel/percona)\n[![ORIOLEDB](https://img.shields.io/badge/ORIOLEDB-2F6FED?style=flat\u0026logo=postgresql\u0026labelColor=2F6FED\u0026logoColor=white)](https://pigsty.io/docs/pgsql/kernel/orioledb)\n[![AGENSGRAPH](https://img.shields.io/badge/AGENSGRAPH-8A6DE9?style=flat\u0026logo=postgresql\u0026labelColor=8A6DE9\u0026logoColor=white)](https://pigsty.io/docs/pgsql/kernel/agensgraph)\n[![PGEDGE](https://img.shields.io/badge/PGEDGE-0E7C86?style=flat\u0026logo=postgresql\u0026labelColor=0E7C86\u0026logoColor=white)](https://pigsty.io/docs/pgsql/kernel/pgedge)\n[![POLARDB](https://img.shields.io/badge/POLARDB_PG-DF6F2E?style=flat\u0026logo=postgresql\u0026labelColor=DF6F2E\u0026logoColor=black)](https://pigsty.io/docs/pgsql/kernel/polardb)\n[![POLAR Oracle](https://img.shields.io/badge/POLARDB_ORACLE-DF6F2E?style=flat\u0026logo=postgresql\u0026labelColor=DF6F2E\u0026logoColor=black)](https://pigsty.io/docs/pgsql/kernel/polardb-o)\n[![CLOUDBERRY](https://img.shields.io/badge/CLOUDBERRY-FF8C00?style=flat\u0026logo=postgresql\u0026labelColor=FF8C00\u0026logoColor=black)](https://pigsty.io/docs/pgsql/kernel/cloudberry)\n\n\n|                            Kernel                            |           Key Feature            | Description                                       |\n|:------------------------------------------------------------:|:--------------------------------:|:--------------------------------------------------|\n|  [PostgreSQL](https://pigsty.io/docs/pgsql/kernel/postgres)  |       **Battery-Included**       | Original PGDG PostgreSQL with 460+ extensions     |\n|       [Supabase](https://pigsty.io/docs/app/supabase)        |      **Backend as Service**      | BaaS over PostgreSQL, Firebase alternative        |\n|      [Citus](https://pigsty.io/docs/pgsql/kernel/citus)      |      **Horizontal Scaling**      | Distributive PostgreSQL via native extension      |\n|  [Babelfish](https://pigsty.io/docs/pgsql/kernel/babelfish)  |    **SQL Server Simulation**     | Microsoft SQL Server wire-compatibility           |\n|   [IvorySQL](https://pigsty.io/docs/pgsql/kernel/ivorysql)   |      **Oracle Simulation**       | Oracle Grammar and PL/SQL compatible              |\n|   [OpenHalo](https://pigsty.io/docs/pgsql/kernel/openhalo)   |       **MySQL Simulation**       | MySQL wire-protocol compatibility                 |\n|          [FerretDB](https://pigsty.io/docs/ferret)           |      **MongoDB Simulation**      | MongoDB wire-protocol compatibility               |\n|    [Percona](https://pigsty.io/docs/pgsql/kernel/percona)    | **Transparent Data Encryption**  | Percona Distribution with pg_tde                  |\n|   [OrioleDB](https://pigsty.io/docs/pgsql/kernel/orioledb)   |   **OLTP Optimization Engine**   | No bloat, No XID Wraparound, S3 Storage           |\n|    [PolarDB](https://pigsty.io/docs/pgsql/kernel/polardb)    |      **Aurora flavor RAC**       | RAC, China domestic compliance                    |\n| [AgensGraph](https://pigsty.io/docs/pgsql/kernel/agensgraph) |    **Graph-Native Database**     | Transactional graph database based on PostgreSQL  |\n|     [pgEdge](https://pigsty.io/docs/pgsql/kernel/pgedge)     |  **Multi-Master Distributive**   | Geo-Distributive multi-writer Postgres            |\n| [Cloudberry](https://pigsty.io/docs/pgsql/kernel/cloudberry) |      **MPP Data Warehouse**      | Greenplum 7 Apache OSS Fork                       |\n\nAnd gather the synergistic superpowers of all [**460+ PostgreSQL Extensions**](https://pgext.cloud/list) all together:\n\n[![ecosystem](https://github.com/user-attachments/assets/c952441e-5ff7-4acb-aace-dd3021d28622)](https://pgext.cloud)\n\n\n## Get Started\n\n[![Postgres: 18.3](https://img.shields.io/badge/PostgreSQL-18.3-%233E668F?style=flat\u0026logo=postgresql\u0026labelColor=3E668F\u0026logoColor=white)](https://pigsty.io/docs/pgsql)\n[![Linux](https://img.shields.io/badge/Linux-AMD64-%23FCC624?style=flat\u0026logo=linux\u0026labelColor=FCC624\u0026logoColor=black)](https://pigsty.io/docs/node)\n[![Linux](https://img.shields.io/badge/Linux-ARM64-%23FCC624?style=flat\u0026logo=linux\u0026labelColor=FCC624\u0026logoColor=black)](https://pigsty.io/docs/node)\n[![EL Support: 8/9/10](https://img.shields.io/badge/EL-8/9/10-red?style=flat\u0026logo=redhat\u0026logoColor=red)](https://pigsty.io/docs/ref/linux#el)\n[![Debian Support: 12/13](https://img.shields.io/badge/Debian-12/13-%23A81D33?style=flat\u0026logo=debian\u0026logoColor=%23A81D33)](https://pigsty.io/docs/ref/linux#debian)\n[![Ubuntu Support: 22/24](https://img.shields.io/badge/Ubuntu-22/24-%23E95420?style=flat\u0026logo=ubuntu\u0026logoColor=%23E95420)](https://pigsty.io/docs/ref/linux#ubuntu)\n[![Docker Image](https://img.shields.io/badge/Docker-v4.2.1-%232496ED?style=flat\u0026logo=docker\u0026logoColor=white)](https://pigsty.io/docs/setup/docker)\n\n[**Prepare**](https://pigsty.io/docs/deploy/prepare) a fresh `x86_64` / `aarch64` node runs any [**compatible**](https://pigsty.io/docs/ref/linux) **Linux** OS Distros, then [**Install**](https://pigsty.io/docs/setup/install#install) **Pigsty** with:\n\n```bash\ncurl -fsSL https://repo.pigsty.io/get | bash; cd ~/pigsty;\n```\n\nThen [**configure**](https://pigsty.io/docs/concept/iac/configure) and run the [**`deploy.yml`**](https://pigsty.io/docs/setup/playbook) playbook with an [**admin user**](https://pigsty.io/docs/deploy/admin) (**nopass** `ssh` \u0026 `sudo`):\n\n```bash\n./configure -g    # generate config and random passwords\n./deploy.yml      # deploy everything on current node\n```\n\nFinally, you will get a pigsty [**singleton node ready**](https://pigsty.io/docs/setup/install), with [**WebUI**](https://pigsty.io/docs/setup/webui) on port `80/443` and [**Postgres**](https://pigsty.io/docs/setup/pgsql) on port `5432`.\n\nFor dev/testing purposes, you can also run Pigsty inside [**Docker**](https://pigsty.io/docs/setup/docker) containers: `cd docker; make launch`\n\n--------\n\n\u003e [**Single-Node Setup**](https://pigsty.io/docs/setup/install) | [**Production Deploy**](https://pigsty.io/docs/deploy) | [**Offline Install**](https://pigsty.io/docs/setup/offline) | [**Minimal Install**](https://pigsty.io/docs/setup/slim) | [**Docker Install**](https://pigsty.io/docs/setup/docker) | [**Run Supabase**](https://pigsty.io/docs/app/supabase)\n\n\u003cdetails\u003e\u003csummary\u003eInstall with the pig cli\u003c/summary\u003e\u003cbr\u003e\n\nThen you can launch pigsty with `pig sty` sub command:\n\n```bash\ncurl -fsSL https://repo.pigsty.io/pig | bash # install pig\npig sty init     # install latest pigsty src to ~/pigsty \npig sty conf     # auto-generate pigsty.yml config file\npig sty deploy   # run the deploy.yml playbook\n```\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\u003csummary\u003eInstall with get script\u003c/summary\u003e\u003cbr\u003e\n\n```bash\n[root@pg-meta ~]# curl -fsSL https://repo.pigsty.io/get | bash -s v4.2.1\n[v4.2.1] ===========================================\n$ curl -fsSL https://repo.pigsty.io/get | bash\n[Docs] https://pigsty.io/docs\n[Demo] https://demo.pigsty.io\n[Repo] https://github.com/pgsty/pigsty\n[Download] ===========================================\n[ OK ] version = v4.2.1 (from arg)\ncurl -fSL https://repo.pigsty.io/src/pigsty-v4.2.1.tgz -o /tmp/pigsty-v4.2.1.tgz\n######################################################################## 100.0%\n[ OK ] md5sums = 53cb5980f9XXXXX1fbb832d7ee2fc93a  /tmp/pigsty-v4.2.1.tgz\n[Install] ===========================================\n[WARN] os user = root , it's recommended to use a non-root sudo-able admin\n[ OK ] install = /root/pigsty, from /tmp/pigsty-v4.2.1.tgz\n\n[Bootstrap] ===========================================\n[WARN] ansible = not found, bootstrap\nbootstrap pigsty v4.2.1 begin\n[ OK ] region = china\n[ OK ] kernel  = Linux\n[ OK ] machine = x86_64\n[ OK ] package = rpm,dnf\n[ OK ] vendor = rocky (Rocky Linux)\n[ OK ] version = 10 (10.0)\n[ OK ] sudo = root ok\n[WARN] ssh = root@127.0.0.1 fixed\n[WARN] old repos = moved to /etc/yum.repos.d/backup\n[ OK ] repo file = add el10.x86_64 china upstream\n[WARN] rpm cache = updating, may take a while\nPigsty PGSQL 10 - x86_64                                                                                                                                                                                      364 kB/s | 251 kB     00:00\nEL 10 BaseOS 10 - x86_64                                                                                                                                                                                       32 MB/s | 6.4 MB     00:00\nEL 10 AppStream 10 - x86_64                                                                                                                                                                                    11 MB/s | 2.1 MB     00:00\nEL 10 CRB 10 - x86_64                                                                                                                                                                                         1.8 MB/s | 492 kB     00:00\nEL 10 EPEL 10.0 - x86_64                                                                                                                                                                                       27 MB/s | 4.8 MB     00:00\nMetadata cache created.\n[ OK ] repo cache = created\n[ OK ] install el10 utils\nLast metadata expiration check: 0:00:02 ago on Wed 07 Jan 2026 05:58:22 PM CST.\n.....\n\nInstalled:\n  ansible-2.16.14-1.el10.noarch             ansible-collection-ansible-posix-2.0.0-1.el10_0.noarch      ansible-collection-community-crypto-2.15.0-1PIGSTY.el10.noarch      ansible-collection-community-general-10.2.0-1.el10_0.noarch\n  ansible-core-1:2.16.14-1.el10.noarch      git-core-2.47.3-1.el10.x86_64                               python3-cffi-1.16.0-7.el10.x86_64                                   python3-cryptography-43.0.0-4.el10.x86_64\n  python3-jmespath-1.0.1-8.el10.noarch      python3-ply-3.11-25.el10.noarch                             python3-pycparser-2.20-16.el10.noarch                               python3-resolvelib-1.0.1-6.el10.noarch\n\nComplete!\n[ OK ] ansible = ansible [core 2.16.14]\n[ OK ] boostrap pigsty complete\nproceed with ./configure\n```\n\n\u003e HINT: To install a specific version, pass the version string as the first parameter:\n\u003e\n\u003e ```bash\n\u003e curl -fsSL https://repo.pigsty.io/get | bash -s v4.2.1\n\u003e ```\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\u003csummary\u003eClone src with git\u003c/summary\u003e\u003cbr\u003e\n\nYou can also download the pigsty source with `git`, remember to check out a specific version tag, the `main` branch is for development.\n\n```bash\ngit clone https://github.com/pgsty/pigsty; cd pigsty; git checkout v4.2.1\n```\n\n\u003c/details\u003e\n\n\n\n\n## Architecture\n\nPigsty uses a [**modular**](https://pigsty.io/docs/concept/arch) design: you can [**use one or all**](https://pigsty.io/docs/deploy/planning), with best-of-breed products integrated as a platform.\n\n[![board](https://pigsty.io/img/pigsty/motherboard.gif)](https://pigsty.io/docs/concept/arch)\n\n[![PGSQL](https://img.shields.io/badge/PGSQL-%233E668F?style=flat\u0026logo=postgresql\u0026labelColor=3E668F\u0026logoColor=white)](https://pigsty.io/docs/pgsql) Self-healing PostgreSQL HA cluster powered by Patroni, Pgbouncer, PgBackrest \u0026 HAProxy\n\n[![INFRA](https://img.shields.io/badge/INFRA-%23009639?style=flat\u0026logo=nginx\u0026labelColor=009639\u0026logoColor=white)](https://pigsty.io/docs/infra) Nginx, Local Repo, DNSMasq, and the entire Victoria \u0026 Grafana observability stack.\n\n[![NODE](https://img.shields.io/badge/NODE-%23FCC624?style=flat\u0026logo=linux\u0026labelColor=FCC624\u0026logoColor=black)](https://pigsty.io/docs/node) Init node name, repo, pkg, NTP, ssh, admin, tune, expose services, collect logs \u0026 metrics.\n\n[![ETCD](https://img.shields.io/badge/ETCD-%23419EDA?style=flat\u0026logo=etcd\u0026labelColor=419EDA\u0026logoColor=white)](https://pigsty.io/docs/etcd) Etcd cluster is used as a reliable distributed configuration store by PostgreSQL HA agents.\n\nYou can compose them freely in a declarative manner. `INFRA` \u0026 `NODE` will suffice for host monitoring.\n`ETCD` and `PGSQL` are used for HA PG clusters; installing them on multiple nodes automatically forms HA clusters.\n\nThe default [`deploy.yml`](https://github.com/pgsty/pigsty/blob/main/deploy.yml) playbook will deploy `INFRA`, `NODE`, `ETCD` \u0026 `PGSQL` on the current node.\nThis gives you an out-of-the-box PostgreSQL singleton instance (`admin_ip:5432`) with everything ready.\n\n[![pigsty-arch](https://pigsty.io/img/pigsty/arch.png)](https://pigsty.io/docs/concept/arch)\n\nThe node can be used as an admin controller to deploy \u0026 monitor more nodes \u0026 clusters. For example, you can install these **6** **OPTIONAL** [extra modules](https://pigsty.io/docs/ref/module#extra-modules) for advanced use cases:\n\n[![MinIO](https://img.shields.io/badge/MINIO-%23C72E49?style=flat\u0026logo=minio\u0026logoColor=white)](https://pigsty.io/docs/minio) S3-compatible object storage service; used as an optional central backup server for `PGSQL`.\n\n[![Redis](https://img.shields.io/badge/REDIS-%23FF4438?style=flat\u0026logo=redis\u0026logoColor=white)](https://pigsty.io/docs/infra) Deploy Redis servers in standalone master-replica, sentinel, and native cluster mode.\n\n[![Ferret](https://img.shields.io/badge/FERRET-%23042133?style=flat\u0026logo=ferretdb\u0026logoColor=white)](https://pigsty.io/docs/ferret) Native support for FerretDB — adding MongoDB wire protocol compatibility to Postgres!\n\n[![Docker](https://img.shields.io/badge/DOCKER-%232496ED?style=flat\u0026logo=docker\u0026logoColor=white)](https://pigsty.io/docs/docker) Launch optional docker daemons to run other stateless parts besides Pigsty RDS.\n\n[![Juice](https://img.shields.io/badge/JUICE-%2300C853?style=flat\u0026logo=infinityfree\u0026logoColor=white)](https://pigsty.io/docs/juice) JuiceFS can mount S3/MinIO, and even PostgreSQL as a filesystem shared by multi users.\n\n[![Vibe](https://img.shields.io/badge/VIBE-%23FF6B35?style=flat\u0026logo=claude\u0026logoColor=white)](https://pigsty.io/docs/vibe) Vibe coding environment with VS Code Server, JupyterLab, Node.js, and Claude Code.\n\nOf course, you can deploy different kinds of HA **PostgreSQL** clusters on multiple nodes, as much as you want.\n\n\n----------------\n\n## PostgreSQL RDS\n\nTo deploy an [**additional**](https://pigsty.io/docs/deploy) 3-node HA Postgres cluster `pg-test`. Add the cluster [**definition**](https://github.com/pgsty/pigsty/blob/main/conf/ha/full.yml#L66) to the [**config inventory**](https://pigsty.io/docs/concept/iac/inventory):\n\n```yaml \npg-test:\n  hosts:\n    10.10.10.11: { pg_seq: 1, pg_role: primary }\n    10.10.10.12: { pg_seq: 2, pg_role: replica }\n    10.10.10.13: { pg_seq: 3, pg_role: offline }\n  vars: { pg_cluster: pg-test }\n```\n\nThe default config file is [`pigsty.yml`](https://github.com/pgsty/pigsty/blob/main/pigsty.yml) under pigsty home, add the snippet above to the `all.children.pg-test`,\nThen, create the cluster with built-in playbooks in one command:\n\n```bash\nbin/pgsql-add pg-test   # init pg-test cluster \n```\n\n\u003cdetails\u003e\u003csummary\u003eExample: Complex PostgreSQL Customization\u003c/summary\u003e\u003cbr\u003e\n\nThis config file provides a detailed example of a complex PostgreSQL cluster `pg-meta` with multiple \n[databases](https://pigsty.io/docs/pgsql/config/db), [users](https://pigsty.io/docs/pgsql/config/user), and [service](https://pigsty.io/docs/pgsql/service) definition:\n\n```yaml\npg-meta:\n  hosts: { 10.10.10.10: { pg_seq: 1, pg_role: primary , pg_offline_query: true } }\n  vars:\n    pg_cluster: pg-meta\n    pg_databases:                       # define business databases on this cluster, array of database definition\n      - name: meta                      # REQUIRED, `name` is the only mandatory field of a database definition\n        baseline: cmdb.sql              # optional, database sql baseline path, (relative path among ansible search path, e.g files/)\n        pgbouncer: true                 # optional, add this database to pgbouncer database list? true by default\n        schemas: [pigsty]               # optional, additional schemas to be created, array of schema names\n        extensions:                     # optional, additional extensions to be installed: array of `{name[,schema]}`\n          - { name: postgis , schema: public }\n          - { name: timescaledb }\n        comment: pigsty meta database   # optional, comment string for this database\n        owner: postgres                # optional, database owner, postgres by default\n        template: template1            # optional, which template to use, template1 by default\n        encoding: UTF8                 # optional, database encoding, UTF8 by default. (MUST same as template database)\n        locale: C                      # optional, database locale, C by default.  (MUST same as template database)\n        lc_collate: C                  # optional, database collate, C by default. (MUST same as template database)\n        lc_ctype: C                    # optional, database ctype, C by default.   (MUST same as template database)\n        tablespace: pg_default         # optional, default tablespace, 'pg_default' by default.\n        allowconn: true                # optional, allow connection, true by default. false will disable connect at all\n        revokeconn: false              # optional, revoke public connection privilege. false by default. (leave connect with grant option to owner)\n        register_datasource: true      # optional, register this database to grafana datasources? true by default\n        connlimit: -1                  # optional, database connection limit, default -1 disable limit\n        pool_auth_user: dbuser_meta    # optional, all connection to this pgbouncer database will be authenticated by this user\n        pool_mode: transaction         # optional, pgbouncer pool mode at database level, default transaction\n        pool_size: 64                  # optional, pgbouncer pool size at database level, default 64\n        pool_reserve: 32               # optional, pgbouncer pool size reserve at database level, default 32\n        pool_size_min: 0               # optional, pgbouncer pool size min at database level, default 0\n        pool_connlimit: 100            # optional, max database connections at database level, default 100\n        # shared parameters for CREATE DATABASE (shared with PostgreSQL)\n        is_template: false             # optional, mark this database as template? default false\n        strategy: wal_log              # optional (shared), PostgreSQL 15+, wal_log or file_copy\n        locale_provider: libc          # optional (shared), PostgreSQL 15+, icu or libc\n        icu_locale: ''                 # optional (shared), PostgreSQL 15+, ICU locale\n        icu_rules: ''                  # optional (shared), PostgreSQL 16+, ICU rules\n        builtin_locale: ''             # optional (shared), PostgreSQL 17+, builtin locale\n        parameters: {}                 # optional, database-level parameters with `ALTER DATABASE SET`\n      - { name: grafana  ,owner: dbuser_grafana  ,revokeconn: true ,comment: grafana primary database }\n      - { name: bytebase ,owner: dbuser_bytebase ,revokeconn: true ,comment: bytebase primary database }\n      - { name: kong     ,owner: dbuser_kong     ,revokeconn: true ,comment: kong the api gateway database }\n      - { name: gitea    ,owner: dbuser_gitea    ,revokeconn: true ,comment: gitea meta database }\n      - { name: wiki     ,owner: dbuser_wiki     ,revokeconn: true ,comment: wiki meta database }\n    pg_users:                           # define business users/roles on this cluster, array of user definition\n      - name: dbuser_meta               # REQUIRED, `name` is the only mandatory field of a user definition\n        password: DBUser.Meta           # optional, password, can be a scram-sha-256 hash string or plain text\n        login: true                     # optional, can log in, true by default  (new biz ROLE should be false)\n        superuser: false                # optional, is superuser? false by default\n        createdb: false                 # optional, can create database? false by default\n        createrole: false               # optional, can create role? false by default\n        inherit: true                   # optional, can this role use inherited privileges? true by default\n        replication: false              # optional, can this role do replication? false by default\n        bypassrls: false                # optional, can this role bypass row level security? false by default\n        pgbouncer: true                 # optional, add this user to pgbouncer user-list? false by default (production user should be true explicitly)\n        connlimit: -1                   # optional, user connection limit, default -1 disable limit\n        expire_in: 3650                 # optional, now + n days when this role is expired (OVERWRITE expire_at)\n        expire_at: '2030-12-31'         # optional, YYYY-MM-DD 'timestamp' when this role is expired  (OVERWRITTEN by expire_in)\n        comment: pigsty admin user      # optional, comment string for this user/role\n        roles: [dbrole_admin]           # optional, belonged roles. default roles are: dbrole_{admin,readonly,readwrite,offline}\n        parameters: {}                  # optional, role level parameters with `ALTER ROLE SET`\n        pool_mode: transaction          # optional, pgbouncer pool mode at user level, transaction by default\n        pool_connlimit: -1              # optional, max database connections at user level, default -1 disable limit\n        # shared parameters for CREATE ROLE (shared with PostgreSQL)\n        # roles can also be defined in extended format for fine-grained control (PostgreSQL 16+)\n        # roles:\n        #   - dbrole_readwrite             # simple format: just grant the role\n        #   - name: dbrole_admin           # extended format with options\n        #     state: grant                 # grant (default) | revoke/absent\n        #     admin: false                 # grant with admin option? (default false)\n        #     inherit: true                # grant with inherit option? (PG16+, default null)\n        #     set: true                    # grant with set option? (PG16+, default null)\n      - {name: dbuser_view     ,password: DBUser.Viewer   ,pgbouncer: true ,roles: [dbrole_readonly], comment: read-only viewer for meta database}\n      - {name: dbuser_grafana  ,password: DBUser.Grafana  ,pgbouncer: true ,roles: [dbrole_admin]    ,comment: admin user for grafana database   }\n      - {name: dbuser_bytebase ,password: DBUser.Bytebase ,pgbouncer: true ,roles: [dbrole_admin]    ,comment: admin user for bytebase database  }\n      - {name: dbuser_kong     ,password: DBUser.Kong     ,pgbouncer: true ,roles: [dbrole_admin]    ,comment: admin user for kong api gateway   }\n      - {name: dbuser_gitea    ,password: DBUser.Gitea    ,pgbouncer: true ,roles: [dbrole_admin]    ,comment: admin user for gitea service      }\n      - {name: dbuser_wiki     ,password: DBUser.Wiki     ,pgbouncer: true ,roles: [dbrole_admin]    ,comment: admin user for wiki.js service    }\n    pg_services:                        # extra services in addition to pg_default_services, array of service definition\n      # standby service will route {ip|name}:5435 to sync replica's pgbouncer (5435-\u003e6432 standby)\n      - name: standby                   # required, service name, the actual svc name will be prefixed with `pg_cluster`, e.g: pg-meta-standby\n        port: 5435                      # required, service exposed port (work as kubernetes service node port mode)\n        ip: \"*\"                         # optional, service bind ip address, `*` for all ip by default\n        selector: \"[]\"                  # required, service member selector, use JMESPath to filter inventory\n        dest: default                   # optional, destination port, default|postgres|pgbouncer|\u003cport_number\u003e, 'default' by default\n        check: /sync                    # optional, health check url path, / by default\n        backup: \"[? pg_role == `primary`]\"  # backup server selector\n        maxconn: 3000                   # optional, max allowed front-end connection\n        balance: roundrobin             # optional, haproxy load balance algorithm (roundrobin by default, other: leastconn)\n        #options: 'inter 3s fastinter 1s downinter 5s rise 3 fall 3 on-marked-down shutdown-sessions slowstart 30s maxconn 3000 maxqueue 128 weight 100'\n    pg_hba_rules:\n      - {user: dbuser_view , db: all ,addr: infra ,auth: pwd ,title: 'allow grafana dashboard access cmdb from infra nodes'}\n    pg_vip_enabled: true\n    pg_vip_address: 10.10.10.2/24\n    pg_vip_interface: eth1\n    pg_crontab:  # make a full backup 1 am everyday\n      - '00 01 * * * /pg/bin/pg-backup full'\n\n```\n\n[![home](https://pigsty.io/img/pigsty/home.jpg)](https://pigsty.io/img/pigsty/home.jpg)\n\n\u003c/details\u003e\n\nIt will create a cluster with everything properly configured: [**High Availability**](https://pigsty.io/docs/concept/ha) powered by patroni \u0026 etcd; [**Point-In-Time-Recovery**](https://pigsty.io/docs/concept/pitr) powered by pgBackRest \u0026 optional MinIO / S3;\nauto-routed, pooled [**Services \u0026 Access**](https://pigsty.io/docs/pgsql/service#default-service) pooled by pgBouncer and exposed by haproxy; and out-of-the-box [**Monitoring**](https://pigsty.io/docs/pgsql/monitor/dashboard) \u0026 alerting powered by the **`INFRA`** module.\n\n[![HA PostgreSQL Arch](https://pigsty.io/img/pigsty/ha.png)](https://pigsty.io/docs/concept/ha)\n\nThe cluster keeps serving as long as **ANY** instance survives, with excellent [**Fault-Tolerance**](https://pigsty.io/docs/concept/ha/failure) performance:\n\n\u003e [**RPO = 0**](https://pigsty.io/docs/concept/ha/rpo) on sync mode, **RPO \u003c 1MB** on async mode; **RTO ~ 2s** on switchover, [**RTO \u003c 30s**](https://pigsty.io/docs/concept/ha/rto) on failover.\n\n\n\n\n----------------\n\n## Customization\n\nPigsty is highly customizable. You can describe the entire database and infra deployment with **300+** [**parameters**](https://pigsty.io/docs/concept/iac/inventory) in a single config file and materialize them with one command.\nThere are many built-in configuration [**templates**](https://pigsty.io/docs/concept/iac/template).\n\n\u003cdetails\u003e\u003csummary\u003eExample: Sandbox (4-node) with two PG cluster\u003c/summary\u003e\u003cbr\u003e\n\nThe [`conf/full.yml`](https://github.com/pgsty/pigsty/blob/main/conf/full.yml) utilizes four nodes to deploy two PostgreSQL clusters, `pg-meta` and `pg-test`:\n\n```yaml\npg-meta:\n  hosts: { 10.10.10.10: { pg_seq: 1, pg_role: primary } }\n  vars:\n    pg_cluster: pg-meta\n    pg_users:\n      - {name: dbuser_meta     ,password: DBUser.Meta     ,pgbouncer: true ,roles: [dbrole_admin]    ,comment: pigsty admin user }\n      - {name: dbuser_view     ,password: DBUser.Viewer   ,pgbouncer: true ,roles: [dbrole_readonly] ,comment: read-only viewer for meta database }\n    pg_databases:\n      - {name: meta ,baseline: cmdb.sql ,comment: pigsty meta database ,schemas: [pigsty]}\n    pg_hba_rules:\n      - {user: dbuser_view , db: all ,addr: infra ,auth: pwd ,title: 'allow grafana dashboard access cmdb from infra nodes'}\n    pg_vip_enabled: true\n    pg_vip_address: 10.10.10.2/24\n    pg_vip_interface: eth1\n\n# pgsql 3 node ha cluster: pg-test\npg-test:\n  hosts:\n    10.10.10.11: { pg_seq: 1, pg_role: primary }   # primary instance, leader of cluster\n    10.10.10.12: { pg_seq: 2, pg_role: replica }   # replica instance, follower of leader\n    10.10.10.13: { pg_seq: 3, pg_role: replica, pg_offline_query: true } # replica with offline access\n  vars:\n    pg_cluster: pg-test           # define pgsql cluster name\n    pg_users:  [{ name: test , password: test , pgbouncer: true , roles: [ dbrole_admin ] }]\n    pg_databases: [{ name: test }]\n    pg_vip_enabled: true\n    pg_vip_address: 10.10.10.3/24\n    pg_vip_interface: eth1\n```\n\nYou can even deploy PostgreSQL with different major versions and kernel forks in the same deployment:\n\n[![kernels](https://pigsty.io/img/pigsty/kernels.jpg)](https://pigsty.io/docs/pgsql/kernel)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eExample: Security Setup \u0026 Delayed Replica\u003c/summary\u003e\u003cbr\u003e\n\nThe following [`conf/safe.yml`](https://github.com/pgsty/pigsty/blob/main/conf/ha/safe.yml) provisions a 4-node [security](https://pigsty.io/docs/deploy/security//) enhanced PostgreSQL cluster `pg-meta` with a delayed replica `pg-meta-delay`:\n\n```yaml\npg-meta:      # 3 instance postgres cluster `pg-meta`\n  hosts:\n    10.10.10.10: { pg_seq: 1, pg_role: primary }\n    10.10.10.11: { pg_seq: 2, pg_role: replica }\n    10.10.10.12: { pg_seq: 3, pg_role: replica , pg_offline_query: true }\n  vars:\n    pg_cluster: pg-meta\n    pg_conf: crit.yml\n    pg_users:\n      - { name: dbuser_meta , password: DBUser.Meta   , pgbouncer: true , roles: [ dbrole_admin ] , comment: pigsty admin user }\n      - { name: dbuser_view , password: DBUser.Viewer , pgbouncer: true , roles: [ dbrole_readonly ] , comment: read-only viewer for meta database }\n    pg_databases:\n      - {name: meta ,baseline: cmdb.sql ,comment: pigsty meta database ,schemas: [pigsty] ,extensions: [{name: postgis, schema: public}, {name: timescaledb}]}\n    pg_default_service_dest: postgres\n    pg_services:\n      - { name: standby ,src_ip: \"*\" ,port: 5435 , dest: default ,selector: \"[]\" , backup: \"[? pg_role == `primary`]\" }\n    pg_vip_enabled: true\n    pg_vip_address: 10.10.10.2/24\n    pg_vip_interface: eth1\n    pg_listen: '${ip},${vip},${lo}'\n    patroni_ssl_enabled: true\n    pgbouncer_sslmode: require\n    pgbackrest_method: minio\n    pg_libs: 'timescaledb, $libdir/passwordcheck, pg_stat_statements, auto_explain' # add passwordcheck extension to enforce strong password\n    pg_default_roles:                 # default roles and users in postgres cluster\n      - { name: dbrole_readonly  ,login: false ,comment: role for global read-only access     }\n      - { name: dbrole_offline   ,login: false ,comment: role for restricted read-only access }\n      - { name: dbrole_readwrite ,login: false ,roles: [dbrole_readonly]               ,comment: role for global read-write access }\n      - { name: dbrole_admin     ,login: false ,roles: [pg_monitor, dbrole_readwrite]  ,comment: role for object creation }\n      - { name: postgres     ,superuser: true  ,expire_in: 7300                        ,comment: system superuser }\n      - { name: replicator ,replication: true  ,expire_in: 7300 ,roles: [pg_monitor, dbrole_readonly]   ,comment: system replicator }\n      - { name: dbuser_dba   ,superuser: true  ,expire_in: 7300 ,roles: [dbrole_admin]  ,pgbouncer: true ,pool_mode: session, pool_connlimit: 16 , comment: pgsql admin user }\n      - { name: dbuser_monitor ,roles: [pg_monitor] ,expire_in: 7300 ,pgbouncer: true ,parameters: {log_min_duration_statement: 1000 } ,pool_mode: session ,pool_connlimit: 8 ,comment: pgsql monitor user }\n    pg_default_hba_rules:             # postgres host-based auth rules by default\n      - {user: '${dbsu}'    ,db: all         ,addr: local     ,auth: ident ,title: 'dbsu access via local os user ident'  }\n      - {user: '${dbsu}'    ,db: replication ,addr: local     ,auth: ident ,title: 'dbsu replication from local os ident' }\n      - {user: '${repl}'    ,db: replication ,addr: localhost ,auth: ssl   ,title: 'replicator replication from localhost'}\n      - {user: '${repl}'    ,db: replication ,addr: intra     ,auth: ssl   ,title: 'replicator replication from intranet' }\n      - {user: '${repl}'    ,db: postgres    ,addr: intra     ,auth: ssl   ,title: 'replicator postgres db from intranet' }\n      - {user: '${monitor}' ,db: all         ,addr: localhost ,auth: pwd   ,title: 'monitor from localhost with password' }\n      - {user: '${monitor}' ,db: all         ,addr: infra     ,auth: ssl   ,title: 'monitor from infra host with password'}\n      - {user: '${admin}'   ,db: all         ,addr: infra     ,auth: ssl   ,title: 'admin @ infra nodes with pwd \u0026 ssl'   }\n      - {user: '${admin}'   ,db: all         ,addr: world     ,auth: cert  ,title: 'admin @ everywhere with ssl \u0026 cert'   }\n      - {user: '+dbrole_readonly',db: all    ,addr: localhost ,auth: ssl   ,title: 'pgbouncer read/write via local socket'}\n      - {user: '+dbrole_readonly',db: all    ,addr: intra     ,auth: ssl   ,title: 'read/write biz user via password'     }\n      - {user: '+dbrole_offline' ,db: all    ,addr: intra     ,auth: ssl   ,title: 'allow etl offline tasks from intranet'}\n    pgb_default_hba_rules:            # pgbouncer host-based authentication rules\n      - {user: '${dbsu}'    ,db: pgbouncer   ,addr: local     ,auth: peer  ,title: 'dbsu local admin access with os ident'}\n      - {user: 'all'        ,db: all         ,addr: localhost ,auth: pwd   ,title: 'allow all user local access with pwd' }\n      - {user: '${monitor}' ,db: pgbouncer   ,addr: intra     ,auth: ssl   ,title: 'monitor access via intranet with pwd' }\n      - {user: '${monitor}' ,db: all         ,addr: world     ,auth: deny  ,title: 'reject all other monitor access addr' }\n      - {user: '${admin}'   ,db: all         ,addr: intra     ,auth: ssl   ,title: 'admin access via intranet with pwd'   }\n      - {user: '${admin}'   ,db: all         ,addr: world     ,auth: deny  ,title: 'reject all other admin access addr'   }\n      - {user: 'all'        ,db: all         ,addr: intra     ,auth: ssl   ,title: 'allow all user intra access with pwd' }\n\n# OPTIONAL delayed cluster for pg-meta\npg-meta-delay:                    # delayed instance for pg-meta (1 hour ago)\n  hosts: { 10.10.10.13: { pg_seq: 1, pg_role: primary, pg_upstream: 10.10.10.10, pg_delay: 1h } }\n  vars: { pg_cluster: pg-meta-delay }\n```\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\u003csummary\u003eExample: Horizontal Sharding with Citus\u003c/summary\u003e\u003cbr\u003e\n\nYou can perform horizontal sharding on vanilla postgres with [**`CITUS`**](https://pigsty.io/docs/pgsql/kernel/citus/).\n\n```yaml\n# pg-citus: 10 node citus cluster (5 x primary-replica pair)\npg-citus: # citus group\n  hosts:\n    10.10.10.50: { pg_group: 0, pg_cluster: pg-citus0 ,pg_vip_address: 10.10.10.60/24 ,pg_seq: 0, pg_role: primary }\n    10.10.10.51: { pg_group: 0, pg_cluster: pg-citus0 ,pg_vip_address: 10.10.10.60/24 ,pg_seq: 1, pg_role: replica }\n    10.10.10.52: { pg_group: 1, pg_cluster: pg-citus1 ,pg_vip_address: 10.10.10.61/24 ,pg_seq: 0, pg_role: primary }\n    10.10.10.53: { pg_group: 1, pg_cluster: pg-citus1 ,pg_vip_address: 10.10.10.61/24 ,pg_seq: 1, pg_role: replica }\n    10.10.10.54: { pg_group: 2, pg_cluster: pg-citus2 ,pg_vip_address: 10.10.10.62/24 ,pg_seq: 0, pg_role: primary }\n    10.10.10.55: { pg_group: 2, pg_cluster: pg-citus2 ,pg_vip_address: 10.10.10.62/24 ,pg_seq: 1, pg_role: replica }\n    10.10.10.56: { pg_group: 3, pg_cluster: pg-citus3 ,pg_vip_address: 10.10.10.63/24 ,pg_seq: 0, pg_role: primary }\n    10.10.10.57: { pg_group: 3, pg_cluster: pg-citus3 ,pg_vip_address: 10.10.10.63/24 ,pg_seq: 1, pg_role: replica }\n    10.10.10.58: { pg_group: 4, pg_cluster: pg-citus4 ,pg_vip_address: 10.10.10.64/24 ,pg_seq: 0, pg_role: primary }\n    10.10.10.59: { pg_group: 4, pg_cluster: pg-citus4 ,pg_vip_address: 10.10.10.64/24 ,pg_seq: 1, pg_role: replica }\n  vars:\n    pg_mode: citus                    # pgsql cluster mode: citus\n    pg_shard: pg-citus                # citus shard name: pg-citus\n    pg_primary_db: test               # primary database used by citus\n    pg_dbsu_password: DBUser.Postgres # all dbsu password access for citus cluster\n    pg_vip_enabled: true\n    pg_vip_interface: eth1\n    pg_extensions: [ 'citus postgis timescaledb pgvector' ]\n    pg_libs: 'citus, timescaledb, pg_stat_statements, auto_explain' # citus will be added by patroni automatically\n    pg_users: [ { name: test ,password: test ,pgbouncer: true ,roles: [ dbrole_admin ] } ]\n    pg_databases: [ { name: test ,owner: test ,extensions: [ { name: citus }, { name: postgis } ] } ]\n    pg_hba_rules:\n      - { user: 'all' ,db: all  ,addr: 10.10.10.0/24 ,auth: trust ,title: 'trust citus cluster members'        }\n      - { user: 'all' ,db: all  ,addr: 127.0.0.1/32  ,auth: ssl   ,title: 'all user ssl access from localhost' }\n      - { user: 'all' ,db: all  ,addr: intra         ,auth: ssl   ,title: 'all user ssl access from intranet'  }\n```\n\n[![citus](https://pigsty.io/img/pigsty/citus.jpg)](https://pigsty.io/docs/pgsql/kernel/citus)\n\n\u003c/details\u003e\n\n\nYou can deploy different kinds of PostgreSQL instance such as [`primary`](https://pigsty.io/docs/pgsql/config/cluster#primary), [`replica`](https://pigsty.io/docs/pgsql/config/cluster#replica), [`offline`](https://pigsty.io/docs/pgsql/config/cluster#offline), [`delayed`](https://pigsty.io/docs/pgsql/config/cluster#delayed), [`sync standby`](https://pigsty.io/docs/pgsql/config/cluster#sync-standby), etc.,\nand customize with scene-optimize [**config templates**](https://pigsty.io/docs/concept/iac/template) and all **460+** [**extensions**](https://pgext.cloud/list) out-of-the-box.\n\nYou can define [**Users**](https://pigsty.io/docs/pgsql/config/user), [**Databases**](https://pigsty.io/docs/pgsql/config/db), [**Service**](https://pigsty.io/docs/pgsql/service), [**HBAs**](https://pigsty.io/docs/pgsql/config/hba) and other entities with code and provision them in one pass.\n\n--------\n\nYou can also self-host postgres-centric software like [**`SUPABASE`**](https://pigsty.io/docs/app/supabase), [**`Odoo`**](https://pigsty.io/docs/app/odoo) \u0026 [**`Dify`**](https://pigsty.io/docs/app/dify), Electric, GitLab, ... with Pigsty:\n\n\u003cdetails\u003e\u003csummary\u003eExample: Self-hosting Supabase\u003c/summary\u003e\u003cbr\u003e\n\nYou can launch a [self-hosting supabase](https://pigsty.io/docs/app/supabase) with MinIO and PostgreSQL with just several commands:\n\n```bash\n./configure -c supabase    # use supabase config \n./deploy.yml               # install pigsty\n./docker.yml               # install docker compose\n./app.yml                  # launch supabase stateless part with docker\n```\n\nThe [`conf/supabase.yml`](https://github.com/pgsty/pigsty/blob/main/conf/supabase.yml) just describes everything you need:\n\n```yaml\npg-meta:\n  hosts: { 10.10.10.10: { pg_seq: 1, pg_role: primary } }\n  vars:\n    pg_cluster: pg-meta\n    pg_users:\n      # supabase roles: anon, authenticated, dashboard_user\n      - { name: anon           ,login: false }\n      - { name: authenticated  ,login: false }\n      - { name: dashboard_user ,login: false ,replication: true ,createdb: true ,createrole: true }\n      - { name: service_role   ,login: false ,bypassrls: true }\n      # supabase users: please use the same password\n      - { name: supabase_admin             ,password: 'DBUser.Supa' ,pgbouncer: true ,inherit: true   ,roles: [ dbrole_admin ] ,superuser: true ,replication: true ,createdb: true ,createrole: true ,bypassrls: true }\n      - { name: authenticator              ,password: 'DBUser.Supa' ,pgbouncer: true ,inherit: false  ,roles: [ dbrole_admin, authenticated ,anon ,service_role ] }\n      - { name: supabase_auth_admin        ,password: 'DBUser.Supa' ,pgbouncer: true ,inherit: false  ,roles: [ dbrole_admin ] ,createrole: true }\n      - { name: supabase_storage_admin     ,password: 'DBUser.Supa' ,pgbouncer: true ,inherit: false  ,roles: [ dbrole_admin, authenticated ,anon ,service_role ] ,createrole: true }\n      - { name: supabase_functions_admin   ,password: 'DBUser.Supa' ,pgbouncer: true ,inherit: false  ,roles: [ dbrole_admin ] ,createrole: true }\n      - { name: supabase_replication_admin ,password: 'DBUser.Supa' ,replication: true ,roles: [ dbrole_admin ]}\n      - { name: supabase_read_only_user    ,password: 'DBUser.Supa' ,bypassrls: true ,roles: [ dbrole_readonly, pg_read_all_data ] }\n    pg_databases:\n      - name: postgres\n        baseline: supabase.sql\n        owner: supabase_admin\n        comment: supabase postgres database\n        schemas: [ extensions ,auth ,realtime ,storage ,graphql_public ,supabase_functions ,_analytics ,_realtime ]\n        extensions:\n          - { name: pgcrypto  ,schema: extensions } # cryptographic functions\n          - { name: pg_net    ,schema: extensions } # async HTTP\n          - { name: pgjwt     ,schema: extensions } # json web token API for postgres\n          - { name: uuid-ossp ,schema: extensions } # generate universally unique identifiers (UUIDs)\n          - { name: pgsodium        }               # pgsodium is a modern cryptography library for Postgres.\n          - { name: supabase_vault  }               # Supabase Vault Extension\n          - { name: pg_graphql      }               # pg_graphql: GraphQL support\n          - { name: pg_jsonschema   }               # pg_jsonschema: Validate json schema\n          - { name: wrappers        }               # wrappers: FDW collections\n          - { name: http            }               # http: allows web page retrieval inside the database.\n          - { name: pg_cron         }               # pg_cron: Job scheduler for PostgreSQL\n          - { name: timescaledb     }               # timescaledb: Enables scalable inserts and complex queries for time-series data\n          - { name: pg_tle          }               # pg_tle: Trusted Language Extensions for PostgreSQL\n          - { name: vector          }               # pgvector: the vector similarity search\n          - { name: pgmq            }               # pgmq: A lightweight message queue like AWS SQS and RSMQ\n    # supabase required extensions\n    pg_libs: 'timescaledb, plpgsql, plpgsql_check, pg_cron, pg_net, pg_stat_statements, auto_explain, pg_tle, plan_filter'\n    pg_parameters:\n      cron.database_name: postgres\n      pgsodium.enable_event_trigger: off\n    pg_hba_rules: # supabase hba rules, require access from docker network\n      - { user: all ,db: postgres  ,addr: intra         ,auth: pwd ,title: 'allow supabase access from intranet'    }\n      - { user: all ,db: postgres  ,addr: 172.17.0.0/16 ,auth: pwd ,title: 'allow access from local docker network' }\n    pg_crontab: [ '00 01 * * * /pg/bin/pg-backup full' ] # make a full backup every 1am\n```\n\n![](https://pigsty.io/img/docs/supa-home.png)\n\n\u003c/details\u003e\n\nThere are other pro, beta, or pilot modules, and there will be more coming in the future:\n\n[![SUPABASE](https://img.shields.io/badge/SUPABASE-%233FCF8E?style=flat\u0026logo=supabase\u0026labelColor=3FCF8E\u0026logoColor=white)](https://pigsty.io/docs/pgsql/kernel/supabase)\n[![KAFKA](https://img.shields.io/badge/KAFKA-%23231F20?style=flat\u0026logo=apachekafka\u0026labelColor=231F20\u0026logoColor=white)](https://pigsty.io/docs/pilot/kafka)\n[![MYSQL](https://img.shields.io/badge/MYSQL-%234479A1?style=flat\u0026logo=mysql\u0026labelColor=4479A1\u0026logoColor=white)](https://pigsty.io/docs/pilot/mysql)\n[![DUCKDB](https://img.shields.io/badge/DUCKDB-%23FFF000?style=flat\u0026logo=duckdb\u0026labelColor=FFF000\u0026logoColor=white)](https://pigsty.io/docs/pilot/duckdb)\n[![TIGERBEETLE](https://img.shields.io/badge/TIGERBEETLE-%231919191?style=flat\u0026logo=openbugbounty\u0026labelColor=1919191\u0026logoColor=white)](https://pigsty.io/docs/pilot/tigerbeetle)\n[![VICTORIA](https://img.shields.io/badge/VICTORIA-%23621773?style=flat\u0026logo=victoriametrics\u0026labelColor=621773\u0026logoColor=white)](https://pigsty.io/docs/infra/)\n[![KUBERNETES](https://img.shields.io/badge/KUBERNETES-%23326CE5?style=flat\u0026logo=kubernetes\u0026labelColor=326CE5\u0026logoColor=white)](https://pigsty.io/docs/pilot/kube)\n[![CONSUL](https://img.shields.io/badge/CONSUL-%23F24C53?style=flat\u0026logo=consul\u0026labelColor=F24C53\u0026logoColor=white)](https://pigsty.io/docs/pilot/consul)\n[![JUPYTER](https://img.shields.io/badge/JUPYTER-%23F37626?style=flat\u0026logo=jupyter\u0026labelColor=F37626\u0026logoColor=white)](https://pigsty.io/docs/vibe/)\n\n\n----------------\n\n## Compatibility\n\nWe recommend using RockyLinux 10.1 / 9.7, Debian 13.3 / 12.13, and Ubuntu 24.04.4 / 22.04.5 for production use.\n\nPigsty runs directly on bare Linux, and focuses on actively maintained mainstream LTS [**Linux Distributions**](https://pigsty.io/docs/ref/linux):\n\n|   Code   | Distro                 | Minor   |                      `x86_64`                       | Status |                       `aarch64`                       | Status |\n|:--------:|------------------------|---------|:---------------------------------------------------:|:------:|:-----------------------------------------------------:|:------:|\n| **EL10** | RHEL / Rocky / Alma 10 | 10.1    | [`el10.x86_64`](roles/node_id/vars/el10.x86_64.yml) |  🌐📦  | [`el10.aarch64`](roles/node_id/vars/el10.aarch64.yml) |  🌐📦  |\n| **EL9**  | RHEL / Rocky / Alma 9  | 9.7     |  [`el9.x86_64`](roles/node_id/vars/el9.x86_64.yml)  |  🌐📦  |  [`el9.aarch64`](roles/node_id/vars/el9.aarch64.yml)  |  🌐📦  |\n| **U24**  | Ubuntu 24.04 (noble)   | 24.04.4 |  [`u24.x86_64`](roles/node_id/vars/u24.x86_64.yml)  |  🌐📦  |  [`u24.aarch64`](roles/node_id/vars/u24.aarch64.yml)  |  🌐📦  |\n| **U22**  | Ubuntu 22.04 (jammy)   | 22.04.5 |  [`u22.x86_64`](roles/node_id/vars/u22.x86_64.yml)  |  🌐📦  |  [`u22.aarch64`](roles/node_id/vars/u22.aarch64.yml)  |  🌐📦  |\n| **D13**  | Debian 13 (trixie)     | 13.3    |  [`d13.x86_64`](roles/node_id/vars/d13.x86_64.yml)  |  🌐📦  |  [`d13.aarch64`](roles/node_id/vars/d13.aarch64.yml)  |  🌐📦  |\n| **D12**  | Debian 12 (bookworm)   | 12.13   |  [`d12.x86_64`](roles/node_id/vars/d12.x86_64.yml)  |  🌐📦  |  [`d12.aarch64`](roles/node_id/vars/d12.aarch64.yml)  |  🌐📦  |\n\n\n## Sponsors\n\nMany thanks to our contributors and sponsors for making Pigsty possible.\nSpecial thanks to MiraclePlus for funding, to Cloudflare for hosting the Pigsty repo, and to Vercel for hosting the Pigsty website.\n\n[![Vercel OSS Program](https://vercel.com/oss/program-badge.svg)](https://vercel.com/oss)\n\n\n## License\n\nPigsty is licensed under [**Apache-2.0**](LICENSE). Check [**NOTICE**](NOTICE) and [**License Documentation**](https://pigsty.io/docs/about/license) for details.  \n\n\n## About\n\n[![Website: pigsty.io](https://img.shields.io/badge/website-slategray?style=flat\u0026logo=cilium\u0026logoColor=white)](https://pigsty.io)\n[![Github: Discussions](https://img.shields.io/badge/GitHub-Discussions-slategray?style=flat\u0026logo=github\u0026logoColor=black)](https://github.com/pgsty/pigsty/discussions)\n[![Telegram: gV9zfZraNPM3YjFh](https://img.shields.io/badge/Telegram-gV9zfZraNPM3YjFh-cornflowerblue?style=flat\u0026logo=telegram\u0026logoColor=cornflowerblue)](https://t.me/joinchat/gV9zfZraNPM3YjFh)\n[![Discord: j5pG8qfKxU](https://img.shields.io/badge/Discord-j5pG8qfKxU-mediumpurple?style=flat\u0026logo=discord\u0026logoColor=mediumpurple)](https://discord.gg/j5pG8qfKxU)\n[![Wechat: pigsty-cc](https://img.shields.io/badge/WeChat-pigsty--cc-green?style=flat\u0026logo=wechat\u0026logoColor=green)](https://pigsty.io/img/pigsty/pigsty-cc.jpg)\n[![QQ: 619377403](https://img.shields.io/badge/QQ-619377403-blue?style=flat\u0026logo=qq)](https://qm.qq.com/q/vm8LIeUqGc)\n\n[![Author: RuohangFeng](https://img.shields.io/badge/Author-Ruohang_Feng-steelblue?style=flat)](https://vonng.com/en)\n[![About: @Vonng](https://img.shields.io/badge/%40Vonng-steelblue?style=flat)](https://github.com/Vonng)\n[![Mail: rh@vonng.com](https://img.shields.io/badge/rh%40vonng.com-steelblue?style=flat)](mailto:rh@vonng.com)\n[![Copyright: 2018-2026 rh@Vonng.com](https://img.shields.io/badge/Copyright-2018--2026_(rh%40vonng.com)-red?logo=c\u0026color=steelblue)](https://github.com/Vonng)\n[![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-steelblue?style=flat\u0026logo=opensourceinitiative\u0026logoColor=green)](https://pigsty.io/docs/about/license/)\n[![Subscription: PGSTY PRO](https://img.shields.io/badge/Subscription-Pricing-steelblue?style=flat)](https://pigsty.cc/price)\n","funding_links":[],"categories":["Shell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgsty%2Fpigsty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpgsty%2Fpigsty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgsty%2Fpigsty/lists"}