Skip to content

Latest commit

 

History

History
49 lines (38 loc) · 2.07 KB

azure-db-steps.asciidoc

File metadata and controls

49 lines (38 loc) · 2.07 KB

Using Azure Database for PostgreSQL in place of default PostgreSQL DB

Pre-requisites

  • Azure Database for PostgreSQL is required to be up and running for this deployment. In case, you need to create new database, please refer CLI or Azure Portal.

  • Azure CLI is to be installed. For installing, please refer this link.

Steps

Here are the high level steps which are followed by Azure CLI Commands.

  • Connect to Azure Database for PostgreSQL.

  • Create the database.

  • Update the application.properties file and continue with the deployment steps.

#Connect to Azure from CLI (either local machine or VM)
az login

#Set the Azure Subscription in which Kubernetes Cluster presents
az account set --subscription <mySubscription>

#Connect to DB using the below format
psql --host=<dbserver-name>.postgres.database.azure.com --port=5432 --username=<admin-username>@<dbserver-name> --dbname=postgres

#Sample
psql --host=d4qdb.postgres.database.azure.com --port=5432 --username=devonadmin@d4qdb --dbname=postgres

#After logging into psql prompt, create the demo DB to use in our reference project
CREATE DATABASE demo;
  • Update the application.properties file by changing the below section.

# Datasource configuration
quarkus.datasource.db-kind=postgresql
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/demo
quarkus.datasource.username=demo
quarkus.datasource.password=********
  • Sample for reference

# Datasource configuration
quarkus.datasource.db-kind=postgresql
quarkus.datasource.jdbc.url=jdbc:postgresql://d4qdb.postgres.database.azure.com:5432/demo
quarkus.datasource.username=devonadmin@d4qdb
quarkus.datasource.password=**********