I decided to give radicle a try, in an effort to reduce my WSL development frustrations. It hasn’t been going so well! It’s Radicle 1.4.1 by the way.
Anyway, now I’m stuck where any css or blade changes are not being reflected in the browser during development. Forcing a full refresh updates the blade templates but new tailwind classes, or custom classes added to app.css are not updated or added to the css.
What am I missing here? It seems like I need to configure something but I’m not seeing any explanation in the docs.
Should I be working in the mounted windows (/mnt/) folders or should I be working directly in WSL folders?
Also, should I be using yarn dev or lando yarn dev?
@ben Thanks. @decoycircuit left a clue in that post where they stated that they work exclusively in WSL now. So I have tried that and everything is running much smoother now.
So to be clear, do not work in the /mnt/ folders of WSL. It’s really slow and browsersync does not work. Working directly in WSL folders through VSCode is super fast and everything seems to work fine so far.
And to answer my other question, yarn dev seems to work much better than lando yarn dev, the latter doesn’t seem to work with browsersync.
I’ll come back with any more tips I might discover.
I believe every solution needs a quick explanation
So here’s why you should not and cannot run the Bud Dev Server through Lando.
What’s actually happening
Running lando yarn dev will run yarn bud build developmentinside the build service container. This launches a bud development server in the build container which is listening on port 4000 for live reload.
The problem with Lando, Docker and missing port mapping
There’s no port mapping configured for port 4000. When you open http://localhost:4000 in your browser the build container has no chance of knowing that you want to reach it.
The only port being mapped for the build container is 443.
Solution
In WSL2 you have to run yarn dev on your linux host.
Also you’ll need to make sure that Yarn Classic is installed globally for your user (npm install --global yarn).
Additional thoughts There are several ways to set up individual port mappings with Lando. But I don’t think it worth the effort in this case.
That’s again a topic for the whole solution architecture with Docker containers.
The actual code execution of your codebase and the execution of the WordPress core happens inside the appserver container. You can see the container list by typing docker ps into your shell: it’s usually called yourprojectname_appserver_1.
Actually when working with WordPress in Docker containers you shouldn’t execute the WordPress CLI on your host system at all.
lando wp makes sure that the WP-CLI is executed inside the appserver container.
You can also shell into your appserver container with the command lando ssh. If you need to do some stuff that requires root privileges the command is lando ssh --user=root.
Basically SSH’ing into the appserver container and running wp somecommand manually is the same as running lando wp somecommand from your host system.
I hope that explains why you got an DB connection error on your host system