Add Amazon Aurora PostgreSQL to the list of tested databases (#27049)

Closes #27048

Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
This commit is contained in:
Alexander Schwartz 2024-02-19 09:16:49 +01:00 committed by GitHub
parent 1f57fc141c
commit 7135b4ec4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 38 additions and 3 deletions

View file

@ -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

View file

@ -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"}

View file

@ -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 \

View file

@ -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)`.

View file

@ -160,6 +160,8 @@
<mysql.version>8.0</mysql.version>
<mysql-jdbc.version>8.3.0</mysql-jdbc.version>
<postgresql.version>15</postgresql.version>
<aurora-postgresql.version>15.3</aurora-postgresql.version>
<aws-jdbc-wrapper.version>2.3.3</aws-jdbc-wrapper.version>
<postgresql-jdbc.version>42.7.1</postgresql-jdbc.version>
<mariadb.version>10.11</mariadb.version>
<mariadb-jdbc.version>3.3.2</mariadb-jdbc.version>