Skip to content

Commit

Permalink
chore: add password entrypoint to keycloak and api db
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Dec 10, 2024
1 parent f4167af commit 17c7afc
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions services/api-db/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ COPY ./legacy-migration-scripts/* /legacy-migration-scripts/
RUN chown -R mysql /legacy-migration-scripts/ \
&& /bin/fix-permissions /legacy-migration-scripts/

# replace the generate-env script with our password, since generate-env only adds a domain which isnt valid in this image
COPY password-entrypoint.bash /lagoon/entrypoints/55-generate-env.sh
RUN sed -i 's/mariadb-init-complete/startup-init-complete/g' /lagoon/entrypoints/9999-mariadb-init.bash

USER mysql
Expand Down
2 changes: 2 additions & 0 deletions services/api-db/Dockerfile.mysql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ COPY ./legacy-migration-scripts/* /legacy-migration-scripts/
RUN chown -R mysql /legacy-migration-scripts/ \
&& /bin/fix-permissions /legacy-migration-scripts/
# replace the generate-env script with our password, since generate-env only adds a domain which isnt valid in this image
COPY password-entrypoint.bash /lagoon/entrypoints/55-generate-env.sh
COPY mysql-init.bash /lagoon/entrypoints/9999-mysql-init.bash
USER mysql
Expand Down
11 changes: 11 additions & 0 deletions services/api-db/password-entrypoint.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -eo pipefail

if [ ${API_DB_PASSWORD+x} ]; then
if [ "${LAGOON}" == "mysql" ]; then
export MYSQL_PASSWORD=${API_DB_PASSWORD}
else
export MARIADB_PASSWORD=${API_DB_PASSWORD}
fi
fi
2 changes: 2 additions & 0 deletions services/keycloak-db/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ ENV MARIADB_DATABASE=keycloak \

COPY my_query-cache.cnf /etc/mysql/conf.d/my_query-cache.cnf
USER root
# replace the generate-env script with our password, since generate-env only adds a domain which isnt valid in this image
COPY password-entrypoint.bash /lagoon/entrypoints/55-generate-env.sh
RUN sed -i 's/mariadb-init-complete/startup-init-complete/g' /lagoon/entrypoints/9999-mariadb-init.bash
RUN fix-permissions /etc/mysql/conf.d/
USER mysql
2 changes: 2 additions & 0 deletions services/keycloak-db/Dockerfile.mysql
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ ENV MYSQL_DATABASE=keycloak \
# MYSQL_COLLATION=utf8_general_ci

USER root
# replace the generate-env script with our password, since generate-env only adds a domain which isnt valid in this image
COPY password-entrypoint.bash /lagoon/entrypoints/55-generate-env.sh
COPY mysql-init.bash /lagoon/entrypoints/9999-mysql-init.bash
USER mysql

Expand Down
11 changes: 11 additions & 0 deletions services/keycloak-db/password-entrypoint.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -eo pipefail

if [ ${KEYCLOAK_DB_PASSWORD+x} ]; then
if [ "${LAGOON}" == "mysql" ]; then
export MYSQL_PASSWORD=${KEYCLOAK_DB_PASSWORD}
else
export MARIADB_PASSWORD=${KEYCLOAK_DB_PASSWORD}
fi
fi

0 comments on commit 17c7afc

Please sign in to comment.