docs: make legacy MySQL 5.5 example restart-safe, fixes #737 - #738
docs: make legacy MySQL 5.5 example restart-safe, fixes #737#738CyberSymbol wants to merge 1 commit into
Conversation
| exec ~/docker-entrypoint.sh | ||
| ``` | ||
|
|
||
| Three things are noteworthy: |
There was a problem hiding this comment.
Needs to now say "four" ;)
| - Setting `linux/amd64` as the platform will require Rosetta to be available on the macOS ARM64 platform | ||
| - The `BASE_IMAGE` is set to a DDEV `db` container of legacy Docker images that are still provided. | ||
| - Changing the `entrypoint` is a workaround to prevent DDEV complaining about a mismatching MySQL version after restarting the project. The small script "tricks" the DDEV inspection into believing, the version matches the one configured in `.ddev/config.yaml`. | ||
| - The `mysql-5.5:v1.24.6` image removes write permission from copied custom `.cnf` files, which can cause `Permission denied` when restarting an existing DB container; the added `chmod` makes this example restart-safe. This underlying issue was fixed in DDEV v1.24.7. |
There was a problem hiding this comment.
| - The `mysql-5.5:v1.24.6` image removes write permission from copied custom `.cnf` files, which can cause `Permission denied` when restarting an existing DB container; the added `chmod` makes this example restart-safe. This underlying issue was fixed in DDEV v1.24.7. | |
| - The `mysql-5.5:v1.24.6` image removes write permission from copied custom `.cnf` files, which can cause `Permission denied` when restarting an existing DB container; the added `chmod` makes this example restart-safe. This underlying issue was fixed in DDEV v1.24.7. Depending on the date you are reading this you may want to consider raising the pinned version of the BASE_IMAGE, but may need to adapt line numbers or replacements in the sed replacements then. |
Maybe something like this?
|
Please remember to add |
|
🌐 Fork Preview for PR #738 https://pr-738.ddev-com-fork-previews.pages.dev This preview updates automatically when you push changes to your fork. |
| - Setting `linux/amd64` as the platform will require Rosetta to be available on the macOS ARM64 platform | ||
| - The `BASE_IMAGE` is set to a DDEV `db` container of legacy Docker images that are still provided. | ||
| - Changing the `entrypoint` is a workaround to prevent DDEV complaining about a mismatching MySQL version after restarting the project. The small script "tricks" the DDEV inspection into believing, the version matches the one configured in `.ddev/config.yaml`. | ||
| - The `mysql-5.5:v1.24.6` image removes write permission from copied custom `.cnf` files, which can cause `Permission denied` when restarting an existing DB container; the added `chmod` makes this example restart-safe. This underlying issue was fixed in DDEV v1.24.7. |
There was a problem hiding this comment.
This underlying issue was fixed in DDEV v1.24.7
It's easier to change the image:
-BASE_IMAGE: ddev/ddev-dbserver-mysql-5.5:v1.24.6
+BASE_IMAGE: ddev/ddev-dbserver-mysql-5.5:v1.25.4And update the entrypoint.
There was a problem hiding this comment.
I updated the article to the current DDEV version, but I cannot push a commit to this PR.
main...stasadev:ddev.com:20260904_CyberSymbol_legacy_mysql55_restart_safe
@CyberSymbol, please enable this https://docs.github.com/en/pull-requests/how-tos/work-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork
The Issue
The legacy MySQL 5.5 guide pins
ddev/ddev-dbserver-mysql-5.5:v1.24.6. With a custom.ddev/mysql/*.cnffile, a later start of the same DB container can fail because the old entrypoint tries to overwrite a config file after removing its write permission.How This PR Solves The Issue
The example now restores owner write permission on
/etc/mysql/conf.d/*before the legacy entrypoint copies custom.cnffiles. The added command is tolerant of an empty config directory, so the first start and later restarts both work. The article also notes that the underlying issue was fixed in DDEV v1.24.7.Manual Testing Instructions
https://pr-738.ddev-com-fork-previews.pages.dev/blog/legacy-projects-with-unsupported-php-and-mysql-using-ddev/
Reproduced with DDEV v1.25.4,
ddev/ddev-dbserver-mysql-5.5:v1.24.6, MySQL 5.5.62, and a custom.ddev/mysql/legacy.cnf. Before the change, restarting the existing DB container failed withcp: cannot create regular file '/etc/mysql/conf.d/legacy.cnf': Permission denied. After the change, a direct DB-container restart completed successfully and Docker reportedrunning healthy.Automated Testing Overview
No automated tests were added because this is a documentation-only change to a legacy example.
Release/Deployment Notes
No deployment changes are required.
Prepared and tested with assistance from ChatGPT.