Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated datadir to reside in /home/db-data. #64

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
8 changes: 4 additions & 4 deletions Dockerfile.seed
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions seed-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion tests/bats/data.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/dgoss/goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ file:
exists: true
contains: []

/var/lib/db-data:
/home/db-data:
exists: true
contains: []

Expand Down