Introduction
postgresql_cluster automates the deployment and management of highly available PostgreSQL clusters in production environments. This solution is tailored for use on dedicated physical servers, virtual machines, and within both on-premises and cloud-based infrastructures.
Supported setups of Postgres Cluster
For a detailed description of the cluster components, visit the Architecture page.
Getting Started
You have the option to easily deploy Postgres clusters using the Console (UI) or from the command line with the ansible-playbook command.
- Console (UI)
- Command line
The Console (UI) is the recommended method for most users. It is designed to be user-friendly, minimizing the risk of errors and making it easier than ever to set up your PostgreSQL clusters. This method is suitable for both beginners and those who prefer a visual interface for managing their PostgreSQL clusters.
1. Run the Console container
To run the PostgreSQL Cluster Console, execute the following command:
docker run -d --name pg-console \
--publish 80:80 \
--publish 8080:8080 \
--env PG_CONSOLE_API_URL=http://localhost:8080/api/v1 \
--env PG_CONSOLE_AUTHORIZATION_TOKEN=secret_token \
--env PG_CONSOLE_DOCKER_IMAGE=vitabaks/postgresql_cluster:latest \
--volume console_postgres:/var/lib/postgresql \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume /tmp/ansible:/tmp/ansible \
--restart=unless-stopped \
vitabaks/postgresql_cluster_console:2.0.0
If you are running the console on a dedicated server (rather than on your laptop), replace localhost
with the server’s IP address in the PG_CONSOLE_API_URL
variable.
It is recommended to run the console in the same network as your database servers to enable monitoring of the cluster status.
2. Open the Console UI
Go to http://localhost:80 (or the address of your server) and use secret_token
for authorization.
Refer to the Deployment section to learn more about the different deployment methods.
3. Purchase a Support Package
We recommend considering one of the available support packages for PostgreSQL Cluster to ensure timely assistance and PostgreSQL consultations. You can find more details on the support page.
The command line mode is suitable for advanced users who require greater flexibility and control over the deployment and management of their PostgreSQL clusters. While the Console (UI) is designed for ease of use and is suitable for most users, the command line provides powerful options for those experienced in automation and configuration.
-
Install Ansible on one control node (which could easily be a laptop)
Example:
sudo apt update && sudo apt install -y python3-pip sshpass git
pip3 install ansible -
Download the postgresql_cluster repository
git clone https://github.com/vitabaks/postgresql_cluster.git
-
Go to the automation directory
cd postgresql_cluster/automation
-
Install requirements on the control node
ansible-galaxy install --force -r requirements.yml
noteIf you plan to use Consul (
dcs_type: consul
), install the consul role requirementsansible-galaxy install -r roles/consul/requirements.yml
Refer to the Deployment section to learn more about the different deployment methods.
-
Purchase a Support Package
We recommend considering one of the available support packages for PostgreSQL Cluster to ensure timely assistance and PostgreSQL consultations. You can find more details on the support page.