Jump to content

Using DDEV for local ProcessWire development (tips & tricks)


bernhard

Recommended Posts

I've created a custom alias:

Quote

alias ddc="limactl start && ddev config --php-version=8.3 --database=mariadb:10.6 --webserver-type=apache-fpm --timezone=Europe/Vienna --omit-containers=dba --web-environment='TRACY_LOCALROOTPATH=\$DDEV_APPROOT/'"

So all I have to do is type "ddc" and hit enter

  • Like 3
Link to comment
Share on other sites

On 8/13/2024 at 4:17 PM, bernhard said:

I've created a custom alias:

So all I have to do is type "ddc" and hit enter

Have you found a solution for specifying multiple "upload_dirs" inside this initial config call? It seems not to work here.

Link to comment
Share on other sites

Here you go:

alias ddc="limactl start && ddev config --php-version=8.3 --database=mariadb:10.6 --webserver-type=apache-fpm --timezone=Europe/Vienna --omit-containers=dba --web-environment='TRACY_LOCALROOTPATH=\$DDEV_APPROOT/' --upload-dirs='site/assets/files,foo/bar'"

Note that you need to reload your shell after updating your alias file!

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...

I'm really enjoying DDEV and ProcessWire as I dive back into web development more seriously after many years. However, debugging has always been one of my weak areas, and I'm keen to get that sorted out.

So far, I've struggled to find a great tutorial on setting up DDEV with VS Code specifically for ProcessWire. Most of what I've come across are lengthy Drupal tutorials with Drupal-specific settings, which end up overwhelming me.

If there isn't a good resource out there, could you please share your setup procedure and the VS Code extensions, settings you've made in "settings.json" that you use with your DDEV ProcessWire environment? 

For example, I'd like to be able to open a file with a reported error from Tracy Debugger in VS Code, by clicking on it but of course:

but my current setup isn't allowing me to do that.

I'm also using RockFrontend—thank you @bernhard It's a pleasure to work with, especially when adapting static HTML templates. 

Thank you so much. 

  • Like 1
Link to comment
Share on other sites

I've done a video about DDEV, but it doesn't go through setting up ddev. Just follow the instructions on the ddev website.

 

6 minutes ago, Greg Lumley said:

For example, I'd like to be able to open a file with a reported error from Tracy Debugger in VS Code, by clicking on it but of course:

For this you need to tell tracy debugger where the files live on your local file system. This is because PW + Tracy run inside the container and inside the container your files live in /var/www/html. So if you click on a debugging link in tracy then your OS tries to find the file /var/www/html/foo.php and obviously can't find it.

// tracy config for ddev development
$config->tracy = [
  'outputMode' => 'development',
  'guestForceDevelopmentLocal' => true,
  'forceIsLocal' => true,
  'localRootPath' => '/path/to/your/project/',
  'numLogEntries' => 100, // for RockMigrations
  'editor' => 'cursor://file/%file:%line',
];

The important part for you is the "localRootPath" setting.

  • Like 2
Link to comment
Share on other sites

  • 1 month later...

Hi all!

I am developing locally with ProcessWire and DDEV, and since some days, ddev slows down very much. When I start it, it's very, very fast, but after some "database interaction" like saving some changes on pages or creating new fields, it gets terribly slow. I mean like 20 to 30 seconds load time in the backend when opening a page.

When I do `ddev restart` it's fast again for a short period of time, but after some interaction, it again slows down.

There are no errors on the page, I am really sure that this is only an issue with ddev and not with my website project. And it's a rather small project, i.e. no big database etc.

Does anyone have any tips what I can do to resolve this problem? I currently don't have any clue what's going on and where or what I could test to find out something.

Link to comment
Share on other sites

Are you on Windows? I've had similar issues on my old windows laptop but don't know why that happened. I didn't look into it, as I had to switch to apple anyhow..

Did you make sure to turn off all other projects with ddev poweroff?

Other than that I think it would be best to ask for help at DDEV, they are very active with helping out.

Link to comment
Share on other sites

Thanks @bernhard ! Yes, I turned off everything else with `ddev poweroff` and there are no other heavy tasks running on my computer. And yes, it's a Windows laptop, and some days ago there was a huge Windows update. Perhaps that did mess up something with WSL2, Docker, etc. Running my IDE PHPStorm in the Docker container didn't work well, when I first tried it, so I am currently stuck with that Windows to Docker mutagen sync stuff (which I don't fully understand yet :-)). I will try to find out when exactly the performance drops occur.

If anyone had similar performance issues, I would be thankful for any hints.

Link to comment
Share on other sites

@nurkkaMutagen is mostly for macOS users and does not have to be enabled on WSL2. WSL2 is already the preferred environment for Windows users, but if you’re still using traditional Windows this makes a huge difference. Turning on Mutagen doesn’t make sense on Linux or WSL2.

Do you have TracyDebugger installed? Take a look if you got logging enabled. In some projects Tracy Logs and Informations take a long time to load (but 30 secs is really too long). Try to disable Tracy and if the load time is still slow. But you mentioned, that after a ddev restart it feels fast again, so Tracy (or the logs) are not the culprit.

 

  • Like 1
Link to comment
Share on other sites

Thanks @dotnetic ! When installing DDEV the first time, I tried to use it "directly" in WSL2, but that didn't work (in my case). I then switched to the windows version of DDEV with Docker Desktop, and that worked perfectly until some days ago. I was really happy with that setup and had not planned to switch that anytime soon 🤪

Until now, I also had no problems with mutagen, except for sometimes a longer startup time when doing `ddev start`. But when DDEV ran, it always was super fast ... until now.

Yes, I have TracyDebugger, but logging is turned off.

🤷‍♂️

Link to comment
Share on other sites

And this is good time to say thanks to @bernhardand others here for making me look at DDEV! For some reason I used to confuse it with Devil Box. DDEV is great! I have it working for different sites some of which are in a multi-site setup with different databases but one ProcessWire.

  • Like 1
Link to comment
Share on other sites

On 10/25/2024 at 9:29 AM, nurkka said:

I am developing locally with ProcessWire and DDEV, and since some days, ddev slows down very much.

What version of DDEV are you using? I know there is a recent update, 1.23.5. I am wondering whether this could be responsible for the slowness? I am on version 1.23.4 and have not upgraded yet (and running in WSL2 as mentioned earlier).

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...