Now that a stable version of Lando 3.x has been released, I have reopened this topic.
To others following along with this tutorial in 2020 (thank you Roots!), if you are getting the error:
“Proxying to an unknown service”
This relates to a change moving to 3.0.0-rc.2+. See: https://docs.lando.dev/guides/updating-to-rc2.html#new-images . Lando has been updated heavily since this tutorial was written…
Or more specifically, see:
Long story short, under the ‘proxy:’ settings in the .lando.yml
, it should be changed from:
proxy:
nginx:
- bedrock.test
to:
proxy:
appserver_nginx:
- bedrock.test
(That is, if you are still following this tutorial. Your specific configuration may differ.)
@coltoneakins have you been able to get the browersync server working for you? Using the Landofile from the tutorial and a bunch of different attempts of my own from reading the Lando docs I haven’t been able to get it to work. There’s always some variation of This site can't be reached
at localhost:3000.
@max_tyrrell
Last night, I did not get to fully setting up the local dev enviroment w/ Lando yet (was working on other stuff). But, I have pretty heavy experience with Node.js and Docker Compose so I am sure I will figure it out. I plan to sit down with this more in the coming days.
I will make an extensive post of what I did (if I find out), and I will be sure to update this thread here too.
Awesome! That’d be amazing!
Update: I plan on eventually updating the Lando guide since I do still actively use Lando.
You can find the old post below if you need to reference it for whatever reason.
Update: this probably won’t work anymore.
This is what I’m using for webpack-dev-server and a non-standard Sage setup. It can probably be adopted to work with BrowserSync if someone wants to give it a shot. In short, replace 8080 with 3000 and then make sure browser-sync binds to 0.0.0.0 instead of default localhost. Also, this means that browser-sync (or dev-server, for me) will always be running. I’m fine with this, but others might prefer to have more control over when it starts and stops.
name: my-roots-site
recipe: wordpress
config:
cache: redis
webroot: web
via: nginx
database: mariadb
xdebug: true
config:
# vhosts: ../lando/default.conf
# php: ../lando/php.ini
proxy:
theme:
- dev-server.lndo.site:8080
services:
appserver:
build:
- composer global require hirak/prestissimo
- composer install --no-interaction --no-progress --no-scripts
- wp package install aaemnnosttv/wp-cli-login-command
- composer install --working-dir=/app/web/app/themes/my-roots-site --no-interaction --no-progress --no-scripts
run:
- wp core is-installed || wp @production db export - | wp db import -
- >-
wp plugin is-installed --skip-packages --skip-plugins --skip-themes wp-cli-login-server ||
wp login install --activate --yes --skip-plugins --skip-themes
- wp acorn optimize:clear
cache:
type: redis
theme:
type: node:12
port: 8080
ssl: true
build:
- yarn --cwd /app/web/app/themes/my-roots-site install --non-interactive --silent --frozen-lockfile
command: yarn --cwd /app/web/app/themes/my-roots-site start --public https://dev-server.lndo.site --key /lando/certs/lndo.site.key --cert /lando/certs/lndo.site.crt --cacert /lando/certs/lndo.site.pem --non-interactive
overrides:
environment:
DEV_SERVER_HOST: '0.0.0.0'
DEV_SERVER_PORT: 8080
tooling:
redis-cli:
service: cache
yarn:
service: theme
cmd: timeout --preserve-status -k 360 300 /usr/local/bin/yarn --cwd /app/web/app/themes/my-roots-site
nuke:
service: appserver
cmd:
- rm -rf /app/vendor
- rm -rf /app/web/wp
- rm -rf /app/web/app/themes/my-roots-site/node_modules
- rm -rf /app/web/app/themes/my-roots-site/vendor
- rm -rf /app/web/app/themes/my-roots-site/dist
events:
pre-stop:
- >-
test -d /app/web/wp &&
test -d /app/vendor &&
wp core is-installed --skip-packages --skip-plugins --skip-themes &&
wp db export
post-start:
- appserver: which php && php --version
- appserver: which wp && wp cli version
- appserver: which composer && composer --version
- theme: which node && node --version
- theme: which npm && npm --version
- theme: which yarn && yarn --version
Wow absolute life safer. I ran into this just now!
My config return only Bad Gateway, I can’t get work with bedrock
name: name
recipe: wordpress
proxy:
theme:
- localhost:3000
config:
php: '7.2'
via: nginx
webroot: web
database: mariadb
xdebug: true
services:
pma:
type: phpmyadmin
hosts:
- database
theme:
type: node:10
services:
ports:
- 3000:3000
tooling:
yarn:
service: theme
my config return bad gateway when run yarn start from container ;(
I am found a solution!
replace
services:
ports:
- 3000:3000
to
overrides:
ports:
- 3000:3000
Hey Max, I did sit down with this more. However, for what it is worth Browsersync practically worked outside of the box for me–my configuration differs only a little from the tutorial. For this reason, I think you might be running into an issue with your configuration–not like a problem with Lando or Bedrock/Sage.
Could you create maybe a minimal repository on GitHub of your project and post it here? I would be happy to troubleshoot with you.
Same problem here
Thanks for this tutorial.
On this part:
Make sure to remove the salts from the
.env
file as Lando does not know how to process them.
Are the salts not necessary? Perhaps they’re just not necessary in development? I wonder if the tutorial could be updated to elaborate on that?
Thanks!
Hi! I’m now trying to setup dev environment, did everything as it was written in the original article but I keep getting error 404 on any of dev urls. It makes a redirect to http://project.test/wp/wp-admin/install.php and that’s it. 404 it is.
My config:
name: project
recipe: wordpress
proxy:
theme: # Optional: add this if you include the Sage specific config down below
- localhost:3000
config:
php: ‘7.2’
via: nginx
webroot: web
database: mariadb
xdebug: trueservices:
theme:
type: node
services:
ports:
- 3000:3000
tooling:
yarn:
service: theme
Any ideas? Thanks in advance!
Ok, problem solved, this helped:
I believe the original guide could be updated.
Also having some issues getting browser sync to work with this setup; anyone know what’s wrong here?
name: test-site
recipe: wordpress
proxy:
appserver_nginx:
- test-site.lndo.site:80
theme:
- test-site.lndo.site:3000
config:
php: '7.4'
via: nginx
webroot: web
database: mariadb
services:
theme:
type: node:10
overrides:
ports:
- 3000:3000
pma:
type: phpmyadmin
hosts:
- database
tooling:
yarn:
service: theme
{
"entry": {
"main": [
"./scripts/main.js",
"./styles/main.scss"
],
"customizer": [
"./scripts/customizer.js"
]
},
"publicPath": "/app/themes/test-site",
"devUrl": "http://test-site.lndo.site",
"proxyUrl": "http://test-site.lndo.site:3000",
"cacheBusting": "[name]_[hash:8]",
"watch": [
"app/**/*.php",
"config/**/*.php",
"resources/views/**/*.php"
]
}
I’m not running Bedrock, but in my case setting proxy for theme as localhost:3000
proxy:
theme:
- localhost:3000
Seems to work with my Sage10 browserStack.
Full .lando.yml
is here:
name: my-project
recipe: wordpress
config:
php: 7.4
xdebug: false
webroot: .
proxy:
theme:
- localhost:3000
services:
database:
type: mariadb
theme:
type: node:13
overrides:
ports:
- '3000:3000'
tooling:
yarn:
service: theme
excludes:
- vendor
- node_modules
@knowler - If I write copy/revisions to the original article on the website for you, will you update it?
Lando v3 has been released for quite some time; only minor revisions need to be made to the article on the website for it to be valid again.
@coltoneakins
Hey, been putting my head against this for a while. Feel like I’m close but seem to be missing something.
If you have got the amendments to the article could you post them somewhere in the meantime until this article gets updated?
Thanks.