Your Own Machines
Deploy on existing servers
This method is suitable for deployment on existing servers, whether with another cloud provider or in your own data center.
Prerequisites
You will need root
access or a user with sudo
privileges to access the servers via SSH. You can use your private SSH key (assuming the corresponding public key has already been added to the servers), or a username and password if password access is enabled on your servers.
See also the Requirements and Compatibility pages.
- Console (UI)
- Command line
Select 'Your Own Machines' in the deployment destination.
Specify the name and IP addresses of your servers. Example:
Use private IP addresses so that the cluster does not listen a public IP.
Please note that at least 3 servers are required to ensure high availability.
Select authentication method.
Optionally, specify an IP address to provide a single entry point for client access to databases in the cluster. Example:
This must be an IP address that is currently unused on your network. The address will be assigned to the cluster after deployment.
Not for cloud environments. Because VIP-based solutions like keepalived
or vip-manager
may not works in such environments.
Optionally, check the box for "HAProxy load balancer".
This feature supports load balancing for read operations, facilitating effective scale-out strategies through the use of read-only replicas. See the details on the Architecture page
Choose which environment your database cluster belongs to.
Specify a name for your cluster.
Optionally, specify a description.
Select the PostgreSQL version to install.
Review the summary and click the "CREATE CLUSTER" button.
Wait until deployment is complete. This process takes about 10 minutes.
You can see the deployment log in the "Operations" section. To do this, select the relevant event with the "deploy" type and click "Show details" under the Actions tab.
After a successful deployment, you can obtain the connection info on the cluster page. To do this, click on the name of your cluster on the "Clusters" page.
Example of a cluster page:
📩 Contact us at [email protected], and our team will provide you with deployment instructions tailored specifically to your infrastructure, including the most suitable parameters for optimal performance and reliability.
1. Prepare your inventory file
curl -fsSL https://raw.githubusercontent.com/vitabaks/autobase/refs/tags/2.2.0/automation/inventory \
--output ./inventory
Specify private IP addresses (not hostnames) and appropriate connection settings for your environment, such as ansible_user, ansible_ssh_pass, or ansible_ssh_private_key_file.
nano ./inventory
2. Prepare your variables file
Refer to the default variables for all configurable options. To override defaults, copy the relevant variables into your vars file.
nano ./vars.yml
3. Run the deployment command
docker run --rm -it \
-e ANSIBLE_SSH_ARGS="-F none" \
-e ANSIBLE_INVENTORY=/autobase/inventory \
-v $PWD/inventory:/autobase/inventory \
-v $PWD/vars.yml:/vars.yml \
-v $HOME/.ssh:/root/.ssh \
autobase/automation:2.2.0 \
ansible-playbook deploy_pgcluster.yml -e "@/vars.yml"
Alternatively:
Use the source code
- Edit the inventory file
nano inventory
- Edit the variable files
nano vars/main.yml
- Try to connect to hosts
ansible all -m ping
- Run playbook:
ansible-playbook deploy_pgcluster.yml
4. Wait until deployment is complete
This process takes about 10 to 15 minutes.
After a successful deployment, the connection information can be found in the Ansible log.
How to start from scratch:
If you need to start from scratch, you can use the remove_cluster.yml
playbook.
Click here to expand...
Run the following command to remove the specified components:
ansible-playbook remove_cluster.yml -e "remove_postgres=true remove_etcd=true"
This command will delete the specified components, allowing you to start a new installation.
Available variables:
remove_postgres
: stop the PostgreSQL service and remove data.remove_etcd
: stop the ETCD service and remove data.remove_consul
: stop the Consul service and remove data.
Caution: be careful when running this command in a production environment.
We also support converting your existing PostgreSQL installation into a high-availability cluster. If you want to upgrade your current PostgreSQL setup to a clustered configuration, simply set postgresql_exists=true
in the inventory file.
Please note that during the cluster setup process, your existing PostgreSQL service will be automatically restarted, leading to a brief period of database downtime. Plan this transition accordingly.