From 62a58be4d3ad42cdff7bfdece634e2ee91e66b40 Mon Sep 17 00:00:00 2001 From: Robert Lange <robert.lange@uni-leipzig.de> Date: Wed, 6 Sep 2023 09:58:34 +0200 Subject: [PATCH] refs #24566 [finc] docker: introduce mariadb image with version 10.11 * add folders in devops for 10.11.5 and 10.3.17 * version is set by var DB_VERSION in .env file --- .env.local | 5 +++- devops/docker/db/mariadb_10_11/Dockerfile | 19 ++++++++++++ .../db/{ => mariadb_10_11}/entrypoint.sh | 0 devops/docker/db/mariadb_10_3/Dockerfile | 19 ++++++++++++ devops/docker/db/mariadb_10_3/entrypoint.sh | 29 +++++++++++++++++++ docker-compose.yml | 4 +-- 6 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 devops/docker/db/mariadb_10_11/Dockerfile rename devops/docker/db/{ => mariadb_10_11}/entrypoint.sh (100%) create mode 100644 devops/docker/db/mariadb_10_3/Dockerfile create mode 100755 devops/docker/db/mariadb_10_3/entrypoint.sh diff --git a/.env.local b/.env.local index cda5e645172..798182656e8 100644 --- a/.env.local +++ b/.env.local @@ -7,4 +7,7 @@ NODE_SASS=^7.0.1 COMPOSER_VERSION=composer2 # Version for php in PHP container: php7_2 | php8_0 -PHP_VERSION=php7_2 \ No newline at end of file +PHP_VERSION=php7_2 + +# Version for database in db container: mariadb_10_3 | mariadb_10_11 +DB_VERSION=mariadb_10_3 \ No newline at end of file diff --git a/devops/docker/db/mariadb_10_11/Dockerfile b/devops/docker/db/mariadb_10_11/Dockerfile new file mode 100644 index 00000000000..8a4b1e5ecf7 --- /dev/null +++ b/devops/docker/db/mariadb_10_11/Dockerfile @@ -0,0 +1,19 @@ +# Copyright (C) 2023 Leipzig University Library +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# @author Sebastian Kehr <kehr@ub.uni-leipzig.de> +# @license https://opensource.org/licenses/GPL-3.0 GNU GPLv3 + +FROM mariadb:10.11.5 \ No newline at end of file diff --git a/devops/docker/db/entrypoint.sh b/devops/docker/db/mariadb_10_11/entrypoint.sh similarity index 100% rename from devops/docker/db/entrypoint.sh rename to devops/docker/db/mariadb_10_11/entrypoint.sh diff --git a/devops/docker/db/mariadb_10_3/Dockerfile b/devops/docker/db/mariadb_10_3/Dockerfile new file mode 100644 index 00000000000..ac070a85ff2 --- /dev/null +++ b/devops/docker/db/mariadb_10_3/Dockerfile @@ -0,0 +1,19 @@ +# Copyright (C) 2023 Leipzig University Library +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# @author Sebastian Kehr <kehr@ub.uni-leipzig.de> +# @license https://opensource.org/licenses/GPL-3.0 GNU GPLv3 + +FROM mariadb:10.3.17 \ No newline at end of file diff --git a/devops/docker/db/mariadb_10_3/entrypoint.sh b/devops/docker/db/mariadb_10_3/entrypoint.sh new file mode 100755 index 00000000000..8be1f15524b --- /dev/null +++ b/devops/docker/db/mariadb_10_3/entrypoint.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env sh +# Copyright (C) 2020 Leipzig University Library +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# @author Sebastian Kehr <kehr@ub.uni-leipzig.de> +# @license https://opensource.org/licenses/GPL-3.0 GNU GPLv3 + +until ! (ping -c1 env >/dev/null 2>&1) && [ -f ./data/docker/env/db ]; do :; done +while ! grep -q MYSQL_ROOT_PASSWORD ./data/docker/env/db +do + echo "wait for MYSQL_ROOT_PASSWORD" + sleep 1 +done +set -a; . ./data/docker/env/db; set +a + +echo "set up db" +exec docker-entrypoint.sh "$@" \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 59aa7093ba1..b7ac4f464b3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -43,7 +43,7 @@ services: tty: true db: - image: mariadb:10.3.17 + build: devops/docker/db/${DB_VERSION:-mariadb_10_3} ports: - 127.0.0.1:${DB_PORT:-11101}:3306 working_dir: /usr/local/vufind @@ -53,7 +53,7 @@ services: depends_on: - env - autoconfig - entrypoint: ["devops/docker/db/entrypoint.sh"] + entrypoint: devops/docker/db/${DB_VERSION:-mariadb_10_3}/entrypoint.sh command: [ "mysqld", "--character-set-server=utf8mb4", -- GitLab