Package: edb-deployment
Getting Startededb-deploymenttool is an easy way to provision Cloud resources and deploy
PostgreSQL, EDB Postgres Advanced Server and tools (high availability,
backup/recovery, monitoring, connection poolers).edb-deploymentcan also be
used to deploy Postgres architectures on existing infrastructure like physical
servers (baremetal) or local Virtual Machines.Supported Cloud providers areAWS,AzureandGoogle Cloud.edb-deploymenthelps user to deploy Postgres Reference Architectures. List
and details of the Reference Architecture can be findhere.edb-deploymentis an open source tool and is not officially supported by EDB
Support. It is maintained and supported by the GitHub members of this
repository. Please provide feedback by posting issues and providing pull
requests.Before starting to delve into this repository, it is best to get familiar with
the steps in the deployment process of a specific cloud (AWS, Azure and Google
Cloud).Pre-Requisitesedb-deploymentis dependent on following components. Install the following
components before using it.Python 3pip3Third party pre-requisites:Latest vendorCloud CLI or SDK ( AWS, Azure or Google Cloud )Depending on the cloud provider, install thelatest versionfor: AWS
CLI, Azure CLI or Google Cloud SDK on the system.Terraform>= 1.3.6Ansible>= 2.10.8AWS CLI>= 2.0.45Azure CLI>= 2.23.0Google Cloud CLI>= 329.0.0To help the installation of the third party pre-requisites listed above,edb-deploymentprovides thesetupsub-command working for Linux and Darwin
(macOS).
Please refer to sectionPre-Requisites installation.InstallationFrom source codeInstallation is done using thepip3command. Once the code has been
downloaded, either by cloning the repository or downloading a release, go to
the created folder and run the commandpip3 install:$cdpostgres-deployment
$sudopip3install.--upgradeFrom Pypi$sudopip3installedb-deploymentMake sure the tool is well installed by running the command:$edb-deployment--versionShell auto-completionedb-deploymentsupports command line auto-completion with thetabkey.Supported shells arebashanszsh.To enable auto-completion in current session, the following command must be
ran:$eval"$(register-python-argcompleteedb-deployment)"To enable auto-completion for all the sessions, the command above must be added
at the end of your~/.bashrcfile or~/.zshrcfile, depending on the shell
you use.Pre-Requisites installationTo ease installation of the third party pre-requisites tools likeaws,terraform,ansible, etc..edb-deploymentprovides thesetupsub-command.The following packages are required in order to execute thesetupsub-command:gcc(Linux only),python3-devel(Linux only),unzip,wget,tar.
These packages should be installed through usual package manager (dnf,apt,brew, etc..).Note for Debian users: the packagelibffi-devmust be present.Finally, Pythonvirtualenvmust be installed withrootprivileges:$sudopip3installvirtualenvPre-requisites automated installation:$edb-deployment<CLOUD_VENDOR>setupUsageEach new deployment will be done under a dedicated name space, this the<PROJECT_NAME>.edb-deploymentCLI features are implemented through sub-commands. Each
sub-command can be executed like this:$edb-deployment<CLOUD_VENDOR><SUB_COMMAND>[<PROJECT_NAME>]Cloud vendor listaws: Amazon Web Servicesaws-pot: EDB POT (Proof Of Technology) on AWS Cloudaws-rds: Amazon Web Services RDS for PostgreSQLaws-rds-aurora: Amazon Auroraazure: Microsoft Azure Cloudazure-pot: EDB POT (Proof Of Technology) on Azure Cloudazure-db: Microsoft Azure Databasegcloud: Google Cloudgcloud-pot: EDB POT (Proof Of Technology) on Google Cloudgcloud-sql: Google Cloud SQL for PostgreSQLLocal Testingbaremetal: Baremetal servers and VMsvmware:VMWare Workstationvirtualbox:VirtualboxWindows Support through WSL2Sub-commandsconfigure: New project initialization and configurationprovision: Cloud resources provisioningdestroy: Cloud resources destructiondeploy: Postgres and tools deploymentshow: Show configurationdisplay: Display project inventorypasswords: Display project passwordslist: List projectsspecs: Show Cloud Vendor default specificationslogs: Show project logsremove: Remove projectHow to UseDeployment of new project should follow the work flow below:Configure Cloud credentialsProject configurationCloud resources provisioningPostgres and tools deploymentConfigure Cloud credentialsThis step depends on the target Cloud vendor.If the Cloud tools have been installed with the help of thesetupsub-command, it's recommended to update the value of thePATHenvironment
variable to include tools binary location:$exportPATH=$PATH:$HOME/.edb-cloud-tools/binAWS credentials configurationAWS credentials configuration will be done throughawstool. For this step,
we need to get yourAWS Access Key IDandAWS Secret Access Key. For
more information about Amazon Access Key management, please go toofficial documentation page.Run the following command and enter the Access Key ID and Secret Access Key:$awsconfigureAzure credentials configurationAzure Cloud credentials configuration can be achieved using theaztool with
the following command:$azlogin--use-device-codeGCloud credentials configurationGCloud credentials configuration includes more steps than the other Cloud
vendors.GCloud project IDis required.Login with your email address:$gcloudauthlogin<LOGIN_EMAIL>--no-launch-browserOpen the link in your browser and copy the given verification code.Project configuration$gcloudconfigsetproject<PROJECT_ID>To find the IAM account of the service, please enter the following command
to list service accounts:$gcloudiamservice-accountslistFinally, to create and download a new service account key:$gcloudiamservice-accountskeyscreate~/accounts.json--iam-account=<IAM_ACCOUNT>The JSON file$HOME/accounts.jsonmust be kept and will be required byedb-deployment.Project configurationOnce Cloud vendor credentials have been configured, you can proceed with
project configuration step.Cloud vendor specificationsedb-deploymentbrings default configuration values for the Cloud resources
to be provisioned, likeinstance type,disk size,OS image,additional volumes, etc..To change these configuration values, you need first to dump the default values
with:$edb-deployment<CLOUD_VENDOR>specs>my_configuration.jsonWhen deploying on baremetal servers, IP address and SSH user configuration must
be done through the specifications:$edb-deploymentbaremetalspecs--reference-architectureEDB-RA-1>baremetal-edb-ra-1.jsonThebaremetal-edb-ra-1.jsonfile will contain:{"ssh_user":null,"pg_data":null,"pg_wal":null,"postgres_server_1":{"name":"pg1","public_ip":null,"private_ip":null},"pem_server_1":{"name":"pem1","public_ip":null,"private_ip":null},"backup_server_1":{"name":"backup1","public_ip":null,"private_ip":null}}Then, you can edit and update resources configuration stored in the JSON file.Project initializationProject initialialization will done using theconfiguresub-command:$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>\-smy_configuration.jsonNotes:REFERENCE_ARCHITECTURE_CODEReference architecture code name. Allowed values are:EDB-RA-1for a
single Postgres node deployment with one backup server and one PEM
monitoring server,EDB-RA-2for a 3 Postgres nodes deployment with
quorum base synchronous replication and automatic failover, one backup
server and one PEM monitoring server,EDB-RA-3for extendingEDB-RA-2with 3 PgPoolII nodes,  andHammerDB-TPROC-Cfor setting up
a 2-tier configuration for benchmarking with an OLTP workload.  Default:EDB-RA-1OPERATING_SYSTEMOperating system. Allowed values are:CentOS7,RockyLinux8,RedHat7andRedHat8. Default:RockyLinux8PG_ENGINE_TYPEPostgres engine type. Allowed values are:PGfor PostgreSQL,EPASfor EDB Postgres Advanced Server. Default:PGPG_VERSIONPostgreSQL or EPAS version. Allowed values are:11,12,13and14.
Default:14"EDB_REPO_USERNAME:EDB_REPO_PASSWORD"EDB Packages repository credentials.Required.CLOUD_REGIONCloud vendor region. Default value depends on Cloud vendor.For more details, please use:$edb-deployment<CLOUD_VENDOR>configure--helpCloud resources provisioningAfter project configuration, we can proceed to Cloud resources provisioning:$edb-deployment<CLOUD_VENDOR>provision<PROJECT_NAME>Components deploymentFinally, we can deploy the components with thedeploysub-command:$edb-deployment<CLOUD_VENDOR>deploy<PROJECT_NAME>Other featuresList of projects:$edb-deployment<CLOUD_VENDOR>listExecute Ansible pre deployment playbook$edb-deployment<CLOUD_VENDOR>deploy--pre-deploy-ansiblepre_deploy_playbook.yml<PROJECT_NAME>Execute Ansible post deployment playbook$edb-deployment<CLOUD_VENDOR>deploy--post-deploy-ansiblepost_deploy_playbook.yml<PROJECT_NAME>Display of projects inventory:$edb-deployment<CLOUD_VENDOR>display<PROJECT_NAME>Display of projects passwords:$edb-deployment<CLOUD_VENDOR>passwords<PROJECT_NAME>Cloud resources destruction:$edb-deployment<CLOUD_VENDOR>destroy<PROJECT_NAME>Project tree deletion:$edb-deployment<CLOUD_VENDOR>remove<PROJECT_NAME>Open SSH connection to one host of the project:$edb-deployment<CLOUD_VENDOR>ssh<PROJECT_NAME><NODE_NAME>Note: the node name list can be found by executing thedisplaysub-command.
It can be:epas1,epas2,pemserver1, etc...Get a copy of the SSH keys and the ssh_config file. The files are copied into
the current directory:$edb-deployment<CLOUD_VENDOR>get_ssh_keys<PROJECT_NAME>Note: This sub-command is only available foraws-pot,azure-potandgcloud-pot.LicenseOriginal work Copyright 2019-2020, EnterpriseDB CorporationAll rights reserved.Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.Neither the name of EnterpriseDB nor the names of its contributors may be
used to endorse or promote products derived from this software without specific
prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE.