diff --git a/.github/workflows/test-db-migrations.yml b/.github/workflows/test-db-migrations.yml index e38d94750c..04c8a4963e 100644 --- a/.github/workflows/test-db-migrations.yml +++ b/.github/workflows/test-db-migrations.yml @@ -47,7 +47,7 @@ jobs: - name: Show initial migration logs run: | - docker compose -p lagoon logs api-init + docker compose -p lagoon logs api-db-init - name: Initiate rollback run: | diff --git a/docker-compose.yaml b/docker-compose.yaml index 8b2aad5bbd..06e1e86659 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,6 +8,8 @@ services: image: ${IMAGE_REPO:-lagoon}/api-db:${IMAGE_REPO_API_DB_TAG:-${IMAGE_REPO_TAG:-latest}} ports: - '3366:3306' + environment: + - MARIADB_PASSWORD=api webhook-handler: image: ${IMAGE_REPO:-lagoon}/webhook-handler:${IMAGE_REPO_WEBHOOK_HANDLER_TAG:-${IMAGE_REPO_TAG:-latest}} ports: @@ -156,6 +158,8 @@ services: environment: - KEYCLOAK_FRONTEND_URL=http://localhost:8088/auth/ - KEYCLOAK_ADMIN_EMAIL=admin@example.com + - DB_VENDOR=mysql + - LAGOON_DB_VENDOR=mysql # Uncomment for local new relic tracking # - NEW_RELIC_LICENSE_KEY= # - NEW_RELIC_APP_NAME=keycloak-local @@ -163,6 +167,8 @@ services: image: ${IMAGE_REPO:-lagoon}/keycloak-db:${IMAGE_REPO_KEYCLOAK_DB_TAG:-${IMAGE_REPO_TAG:-latest}} ports: - '3336:3306' + environment: + - MARIADB_PASSWORD=keycloak tests-kubernetes: image: ${IMAGE_REPO:-lagoon}/tests:${IMAGE_REPO_TESTS_TAG:-${IMAGE_REPO_TAG:-latest}} environment: diff --git a/services/api-db/Dockerfile b/services/api-db/Dockerfile index 93a572ec1a..7533b2f6bb 100644 --- a/services/api-db/Dockerfile +++ b/services/api-db/Dockerfile @@ -5,7 +5,9 @@ ENV LAGOON_VERSION=$LAGOON_VERSION ENV ALLOW_EMPTY_PASSWORD=yes \ MYSQL_USER=api \ - MYSQL_PASSWORD=api \ MYSQL_DATABASE=infrastructure \ MYSQL_AUTHENTICATION_PLUGIN=mysql_native_password \ - MYSQL_SQL_MODE=NO_ENGINE_SUBSTITUTION + MYSQL_SQL_MODE=NO_ENGINE_SUBSTITUTION \ + DB_VOLUME_DIR=/var/lib/mysql + +RUN sed -i 's/export MYSQL_PASSWORD="${MYSQL_PASSWORD:-}"/export MYSQL_PASSWORD="${MARIADB_PASSWORD:-api}"/g' /opt/bitnami/scripts/mysql-env.sh diff --git a/services/keycloak-db/Dockerfile b/services/keycloak-db/Dockerfile index d96ddaddd5..20907f532e 100644 --- a/services/keycloak-db/Dockerfile +++ b/services/keycloak-db/Dockerfile @@ -5,6 +5,8 @@ ENV LAGOON_VERSION=$LAGOON_VERSION ENV ALLOW_EMPTY_PASSWORD=yes \ MYSQL_USER=keycloak \ - MYSQL_PASSWORD=keycloak \ MYSQL_DATABASE=keycloak \ - MYSQL_AUTHENTICATION_PLUGIN=mysql_native_password + MYSQL_AUTHENTICATION_PLUGIN=mysql_native_password \ + DB_VOLUME_DIR=/var/lib/mysql + + RUN sed -i 's/export MYSQL_PASSWORD="${MYSQL_PASSWORD:-}"/export MYSQL_PASSWORD="${MARIADB_PASSWORD:-keycloak}"/g' /opt/bitnami/scripts/mysql-env.sh diff --git a/services/keycloak/Dockerfile b/services/keycloak/Dockerfile index 7f6f11c2e9..597ac32685 100644 --- a/services/keycloak/Dockerfile +++ b/services/keycloak/Dockerfile @@ -58,7 +58,7 @@ ENV TMPDIR=/tmp \ KEYCLOAK_ADMIN_PASSWORD=admin \ KEYCLOAK_REALM=lagoon \ KEYCLOAK_REALM_ROLES=admin \ - DB_VENDOR=mariadb \ + DB_VENDOR=mysql \ DB_ADDR=keycloak-db \ DB_USER=keycloak \ DB_PASSWORD=keycloak \ @@ -69,7 +69,7 @@ ENV TMPDIR=/tmp \ KEYCLOAK_API_CLIENT_SECRET=39d5282d-3684-4026-b4ed-04bbc034b61a \ KEYCLOAK_AUTH_SERVER_CLIENT_SECRET=f605b150-7636-4447-abd3-70988786b330 \ KEYCLOAK_SERVICE_API_CLIENT_SECRET=d3724d52-34d1-4967-a802-4d178678564b \ - LAGOON_DB_VENDOR=mariadb \ + LAGOON_DB_VENDOR=mysql \ LAGOON_DB_DATABASE=infrastructure \ LAGOON_DB_USER=api \ LAGOON_DB_PASSWORD=api \ diff --git a/services/keycloak/entrypoints/default-keycloak-entrypoint.sh b/services/keycloak/entrypoints/default-keycloak-entrypoint.sh index 42562df1a7..ba2e12721f 100755 --- a/services/keycloak/entrypoints/default-keycloak-entrypoint.sh +++ b/services/keycloak/entrypoints/default-keycloak-entrypoint.sh @@ -2,7 +2,7 @@ export KC_DB=$DB_VENDOR export KC_DB_USERNAME=$DB_USER export KC_DB_PASSWORD=$DB_PASSWORD -export KC_DB_URL=jdbc:mariadb://$DB_ADDR:3306/$DB_DATABASE +export KC_DB_URL=jdbc:$DB_VENDOR://$DB_ADDR:3306/$DB_DATABASE export KC_PROXY=${KC_PROXY:-edge} export KC_HOSTNAME_STRICT=${KC_HOSTNAME_STRICT:-false}