Fix DB connection
This commit is contained in:
Родитель
a56a2fe094
Коммит
2c97c17dfb
|
@ -205,13 +205,6 @@ Create the database with the following command (this one will take a few minutes
|
|||
include::../../../../../scripts/infra/azure.sh[tag=adocPostgresCreate, indent=0]
|
||||
----
|
||||
|
||||
Then we create the database schema:
|
||||
|
||||
[source,shell]
|
||||
----
|
||||
include::../../../../../scripts/infra/azure.sh[tag=adocPostgresSchema, indent=0]
|
||||
----
|
||||
|
||||
Now that we have our database setup, it's time to create the tables. We'll use a database initialization SQL file for that. Thanks to Azure CLI, we can execute these SQL scripts directly in our newly created database.
|
||||
|
||||
Create the tables using the following command (make sure you are in the repository root directory before your execute this command):
|
||||
|
|
|
@ -92,7 +92,7 @@ createInfrastructure() {
|
|||
POSTGRES_TIER="Burstable"
|
||||
POSTGRES_DB="db-stats-${UNIQUE_IDENTIFIER}"
|
||||
POSTGRES_DB_SCHEMA="stats"
|
||||
POSTGRES_DB_CONNECT_STRING="jdbc:postgresql://${POSTGRES_DB}.postgres.database.azure.com:5432/${POSTGRES_SCHEMA}?ssl=true&sslmode=require"
|
||||
POSTGRES_DB_CONNECT_STRING="jdbc:postgresql://${POSTGRES_DB}.postgres.database.azure.com:5432/${POSTGRES_DB_SCHEMA}?ssl=true&sslmode=require"
|
||||
|
||||
QUARKUS_APP="quarkus-app"
|
||||
MICRONAUT_APP="micronaut-app"
|
||||
|
@ -190,7 +190,7 @@ az containerapp env create \
|
|||
QUARKUS_HIBERNATE_ORM_SQL_LOAD_SCRIPT=no-file \
|
||||
QUARKUS_DATASOURCE_USERNAME="$POSTGRES_DB_ADMIN" \
|
||||
QUARKUS_DATASOURCE_PASSWORD="$POSTGRES_DB_PWD" \
|
||||
QUARKUS_DATASOURCE_REACTIVE_URL="$POSTGRES_DB_CONNECT_STRING"
|
||||
QUARKUS_DATASOURCE_JDBC_URL="$POSTGRES_DB_CONNECT_STRING"
|
||||
|
||||
az containerapp create \
|
||||
--resource-group "$RESOURCE_GROUP" \
|
||||
|
@ -219,6 +219,7 @@ az containerapp env create \
|
|||
--location "$LOCATION" \
|
||||
--tags system="$TAG" \
|
||||
--name "$POSTGRES_DB" \
|
||||
--database-name "$POSTGRES_DB_SCHEMA" \
|
||||
--admin-user "$POSTGRES_DB_ADMIN" \
|
||||
--admin-password "$POSTGRES_DB_PWD" \
|
||||
--public all \
|
||||
|
@ -228,13 +229,6 @@ az containerapp env create \
|
|||
--version "$POSTGRES_DB_VERSION"
|
||||
# end::adocPostgresCreate[]
|
||||
|
||||
# tag::adocPostgresSchema[]
|
||||
az postgres flexible-server db create \
|
||||
--resource-group "$RESOURCE_GROUP" \
|
||||
--server-name "$POSTGRES_DB" \
|
||||
--database-name "$POSTGRES_DB_SCHEMA"
|
||||
# end::adocPostgresSchema[]
|
||||
|
||||
pushd ../..
|
||||
# tag::adocPostgresTable[]
|
||||
az postgres flexible-server execute \
|
||||
|
@ -292,7 +286,7 @@ exportEnvironment() {
|
|||
export POSTGRES_TIER="Burstable"
|
||||
export POSTGRES_DB="db-stats-${UNIQUE_IDENTIFIER}"
|
||||
export POSTGRES_DB_SCHEMA="stats"
|
||||
export POSTGRES_DB_CONNECT_STRING="jdbc:postgresql://${POSTGRES_DB}.postgres.database.azure.com:5432/${POSTGRES_SCHEMA}?ssl=true&sslmode=require"
|
||||
export POSTGRES_DB_CONNECT_STRING="jdbc:postgresql://${POSTGRES_DB}.postgres.database.azure.com:5432/${POSTGRES_DB_SCHEMA}?ssl=true&sslmode=require"
|
||||
|
||||
export QUARKUS_APP="quarkus-app"
|
||||
export MICRONAUT_APP="micronaut-app"
|
||||
|
|
Загрузка…
Ссылка в новой задаче