DEV Community

ERINFOLAMI PETER
ERINFOLAMI PETER

Posted on

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

INTRODUCTION

In the last article we talked about the edb-deployment tool, what it does, how to install and setup. In this article we'll see how to use this tool to deploy our PostgreSQL/EDB Postgres Advanced Server.

TOOL USAGE

This article would assume you've installed this tool. To deploy your project using edb-deployment tool there are 5 steps:

1. Configuring your cloud credentials:

This configuration depends on the cloud vendor (aws, gcloud, azure) being used. First you make sure the cloud vendor cli tool has been installed, and if you already installed using the setup command from edb-deployment then you need to update the PATH environment variable using

$ export PATH=$PATH:$HOME/.edb-cloud-tools/bin
Enter fullscreen mode Exit fullscreen mode

You might want to add this line of code in an config init file like .bashrc for linux users. Then you can go ahead and configure your credentials according to the cloud vendor you intend to use. For aws you use the following command aws configure. You can look up other cloud vendors way of configuring here. You might also need to be conversant with using this cloud vendor cli tool and their services to setup your credentials correctly.

2. Configuring your project:
After setting up your cloud credentials and you are logged in then you go on to configure your project. edb-deployment gives you default configuration values relative to your cloud vendor. Configuration values like instance type, disk size, OS image, additional volumes, etc. To change the default values from edb you'll need to dump those values in a json file because it's in json format then you can edit this file to fill in the parameters. Here's the command to run to dump the default values

edb-deployment <CLOUD_VENDOR> specs > my_configuration.json
Enter fullscreen mode Exit fullscreen mode

like i said the configuration values differs based on your cloud vendor. And if you are deploying on bare-metal server (where you need to configure the ip address yourself and other configurations) use the following command

$ edb-deployment baremetal specs --reference-architecture EDB-RA-1 > baremetal-edb-ra-1.json
Enter fullscreen mode Exit fullscreen mode

The reference architectures types would be talked about in a bit.
Then you can edit the configuration files to suit your need.

3. Initializing your project:
After successfully creating your configuration file, you'll need to create your project from which you'll then deploy. In the last article the different sub commands provided by the edb-deployment tool was iterated and we'll be using one of those subcommands to initialize a new project. The configure command is used to initialize a new project and here is how to use it with the necessary flags required to succesfully create the project

edb-deployment <CLOUD_VENDOR> configure <PROJECT_NAME> \
  -a <REFERENCE_ARCHITECTURE_CODE> \
  -o <OPERATING_SYSTEM> \
  -t <PG_ENGINE_TYPE> \
  -v <PG_VERSION> \
  -u "<EDB_REPO_USERNAME>:<EDB_REPO_PASSWORD>" \
  -r <CLOUD_REGION> \
  -s my_configuration.json
Enter fullscreen mode Exit fullscreen mode

PROJECT_NAME: Your project name.

REFERENCE_ARCHITECTURE_CODE: Reference architecture code name. Here are the allowed values: EDB-RA-1 for a single Postgres node deployment with one backup server and one PEM monitoring server, EDB-RA-2 for a 3 Postgres nodes deployment with quorum base synchronous replication and automatic failover, one backup server and one PEM monitoring server, EDB-RA-3 for extending EDB-RA-2 with 3 PgPoolII nodes, and HammerDB-TPROC-C for setting up a 2-tier configuration for benchmarking with an OLTP workload. Default: EDB-RA-1

OPERATING_SYSTEM: Operating system. Allowed values are: CentOS7, RockyLinux8, RedHat7 and RedHat8. Default: RockyLinux8

PG_ENGINE_TYPE: Postgres engine type. Allowed values are: PG for PostgreSQL, EPAS for EDB Postgres Advanced Server. Default: PG

PG_VERSION: PostgreSQL or EPAS version. Allowed values are: 11, 12, 13 and 14. Default: 14

"EDB_REPO_USERNAME:EDB_REPO_PASSWORD": EDB Packages repository credentials. (The edb package project in which you wish to deploy repo name and password). It is Required.

CLOUD_REGION: Cloud vendor region. Default value depends on Cloud vendor.

You can use the help command to see the full options

edb-deployment <CLOUD_VENDOR> configure --help
Enter fullscreen mode Exit fullscreen mode

4. Provisioning the Cloud Resource:
Before deploying the project you'll need to provision the cloud resources, which is seemingly intuitive that when you want to deploy your project on any cloud provider, you'll need to first provision the servers and other resources(volumes, etc..) before deploying your project. Same functionality is provided with the edb-deployment tool, you can provision your resources using the following command.

$ edb-deployment <CLOUD_VENDOR> provision <PROJECT_NAME>
Enter fullscreen mode Exit fullscreen mode

5. Deployment:

To deploy the project, use the deploy subcommand

$ edb-deployment <CLOUD_VENDOR> deploy <PROJECT_NAME>
Enter fullscreen mode Exit fullscreen mode

CONCLUSION

We've seen how to deploy edb projects using the edb-deployment tool, Here is the official repo to the project feel free to visit, read more and raise issues if you encounter any!.

Top comments (0)