I have a partially working configuration of Lando with Bedrock and Sage 10 using Bud 5.7.3. Changes in Bud 5.4.0 have made the configuration older guides in Roots Discourse and elsewhere no longer function. I’m posting this hear to share and to request assistance in getting the bud/Lando configuration fully functional.
.lando.yml (within a sage10 theme and bedrock)
name: lando-bedrock
recipe: wordpress
config:
webroot: web
proxy:
appserver:
- bedrock.lndo.site
theme:
- theme.bedrock.lndo.site:3000
services:
theme:
type: node:16
bud.config.js (the default Sage config + .serve())
/**
* @typedef {import('@roots/bud').Bud} bud
*
* @param {bud} app
*/
module.exports = (app) =>
app
/**
* Application entrypoints
*
* Paths are relative to your resources directory
*/
.entry({
app: ['@scripts/app.js', '@styles/app.scss'],
editor: ['@scripts/editor.js', '@styles/editor.scss'],
})
/**
* These files should be processed as part of the build
* even if they are not explicitly imported in application assets.
*/
.assets(['images'])
/**
* These files will trigger a full page reload
* when modified.
*/
.watch([
'tailwind.config.js',
'resources/views/**/*.blade.php',
'app/View/**/*.php',
])
/**
* Target URL to be proxied by the dev server.
*
* This is your local dev server.
*/
.proxy('http://bedrock.lndo.site')
.serve('http://0.0.0.0:3000'); # 0.0.0.0 instructs node server to bind to all addresses
With this configuration, the Bud dev server is accessible from http://theme.bedrock.lndo.site on both ports 80 and 3000. The only issue now is that bud does not properly intercept URLs, so clicking any link takes me back to the site I’m proxying, instead of the dev url. I’m assuming this is because Bud doesn’t know the proper URL since I’m not passing it in to bud.serve and only defining it for Lando.
Passing in ‘http://theme.bedrock.lndo.site:3000’ to bud.serve results in the error Error: listen EADDRNOTAVAIL: address not available 172.19.0.5:3000
and then Bud chooses a different random port.
I thing needed for a full working configuration is a way for Bud to bind to all ports while also specifying a desired dev url so the rewriting will work properly. In the Bud release notes, Kelly mentions it is now possible to pass in additional options to .serve : Release: 5.7.0 | bud.js
I think these are the options he refers to: HTTP | Node.js v16.14.2 Documentation
I’ve tried to find a way to pass bud.server the desired dev address while overriding the addresses to bind on, but have not yet been successful with that. I’m not sure if this is possible or if we need some additional options in Bud.
I welcome anyone’s thoughts or insights on these issues.