diff --git a/.github/actions/conditional/conditions b/.github/actions/conditional/conditions index 39694ffe37..f774c2f9c1 100644 --- a/.github/actions/conditional/conditions +++ b/.github/actions/conditional/conditions @@ -4,6 +4,8 @@ .github/actions/ ci ci-store ci-sssd operator js codeql-java codeql-themes guides documentation .github/scripts/ ci ci-sssd +.github/scripts/ansible/ ci-store +.github/scripts/aws/ ci-store .github/workflows/ci.yml ci ci-store ci-sssd .github/workflows/operator-ci.yml operator diff --git a/.github/scripts/aws/rds/aurora_common.sh b/.github/scripts/aws/rds/aurora_common.sh index 132b7c890d..2b32c0d3b3 100755 --- a/.github/scripts/aws/rds/aurora_common.sh +++ b/.github/scripts/aws/rds/aurora_common.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash set -e +if [[ "$RUNNER_DEBUG" == "1" ]]; then + set -x +fi + function requiredEnv() { for ENV in $@; do if [ -z "${!ENV}" ]; then @@ -12,8 +16,9 @@ function requiredEnv() { requiredEnv AURORA_CLUSTER AURORA_REGION +SCRIPT_DIR=${SCRIPT_DIR:-$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )} export AURORA_ENGINE=${AURORA_ENGINE:-"aurora-postgresql"} -export AURORA_ENGINE_VERSION=${AURORA_ENGINE_VERSION:-"15.3"} +export AURORA_ENGINE_VERSION=${AURORA_ENGINE_VERSION:-"$(${SCRIPT_DIR}/../../../../mvnw help:evaluate -f ${SCRIPT_DIR}/../../../../pom.xml -Dexpression=aurora-postgresql.version -q -DforceStdout)"} export AURORA_INSTANCES=${AURORA_INSTANCES:-"2"} export AURORA_INSTANCE_CLASS=${AURORA_INSTANCE_CLASS:-"db.t4g.large"} export AURORA_PASSWORD=${AURORA_PASSWORD:-"secret99"} diff --git a/docs/guides/high-availability/partials/aurora/aurora-multiaz-create-procedure.adoc b/docs/guides/high-availability/partials/aurora/aurora-multiaz-create-procedure.adoc index 6a97469582..3384b128aa 100644 --- a/docs/guides/high-availability/partials/aurora/aurora-multiaz-create-procedure.adoc +++ b/docs/guides/high-availability/partials/aurora/aurora-multiaz-create-procedure.adoc @@ -232,7 +232,7 @@ aws rds create-db-cluster \ --db-cluster-identifier keycloak-aurora \ --database-name keycloak \ --engine aurora-postgresql \ - --engine-version 15.3 \ + --engine-version ${properties["aurora-postgresql.version"]} \ --master-username keycloak \ --master-user-password secret99 \ --vpc-security-group-ids sg-0d746cc8ad8d2e63b \ diff --git a/docs/guides/server/db.adoc b/docs/guides/server/db.adoc index b8494be206..136e8491da 100644 --- a/docs/guides/server/db.adoc +++ b/docs/guides/server/db.adoc @@ -24,6 +24,7 @@ The server has built-in support for different databases. You can query the avail |MySQL | `mysql` | ${properties["mysql.version"]} |Oracle Database | `oracle` | ${properties["oracledb.version"]} |PostgreSQL | `postgres` | ${properties["postgresql.version"]} +|Amazon Aurora PostgreSQL | `postgres` | ${properties["aurora-postgresql.version"]} |=== By default, the server uses the `dev-file` database. This is the default database that the server will use to persist data and @@ -227,7 +228,32 @@ show server_encoding; create database keycloak with encoding 'UTF8'; ---- -== Configuring MySQL server +== Preparing for Amazon Aurora PostgreSQL + +When using Amazon Aurora PostgreSQL, the https://github.com/awslabs/aws-advanced-jdbc-wrapper[Amazon Web Services JDBC Driver] offers additional features like transfer of database connections when a writer instance changes in a Multi-AZ setup. +This driver is not part of the distribution and needs to be installed before it can be used. + +To install this driver, apply the following steps: + +. When running the unzipped distribution: Download the JAR file from the https://github.com/awslabs/aws-advanced-jdbc-wrapper/releases/[Amazon Web Services JDBC Driver releases page] and place it in {project_name}'s `providers` folder. + +. When running containers: Build a custom {project_name} image and add the JAR in the `providers` folder. ++ +A minimal Dockerfile to build an image which can be used with the {project_name} Operator looks like the following: ++ +[source,dockerfile,subs="attributes+"] +---- +FROM quay.io/keycloak/keycloak:{containerlabel} +ADD --chown=keycloak:keycloak https://github.com/awslabs/aws-advanced-jdbc-wrapper/releases/download/${properties["aws-jdbc-wrapper.version"]}/aws-advanced-jdbc-wrapper-${properties["aws-jdbc-wrapper.version"]}.jar /opt/keycloak/providers/aws-advanced-jdbc-wrapper.jar +---- ++ +See the <@links.server id="containers" /> {section} for details on how to build optimized images, and the <@links.operator id="customizing-keycloak" /> {section} on how to run optimized and non-optimized images with the {project_name} Operator. +. Configure {project_name} to run with the following parameters: +`db-url`:: Insert `aws-wrapper` to the regular PostgreSQL JDBC URL resulting in a URL like `+jdbc:aws-wrapper:postgresql://...+`. +`db-driver`:: Set to `software.amazon.jdbc.Driver` to use the AWS JDBC wrapper. +`transaction-xa-enabled`:: Set to `false`, as the Amazon Web Services JDBC Driver does not support XA transactions. + +== Preparing for MySQL server Beginning with MySQL 8.0.30, MySQL supports generated invisible primary keys for any InnoDB table that is created without an explicit primary key (more information https://dev.mysql.com/doc/refman/8.0/en/create-table-gipks.html[here]). If this feature is enabled, the database schema initialization and also migrations will fail with the error message `Multiple primary key defined (1068)`. diff --git a/pom.xml b/pom.xml index f155d1e10f..07461965a4 100644 --- a/pom.xml +++ b/pom.xml @@ -160,6 +160,8 @@ 8.0 8.3.0 15 + 15.3 + 2.3.3 42.7.1 10.11 3.3.2