Patroni with docker-compose
  • Python 60.4%
  • Shell 39.6%
Find a file
2023-05-04 20:23:20 +02:00
.gitignore first complete running version! 2022-10-27 03:47:34 -04:00
build-container.sh typo in branch 2023-05-04 20:23:20 +02:00
compose-maker.py persist etcd and restart unless stopped 2022-11-08 15:21:24 +01:00
compose-maker.yaml first running version ;-) 2022-08-04 21:12:39 +02:00
docker-compose-template.yml push to 3.0.2 2023-05-04 20:01:34 +02:00
LICENSE Add LICENSE 2022-10-27 07:49:22 +00:00
patroni.env first complete running version! 2022-10-27 03:47:34 -04:00
Readme.md go up to Alma 8.7 and patroni 3.0.1 2023-03-08 07:33:41 -05:00

Patroni on docker-compose

Goal:

  • make all configs to run a patroni cluster with docker-compose on 3 hosts
  • minimal configuration (only one file!)
  • minimal prerequesites (despite of docker / docker-compose)
  • only for all the people that don't want to use kubernetes (it's much easier in k8s!)

Host system installation

This system is tested with Alma Linux 8.7 hosts. Should work without modification also with Rocky Linux, CentOS 8, Fedora or RHEL8

You need:

  • minimal installation
  • install docker and docker compose
  • make the hosts reachable from this distribution point via root ssh

Example AlmaLinux (RHEL Clone):

sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf remove podman buildah
sudo dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo systemctl enable docker.service --now

I think it's also working with podman and podman-compose, ...

How does it work?

  • install python3
  • install pyyaml pip3 install PyYaml
  • make hosts folder mkdir -p hosts (here are the configs for every single host)
  • edit compose-maker.yaml (which hosts are you using?)
  • run compose-maker.py (make configs based on compose-maker.yaml and docker-compose-template.yaml)
  • distribute with the new script: sh distribute-config.sh (shell script which copies the config to the hosts. Created by compose-maker.py)
  • go to the configured hosts and do the following: cd /opt/patroni; docker compose up -d
  • Ready!

Build the container

There's a script attached (./build-container.sh) which builds the container with the correct configuration

ToDo

  • incorporate my patches (peter pfläging) in the main patroni config
  • mybe better documentation?

Peter Pfläging <peter@pflaeging.net>