From ec02b1852fa3e1f41c38524c17c8fb27ecc7a620 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Mon, 2 Dec 2024 12:35:08 +1100 Subject: [PATCH] Updated `datadir` to reside in `/home/db-data`. --- Dockerfile | 12 ++++++------ Dockerfile.seed | 8 ++++---- seed-db.sh | 4 ++-- tests/bats/data.bats | 2 +- tests/dgoss/goss.yaml | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 32805a7..559d6c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,19 +10,19 @@ FROM uselagoon/mariadb-drupal:24.11.0 # Set the data directory to a different location that a mounted volume. -ENV MARIADB_DATA_DIR=/var/lib/db-data +ENV MARIADB_DATA_DIR=/home/db-data # Add customised entrypoint script. COPY 9999-mariadb-init.bash /lagoon/entrypoints/ USER root -RUN mkdir -p /var/lib/db-data \ - && chown -R mysql /var/lib/db-data \ - && chgrp -R mysql /var/lib/db-data \ - && /bin/fix-permissions /var/lib/db-data +RUN mkdir -p /home/db-data \ + && chown -R mysql /home/db-data \ + && chgrp -R mysql /home/db-data \ + && /bin/fix-permissions /home/db-data USER mysql # @todo Try removing the CMD override. -CMD ["mysqld", "--datadir=/var/lib/db-data"] +CMD ["mysqld", "--datadir=/home/db-data"] diff --git a/Dockerfile.seed b/Dockerfile.seed index a1b11e9..dfddb63 100644 --- a/Dockerfile.seed +++ b/Dockerfile.seed @@ -5,12 +5,12 @@ FROM ${SEED_IMAGE} # Data directory to copy from. ARG SRC_DATADIR=.data -COPY ${SRC_DATADIR} /var/lib/db-data/ +COPY ${SRC_DATADIR} /home/db-data/ USER root -RUN chown -R mysql /var/lib/db-data \ - && chgrp -R mysql /var/lib/db-data \ - && /bin/fix-permissions /var/lib/db-data +RUN chown -R mysql /home/db-data \ + && chgrp -R mysql /home/db-data \ + && /bin/fix-permissions /home/db-data USER mysql diff --git a/seed-db.sh b/seed-db.sh index 9e4cd26..161af08 100755 --- a/seed-db.sh +++ b/seed-db.sh @@ -152,12 +152,12 @@ assert_db_was_imported "${cid}" pass "Upgraded database after import." task "Update permissions on the seeded database files." -docker exec "${cid}" bash -c "chown -R mysql /var/lib/db-data && /bin/fix-permissions /var/lib/db-data" || true +docker exec "${cid}" bash -c "chown -R mysql /home/db-data && /bin/fix-permissions /home/db-data" || true pass "Updated permissions on the seeded database files." task "Copy expanded database files to host" mkdir -p "${TMP_DATA_DIR}" -docker cp "${cid}":/var/lib/db-data/. "${TMP_DATA_DIR}/" +docker cp "${cid}":/home/db-data/. "${TMP_DATA_DIR}/" [ ! -d "${TMP_DATA_DIR}/mysql" ] && fail "Unable to copy expanded database files to host " && ls -al "${TMP_DATA_DIR}" && exit 1 pass "Copied expanded database files to host" diff --git a/tests/bats/data.bats b/tests/bats/data.bats index efc4be8..0111b81 100644 --- a/tests/bats/data.bats +++ b/tests/bats/data.bats @@ -25,7 +25,7 @@ load _helper substep "Started container ${cid}" step "Assert that the database directory is present." - docker exec --user 1000 "${cid}" test -d /var/lib/db-data + docker exec --user 1000 "${cid}" test -d /home/db-data step "Wait for mysql to start." sleep 5 diff --git a/tests/dgoss/goss.yaml b/tests/dgoss/goss.yaml index faae121..c4ffd70 100644 --- a/tests/dgoss/goss.yaml +++ b/tests/dgoss/goss.yaml @@ -7,7 +7,7 @@ file: exists: true contains: [] - /var/lib/db-data: + /home/db-data: exists: true contains: []