The mysql:8-debian tag is deprecated and is no longer receiving updates. The recommendation is to use the more explicit mysql:8.0-debian tag. This was discovered during (and extracted from) my work in https://github.com/trilogy-libraries/trilogy/pull/174.
This means that we can no longer mount a shared directory at /var/lib/mysql otherwise the entrypoint script will not initialize the database. The purpose of this shared mount between the db and the app services was so that the app has access to the certificate files that we generate within the db container.
My workaround for this was to mount the directory somewhere else (/mysql-certs) and then change our generate_keys.sh script to copy the generated certificates from /var/lib/mysql to /mysql-certs. Since generate_keys.sh is executed as the mysql user, instead of root, we have to do a docker trick where we ensure that the directory to be mounted is pre-created and chmod-ed with 777before it's mounted.
@composerinteralia this is ready for review. The PR check status is stuck in pending since the names of the required checks has changed. You’ll need to update that the required checks before landing this PR, I think.
The
mysql:8-debian
tag is deprecated and is no longer receiving updates. The recommendation is to use the more explicitmysql:8.0-debian
tag. This was discovered during (and extracted from) my work in https://github.com/trilogy-libraries/trilogy/pull/174.This is the reference to the discovery: https://github.com/docker-library/mysql/issues/1040#issuecomment-2040590043
Breakdown of changes
This wasn't a simple "let's change
8
to8.0
"...The newer implementation of mysql's entrypoint file does this thing where it checks to see if the data directory already exists. If it does, then the setup does nothing. https://github.com/docker-library/mysql/blob/db3fdfbab4caa033f02126f525cb6dfb5a3c1b0c/docker-entrypoint.sh#L380-L381
This means that we can no longer mount a shared directory at
/var/lib/mysql
otherwise the entrypoint script will not initialize the database. The purpose of this shared mount between thedb
and theapp
services was so that theapp
has access to the certificate files that we generate within thedb
container.My workaround for this was to mount the directory somewhere else (
/mysql-certs
) and then change ourgenerate_keys.sh
script to copy the generated certificates from/var/lib/mysql
to/mysql-certs
. Sincegenerate_keys.sh
is executed as themysql
user, instead ofroot
, we have to do a docker trick where we ensure that the directory to be mounted is pre-created andchmod
-ed with777
before it's mounted.