https://github.com/zalando/spilo Skip to content Navigation Menu Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + GitHub Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Enterprise + Enterprise platform AI-powered developer platform Available add-ons + Advanced Security Enterprise-grade security features + GitHub Copilot Enterprise-grade AI features + Premium Support Enterprise-grade 24/7 support * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} zalando / spilo Public * Notifications You must be signed in to change notification settings * Fork 365 * Star 1.4k * Highly available elephant herd: HA PostgreSQL cluster using Docker License Apache-2.0 license 1.4k stars 365 forks Branches Tags Activity Star Notifications You must be signed in to change notification settings * Code * Issues 53 * Pull requests 19 * Actions * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Security * Insights zalando/spilo This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master BranchesTags Go to file Code Folders and files Last commit Last Name Name message commit date Latest commit History 833 Commits .github/workflows .github/workflows contrib contrib docs docs etcd-cluster-appliance etcd-cluster-appliance kubernetes kubernetes postgres-appliance postgres-appliance spilo_cmd spilo_cmd .gitmodules .gitmodules .zappr.yaml .zappr.yaml BUGS.md BUGS.md CONTRIBUTING.rst CONTRIBUTING.rst ENVIRONMENT.rst ENVIRONMENT.rst LICENSE LICENSE README.rst README.rst delivery.yaml delivery.yaml mkdocs.yml mkdocs.yml tox.ini tox.ini View all files Repository files navigation * README * Code of conduct * Apache-2.0 license Spilo: HA PostgreSQL Clusters with Docker Spilo is a Docker image that provides PostgreSQL and Patroni bundled together. Patroni is a template for PostgreSQL HA. Multiple Spilos can create a resilient High Available PostgreSQL cluster. For this, you'll need to start all participating Spilos with identical etcd addresses and cluster names. Spilo's name derives from spilo [spi:la], the Georgian word for "elephant." Real-World Usage and Plans Spilo is currently evolving: Its creators are working on a Postgres operator that would make it simpler to deploy scalable Postgres clusters in a Kubernetes environment, and also do maintenance tasks. Spilo would serve as an essential building block for this. There is already a Helm chart that relies on Spilo and Patroni to provision a five-node PostgreSQL HA cluster in a Kubernetes+Google Compute Engine environment. (The Helm chart deploys Spilo Docker images, not just "bare" Patroni.) How to Use This Docker Image Spilo's setup assumes that you've correctly configured a load balancer (HAProxy, ELB, Google load balancer) that directs client connections to the master. There are two ways to achieve this: A) if the load balancer relies on the status code to distinguish between the healthy and failed nodes (like ELB), then one needs to configure it to poll the API URL; otherwise, B) you can use callback scripts to change the load balancer configuration dynamically. Available container registry and image architectures Spilo images are made available in the GitHub container registry (ghcr.io). Images are build and published as linux/amd64 and linux/ arm64 on tag. For PostgreSQL version 14 currently availble images can be found here: https://github.com/zalando/spilo/pkgs/container/ spilo-14 How to Build This Docker Image $ cd postgres-appliance $ docker build --tag $YOUR_TAG . There are a few build arguments defined in the Dockerfile and it is possible to change them by specifying --build-arg arguments: * WITH_PERL=false # set to true if you want to install perl and plperl packages into image * PGVERSION="12" * PGOLDVERSIONS="9.5 9.6 10 11" * DEMO=false # set to true to build the smallest possible image which will work only on Kubernetes * TIMESCALEDB_APACHE_ONLY=true # set to false to build timescaledb community version (Timescale License) * TIMESCALEDB_TOOLKIT=true # set to false to skip installing toolkit with timescaledb community edition. Only relevant when TIMESCALEDB_APACHE_ONLY=false * ADDITIONAL_LOCALES= # additional UTF-8 locales to build into image (example: "de_DE pl_PL fr_FR") Run the image locally after build: $ docker run -it your-spilo-image:$YOUR_TAG Have a look inside the container: $ docker exec -it $CONTAINER_NAME bash Connecting to PostgreSQL Administrative Connections PostgreSQL is configured by default to listen to port 5432. Spilo master initializes PostgreSQL and creates the superuser and replication user (postgres and standby by default). You'll need to setup Spilo to create a database and roles for your application(s). For example: psql -h myfirstspilo.example.com -p 5432 -U admin -d postgres Application Connections Once you have created a database and roles for your application, you can connect to Spilo just like you want to connect to any other PostgreSQL cluster: psql -h myfirstspilo.example.com -p 5432 -U wow_app -d wow psql -d "postgresql://myfirstspilo.example.com:5432/wow?user=wow_app" Configuration Spilo is configured via environment variables, the values of which are either supplied manually via the environment (whenever Spilo is launched as a set of Docker containers) or added in the configuration file or manifest (whenever Spilo is used in the Docker orchestration environment, such as Kubernetes or Docker Compose). Please go here to see our list of environment variables. To supply env variables manually via the environment for local testing: docker run -it -e YOUR_ENV_VAR=test your-spilo-image:latest Issues and Contributing Spilo welcomes questions via our issues tracker. We also greatly appreciate fixes, feature requests, and updates; before submitting a pull request, please visit our contributor guidelines. License This project uses the Apache 2.0 license. About Highly available elephant herd: HA PostgreSQL cluster using Docker Topics python docker docker-image postgresql high-availability patroni data-infrastructure Resources Readme License Apache-2.0 license Code of conduct Code of conduct Activity Custom properties Stars 1.4k stars Watchers 46 watching Forks 365 forks Report repository Releases 29 3.0-p1 Latest Mar 10, 2023 + 28 releases Packages 2 Contributors 95 * @CyberDem0n * @feikesteenbergen * @alexeyklyukin * @hughcapet * @sdudoladov * @avaczi * @a1exsh * @idanovinda * @vosmann * @mpritter76 * @sasadangelo * @joar * @Jan-M * @tnextday + 81 contributors Languages * Python 60.8% * Shell 31.0% * PLpgSQL 6.5% * Dockerfile 1.7% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.