I’d like to help you out more with this–but, I need more details from you.
Getting a 404 error might mean either of the following:
A service like Apache may be running on your computer which is interfering with Lando.
There is a permissions issue with the WordPress file your are trying to visit in your web browser. For example, if you are visiting the home page, the index.php file may have bad permissions.
(More unlikely) Your computer may have had problems binding the example.local URL to your computer’s localhost.
I would try @Davide_Prevosto’s steps above. It may fix your issue.
Otherwise, if you feel comfortable doing so, maybe we could screenshare via Discord and troubleshoot this together?
Note: This issue is probably an issue with YOUR computer/setup–not the steps above. This is because other people tried my steps and verified they are working.
It seems the autoloader does not work correctly. I am keep getting an error on wordpress installation.
Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /app/web/wp/wp-includes/wp-db.php on line 1626
No such file or directory
Error establishing a database connection
This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down.
Are you sure you have the correct username and password?
Are you sure you have typed the correct hostname?
Are you sure the database server is running?
If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.
So I spent a lot of time and reading trying to get this setup to work and I feel I am pretty close. But somehow I can’t get browsersync/localhost to work.
The problem:
After lando start the following url is red: THEME URLS http://localhost
lando yarn dev seems to work fine, no errors and it notices changes I make etc.
But http:/localhost:3000 is not accessible (‘This site can’t be reached’)
Any help would be greatly appreciated!
My configuration:
.lando.yml
name: bedrock
recipe: wordpress
env_file:
- .env
proxy:
appserver_nginx:
- bedrock.lndo.site
theme:
- localhost:3000
- localhost:3001
config:
php: 7.4
composer_version: 2-latest
via: nginx
webroot: web
database: mariadb
xdebug: true
# Add the following if you plan to use Sage as a starter theme
services:
theme:
type: node:16
overrides:
ports:
- 3000:3000
- 3001:3001
tooling:
yarn:
service: theme
excludes:
- vendor
- node_modules
.env
DB_NAME='wordpress'
DB_USER='wordpress'
DB_PASSWORD='wordpress'
DB_HOST='database'
WP_ENV='development'
WP_HOME='https://bedrock.lndo.site'
WP_SITEURL="${WP_HOME}/wp"
# Generate your keys here: https://roots.io/salts.html
# (I tried without salts but didn't make a difference, so I probably put them back here)
I’ve also been fighting with this issue. I had a working lando + bedrock + sage config (basically the same as @cim posted above) that worked well while using mix and with bud 5.3.0. Once I updated to bud 5.5.0 I could not get bud dev to work properly.
When I use bud.serve(‘http://localhost:3000’) it runs but I get no response from localhost:3000 and the ‘[dev]’ and ‘[proxy]’ urls in the terminal show as grey. When I use bud.serve(‘http://bedrock.lndo.site:3000’) i get the error:
Error: listen EADDRNOTAVAIL: address not available 172.19.0.5:3000
If I remove bud.serve(), it succeeds using a random port which I also can’t access.
Access to fetch at 'http://bedrock.lndo.site/app/themes/sage/public/app.afb458e755e818e47fec.hot-update.json' from origin 'http://bedrock.lndo.site:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I’m using Lando (Docker wrapper) and I have exposed the port 3000 for node. But if I remove the .serve() line, i cant use the generated localhost:xxxx as this port hasn’t been exposed in docker and site using localhost:xxxx is unreachable.
So my understanding is since I am using Docker, I have to remove the serve() line, but I also need to find a way to expose any random generated port on localhost through docker?
I’ve been trying to troubleshoot this all week. I’m not sure if it’s a Bud issue or Lando. My lando file looks like this, but I’ve also tried a separate sub domain for the theme proxy, with and without a specific port.
When i visit http://localhost:3000 directly or curl -I 'http://localhost:3000 i get ’ Empty reply from server’, but if I lando ssh -s theme and then run the same curl command, I get the expected response:
It seems, for some reason, that requests are being properly directed to the theme container, or are somehow being modified, but I can’t track down why.
Also, when i specify the same domain in bud.serve as in proxy, i get the error Error: listen EADDRNOTAVAIL: address not available 172.19.0.2:3000
No, I’m still stuck on this one. Not really sure what the next troubleshooting steps are, but happy to help if you have any ideas. I’ve settled on using v5.3.2 for now.
No luck here either. Working with Trellis now. But I’m keeping an eye on this bug report that was recently added and is probably related to our problem.
Hi @kellymears, I’m still having the same issue with bud and Lando, even with version 5.7.3. I’ve tried specifying ports 3000, 3030, and 31234 all with the same results. I can SSH into the container running bud and receive the proper response there, but from outside the container I always get an “Empty reply from server.”
This is an old guide that is not up-to-date with the current state of Sage
These replies give the impression that there is an issue with Bud
This is just a matter of configuring Lando correctly. There is not anything in either Bud or Lando that are preventing the tools from working with each other. We are using Lando with Bud on two different internal projects at Roots: one with Sage, one with Laravel.
We’d love either an update to this guide or a new one. If you’re interested in contributing and getting paid to write, please see Write for Roots