DEV Community

ERINFOLAMI PETER
ERINFOLAMI PETER

Posted on

INTRODUCTION TO POSTGRES DEPLOYMENT (edb-deployment) TOOL (PART 1)

INTRODUCTION

You might be wondering what is edb-deployment, well edb-deployment is a tool that gives you the superpower of provisioning cloud resources (like instances, bare-metal servers) in order to deploy your PostgreSQL servers and other tools for monitoring, backup/recovery, high availability etc... on popular cloud providers. The mainly supported cloud providers are AWS, Azure, GCP. It also allows you deploy reference architectures which is reliable and saves you the time and headache of designing a suitable architecture for your resources. Some of the reference architectures supported by edb can be found here. Edb-deployment pretty much does the heavy-lifting for you by just typing in the right commands on your command line.

PRE-REQUISITE

edb-deployment is a tool built on python, so to use this tool you need to have python3 and pip3 installed. You also need to install the cloud vendor cli tool(aws cli, azure cli, google cloud sdk) you intend to deploy on and any other additional deployment tools such as teraform, ansible. The basic pre-requisites here are python3 and pip3, you can pretty much install the other cli tools by running a setup command which we'll see in a bit.

HOW TO INSTALL

You can easily install through pip from pypi using the following command

$ pip3 install edb-deployment
Enter fullscreen mode Exit fullscreen mode

And on a linux device make sure to use the sudo privileges (preferable)

$ sudo pip3 install edb-deployment
Enter fullscreen mode Exit fullscreen mode

And you can also install direcly from the source code, but make sure you have git installed on your machine. To install run the following (assuming you already have github ssh setup)

$ git clone git@github.com:EnterpriseDB/postgres-deployment.git
$ cd postgres-deployment
$ sudo pip3 install . --upgrade
Enter fullscreen mode Exit fullscreen mode

To confirm installation you can run the following command

$ edb-deployment --version
Enter fullscreen mode Exit fullscreen mode

You can also enable command auto completion (this functionality allows you to type commands halfway and complete them with the tab key). This functionality of edb-deployment tool only works for linux shells(bash, ksh). Run the command to enable auto-completion

$ eval "$(register-python-argcomplete edb-deployment)"
Enter fullscreen mode Exit fullscreen mode

After installation you might need to install cloud cli tool in which you intend on deploy with, for example if you need to deploy in aws you'll need the aws cli tool installed. To install the specific cli tool using edb make sure to have to following installed:
gcc (Linux only)
python3-devel (Linux only)
unzip
wget
tar
These packages should be installed through usual package manager (dnf, apt, brew, etc..). Also for debian machines install libffi-dev.
Having met the requirements you also need to install virtualenv(if not already installed) from pip, to allow creation of virtual environments.

$ sudo pip3 install virtualenv
Enter fullscreen mode Exit fullscreen mode

Then run the following to install the necessary cloud vendor cli tools

edb-deployment <CLOUD_VENDOR> setup
Enter fullscreen mode Exit fullscreen mode

CLOUD_VENDOR: aws, terraform, ansible, gcloud, azure

USAGE

Basic usage of this tool is straight forward. The format is

$ edb-deployment <CLOUD_VENDOR> <SUB_COMMAND> [<PROJECT_NAME>]
Enter fullscreen mode Exit fullscreen mode

The supported cloud vendor are:
aws: Amazon Web Services
aws-pot: EDB POT (Proof Of Technology) on AWS Cloud
aws-rds: Amazon Web Services RDS for PostgreSQL
aws-rds-aurora: Amazon Aurora
azure: Microsoft Azure Cloud
azure-pot: EDB POT (Proof Of Technology) on Azure Cloud
azure-db: Microsoft Azure Database
gcloud: Google Cloud
gcloud-pot: EDB POT (Proof Of Technology) on Google Cloud
gcloud-sql: Google Cloud SQL for PostgreSQL

The valid sub commands you can use includes:

configure: New project initialization and configuration
provision: Cloud resources provisioning
destroy: Cloud resources destruction
deploy: Postgres and tools deployment
show: Show configuration
display: Display project inventory
passwords: Display project passwords
list: List projects
specs: Show Cloud Vendor default specifications
logs: Show project logs
remove: Remove project

CONCLUSION

With this basic installation and setup we can start provisioning servers and deploying our resources using different architectures on the cloud. In the next parts I'll walk you through on how to use this tool to deploy on cloud providers(e.g aws) with the basic syntax we've seen in this article.

Top comments (0)