Ansible role for deploying High Availability PostgreSQL
Go to file
Jakub Sokołowski 8a374cb4ea
start: specify compose file path
Allows for renaming it.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-12-07 20:39:01 +01:00
defaults backup: fix location of backup directory 2022-12-06 18:03:55 +01:00
meta add ansible metadata 2022-11-24 13:06:26 +01:00
tasks start: specify compose file path 2022-12-07 20:39:01 +01:00
templates docker: fix path for backup files 2022-12-05 13:07:57 +01:00
README.md add basic readme 2022-11-24 20:55:26 +01:00

README.md

Description

This role configures a High-Availability PostgreSQL Database with replication from master to slaves.

Configuration

To run just one instance without actual High-Availability use:

postgres_ha_db_name: 'example-db'
postgres_ha_admin_user: 'admin'
postgres_ha_admin_pass: 'super-secret-password'

For replicaton other settings

postgres_ha_is_master: '{{ hostname == "node-01.example.org" }}'
postgres_ha_replica_host: 'node-01.example.org'
postgres_ha_replica_port: 5043
postgres_ha_replica_allowed_addresses: ['11.12.13.15']

You can create additional databases using:

# Databases to init
postgres_ha_databases:
  - name: my-db
    user: my-user
    pass: my-pass

  - name: my-other-db
    user: my-other-user
    pass: my-other-pass

The user field is optional. DB name is used by default.

Management

The service is managed using Docker Compose:

admin@node-01.example.org:/docker/postgres-ha % docker-compose ps
   Name                 Command                 State                    Ports
--------------------------------------------------------------------------------------------
postgres-ha   docker-entrypoint.sh -p 5433   Up (healthy)   5432/tcp, 0.0.0.0:5433->5433/tcp