diff --git a/.env.local b/.env.local index cda5e6451726127085611ad66debf8c83b7e4941..798182656e8fa1b8cb7d937029483fa3ae98ac8f 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 0000000000000000000000000000000000000000..8a4b1e5ecf7d3aad0a9a6ee19427d666da88a7d5 --- /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 0000000000000000000000000000000000000000..ac070a85ff23d2f500ba5880575a1f5a9833ab9d --- /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 0000000000000000000000000000000000000000..8be1f15524b89bf8d6a9b6638a28e322142a24b3 --- /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 59aa7093ba114d322946d0a83f834d6d277a58e0..b7ac4f464b3130889c1942eef6d4cda8a8912d23 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",