Skip to content

blog: Legacy projects with unsupported PHP/MySQL versions using DDEV #375

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

Merged
merged 11 commits into from
May 30, 2025

Conversation

garvinhicking
Copy link
Contributor

The Issue

I was encouraged through https://discord.com/channels/664580571770388500/1374723890500337724/1375138791278379084 to contribute my solution as a blog article.

How This PR Solves The Issue

I have documented my steps to the best of my knowledge.

Manual Testing Instructions

Run npm run build to see the article.

Automated Testing Overview

Only content, no changes of code.

Related Issue Link(s)

https://discord.com/channels/664580571770388500/1374723890500337724/1375138791278379084

Release/Deployment Notes

"Works on my machine". ;)

Copy link
Member

@stasadev stasadev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Please check the linter errors https://github.com/ddev/ddev.com/actions/runs/15283249253/job/42987518863?pr=375

And my comments (I didn't make a full review yet.)

Copy link
Member

@stasadev stasadev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check it out in action tomorrow.

BTW, this is a good candidate for a DDEV add-on https://github.com/ddev/ddev-addon-template

Comment on lines 56 to 65
Next I created the very small file `~/legacyphp/.ddev/docker-compose.db.yaml` in the same directory next to `config.yaml`:

```yaml
services:
db:
platform: linux/amd64
build:
args:
BASE_IMAGE: ddev/ddev-dbserver-mysql-5.5:v1.24.6
```
Copy link
Member

@stasadev stasadev May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interesting workaround you discovered, but it's going to work only until the next ddev restart:

Failed to start legacyphp: unable to start project legacyphp because the configured database type does not match the current actual database. Please change your database type back to mysql:5.5 and start again, export, delete, and then change configuration and start. To get back to existing type use 'ddev config --database=mysql:5.5' and then you might want to try 'ddev debug migrate-database mysql:8.0', see docs at https://ddev.readthedocs.io/en/stable/users/extend/database-types/

I think we can probably inject platform:linux/amd64 for MySQL 5.5, 5.6 on arm64.

I opened this issue:

But I don't think we're going to implement this fast.

I propose to add a small note on this matter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh, shoot. That is unfortunate - I honestly only had to start it up once and left it open for some days, and never issued a restart. I wonder if this makes the whole point of the article moot now, if we do not have a way to re-execute the container.

So I'd possibly scrap the whole article now, if you don't see any other kind of workaround to bypass the database config.yaml assignment/validation. If we had an YAML option like "disable_validation" or so that would massively help of course...

Copy link
Member

@stasadev stasadev May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can try to:

  1. copy-paste db service from .ddev/.ddev-docker-compose-base.yaml (replace uid value with ${DDEV_UID}, gid value with ${DDEV_GID}, but I don't know if it'll work in this context; if it doesn't work, leave it as it is with a note that people need to update these values.)
  2. copy-paste .ddev/.dbimageBuild/Dockerfile to .ddev/mysql55/Dockerfile (or another folder) and update db>build>context with new folder location.
  3. Use ddev config --omit-containers=db which adds omit_containers: [db] to .ddev/config.yaml

If the db service name doesn't work, use a different one.

(I haven't tried this. but I think there is a good chance it's going to work.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... I'm a bit afraid this "kills" the lightweightness the solution had before... I'm not so sure this would be a solution we should highlight as a blog entry then?

I would be okay to leave this blog entry dangling, if a ddev release allowing to influence the behaviour could be done at some point. Then we could add an info about the version requirement to the entry.. I am not in a hurry to publish this, but I also don't want to blow up the complexity too much.

Copy link
Member

@stasadev stasadev May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s put this PR in draft.

(No new releases this month or next while Randy is bikepacking.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a workaround for this.

@garvinhicking
Copy link
Contributor Author

(thanks so much for the effort of going through the article and finding good improvements to it!)

@stasadev stasadev self-requested a review May 28, 2025 15:16
@stasadev stasadev marked this pull request as draft May 28, 2025 15:27
Copy link
Member

@stasadev stasadev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the entrypoint I added.

If we decide to change some logic for MySQL 5.5 and ARM64 in the future, the blog can be modified.

@garvinhicking
Copy link
Contributor Author

Please check the entrypoint I added.

If we decide to change some logic for MySQL 5.5 and ARM64 in the future, the blog can be modified.

That looks like a clever and valid way to circumvent it, and is lightweight. That works for me! I've added a small note to explain this, what do you think? Thanks so much for going the extra mile on it :-)

Copy link
Member

@stasadev stasadev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a small note to explain this, what do you think?

I don't see it. Please add it and modify the pubDate (let's publish it on Monday or today).

Everything else looks ready.

@stasadev stasadev marked this pull request as ready for review May 30, 2025 10:22
Copy link
Member

@stasadev stasadev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

When you decide to write another blog, use a branch name other than main. It lets you work on multiple articles in parallel and makes review easier.

@stasadev stasadev merged commit 03ec949 into ddev:main May 30, 2025
1 check passed
@garvinhicking
Copy link
Contributor Author

Thank you!

When you decide to write another blog, use a branch name other than main. It lets you work on multiple articles in parallel and makes review easier.

Thanks a lot for the help. Yes, I noticed too I forgot to create a branch first. Will keep it in mind :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants