Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions services/api-db/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions services/api-db/Dockerfile.mysql
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions services/api-db/slow-query-stdout-entrypoint.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -eo pipefail

if [ -n "$MARIADB_LOG_SLOW" ]; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than have a MARIADB_ and MYSQL_ prefix on the variable, why not use APIDB_SLOW_LOG and KEYCLOAKDB_SLOW_LOG

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, my only thing would be there is no way to turn it on for one or the other without doing some crafty chart changes with supporting logic for whether the chart is installing with mysql/mariadb and then keycloakdb/apidb

at least with isolation the chart logic is a bit simpler and the db type wouldn't matter.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just saw where you were going to use this, directly with env vars in the values. I guess it works in that case.

# Log slow queries to stdout
ln -sf /proc/1/fd/1 /var/log/mariadb-slow.log
fi
8 changes: 8 additions & 0 deletions services/api-db/slow-query-stdout-mysql-entrypoint.bash
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions services/keycloak-db/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions services/keycloak-db/Dockerfile.mysql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions services/keycloak-db/slow-query-stdout-entrypoint.bash
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions services/keycloak-db/slow-query-stdout-mysql-entrypoint.bash
Original file line number Diff line number Diff line change
@@ -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