diff --git a/services/api-db/Dockerfile b/services/api-db/Dockerfile index 8e2f14a6db..686c0ccb1a 100644 --- a/services/api-db/Dockerfile +++ b/services/api-db/Dockerfile @@ -7,8 +7,11 @@ ENV LAGOON_VERSION=$LAGOON_VERSION USER root +RUN /bin/fix-permissions /var/log/ + # 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 slow-query-stdout-entrypoint.bash /lagoon/entrypoints/101-slow-query-stdout.sh USER mysql diff --git a/services/api-db/Dockerfile.mysql b/services/api-db/Dockerfile.mysql index a65c774a76..f0d3bbfc93 100644 --- a/services/api-db/Dockerfile.mysql +++ b/services/api-db/Dockerfile.mysql @@ -7,8 +7,11 @@ ENV LAGOON_VERSION=$LAGOON_VERSION USER root +RUN /bin/fix-permissions /var/log/ + # 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 slow-query-stdout-mysql-entrypoint.bash /lagoon/entrypoints/101-slow-query-stdout.sh USER mysql diff --git a/services/api-db/slow-query-stdout-entrypoint.bash b/services/api-db/slow-query-stdout-entrypoint.bash new file mode 100644 index 0000000000..4a7c919d99 --- /dev/null +++ b/services/api-db/slow-query-stdout-entrypoint.bash @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -eo pipefail + +if [ -n "$MARIADB_LOG_SLOW" ]; then + # Log slow queries to stdout + ln -sf /proc/1/fd/1 /var/log/mariadb-slow.log +fi diff --git a/services/api-db/slow-query-stdout-mysql-entrypoint.bash b/services/api-db/slow-query-stdout-mysql-entrypoint.bash new file mode 100644 index 0000000000..6eef65ffe3 --- /dev/null +++ b/services/api-db/slow-query-stdout-mysql-entrypoint.bash @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -eo pipefail + +if [ -n "$MYSQL_LOG_SLOW" ]; then + # Log slow queries to stdout + ln -sf /proc/1/fd/1 /var/log/mysql-slow.log +fi diff --git a/services/keycloak-db/Dockerfile b/services/keycloak-db/Dockerfile index 6e115af059..d265bd98f0 100644 --- a/services/keycloak-db/Dockerfile +++ b/services/keycloak-db/Dockerfile @@ -13,7 +13,9 @@ ENV MARIADB_DATABASE=keycloak \ COPY my_query-cache.cnf /etc/mysql/conf.d/my_query-cache.cnf USER root +RUN /bin/fix-permissions /var/log/ # 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 slow-query-stdout-entrypoint.bash /lagoon/entrypoints/101-slow-query-stdout.sh RUN fix-permissions /etc/mysql/conf.d/ USER mysql diff --git a/services/keycloak-db/Dockerfile.mysql b/services/keycloak-db/Dockerfile.mysql index 21d0f016a6..8d7e71f1f4 100644 --- a/services/keycloak-db/Dockerfile.mysql +++ b/services/keycloak-db/Dockerfile.mysql @@ -13,8 +13,10 @@ ENV MYSQL_DATABASE=keycloak \ # MYSQL_COLLATION=utf8_general_ci USER root +RUN /bin/fix-permissions /var/log/ # 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 slow-query-stdout-mysql-entrypoint.bash /lagoon/entrypoints/101-slow-query-stdout.sh USER mysql # not used in mysql8 diff --git a/services/keycloak-db/slow-query-stdout-entrypoint.bash b/services/keycloak-db/slow-query-stdout-entrypoint.bash new file mode 100644 index 0000000000..4a7c919d99 --- /dev/null +++ b/services/keycloak-db/slow-query-stdout-entrypoint.bash @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -eo pipefail + +if [ -n "$MARIADB_LOG_SLOW" ]; then + # Log slow queries to stdout + ln -sf /proc/1/fd/1 /var/log/mariadb-slow.log +fi diff --git a/services/keycloak-db/slow-query-stdout-mysql-entrypoint.bash b/services/keycloak-db/slow-query-stdout-mysql-entrypoint.bash new file mode 100644 index 0000000000..6eef65ffe3 --- /dev/null +++ b/services/keycloak-db/slow-query-stdout-mysql-entrypoint.bash @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -eo pipefail + +if [ -n "$MYSQL_LOG_SLOW" ]; then + # Log slow queries to stdout + ln -sf /proc/1/fd/1 /var/log/mysql-slow.log +fi