-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: updates for api-db and keycloak-db to support MySQL8 (#3816)
- Loading branch information
1 parent
1576078
commit 06ba55c
Showing
20 changed files
with
280 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
ARG UPSTREAM_REPO | ||
ARG UPSTREAM_TAG | ||
FROM ${UPSTREAM_REPO:-uselagoon}/mysql-8.0:${UPSTREAM_TAG:-latest} | ||
|
||
ARG LAGOON_VERSION | ||
ENV LAGOON_VERSION=$LAGOON_VERSION | ||
|
||
USER root | ||
|
||
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 | ||
USER mysql | ||
ENV MYSQL_DATABASE=infrastructure \ | ||
MYSQL_USER=api \ | ||
MYSQL_PASSWORD=api | ||
# are these needed?? | ||
# MYSQL_CHARSET=utf8 \ | ||
# MYSQL_COLLATION=utf8_general_ci | ||
# do we need to keep these any more? v2.10.0 was long ago... | ||
# COPY ./rerun_initdb.sh /rerun_initdb.sh | ||
# COPY ./legacy_rerun_initdb.sh /legacy_rerun_initdb.sh | ||
CMD ["mysqld", "--sql_mode", ""] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
services/api/database/migrations/20250131000000_source_type_enums.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
exports.up = function(knex) { | ||
// fix the way the enum values are stored to be lowercase for mysql strict | ||
return Promise.all([ | ||
knex('deployment') | ||
.where('source_type', '=', 'API') | ||
.update('source_type', 'api'), | ||
knex('deployment') | ||
.where('source_type', '=', 'WEBHOOK') | ||
.update('source_type', 'webhook'), | ||
knex('task') | ||
.where('source_type', '=', 'API') | ||
.update('source_type', 'api'), | ||
]); | ||
}; | ||
|
||
/** | ||
* @param { import("knex").Knex } knex | ||
* @returns { Promise<void> } | ||
*/ | ||
exports.down = function(knex) { | ||
return knex.schema; | ||
}; |
Oops, something went wrong.