Roots Discourse

Dockerize Local Bedrock & Sage Development with Lando

#1

Originally published at: https://roots.io/guides/dockerize-local-bedrock-and-sage-development-with-lando/

I’ve been pretty obsessed with using Docker for local development lately. I love how fast and lightweight it is and how I can run software versions that I don’t need to have installed locally — avoiding the mess that that can make of your system. Docker is awesome, however, if you’ve ever used Docker, you…

3 Likes

#2

Great Tutorial! …on my new laptop I’ve kept my primary user a standard (non-admin) user which had been causing a number of headaches with my local dev setup using homebrew/valet, but this was the perfect solution!

I just wanted to point out my initial issues in case anyone else were to run into them as well. I was converting a valet site to lando but kept having issues getting lando to start when the wordpress salts included in the .env file. After running lando start i would get:

ERROR: Invalid interpolation format for "environment" option in service "appserver": "8g?[N8=Q>$kxC.LtAL^v)!-#WX{O@U3seuz@;kngc4eK}:@M4MBBOPM}-)q$=!F4"

BUT once I removed the salts and kept ONLY what you had detailed in the tutorial lando started up without any issue!

Thanks!

1 Like

#3

Thanks for pointing this out. I remember running into this issue when figuring all this out. I’ll update the tutorial to reflect this.

0 Likes

#4

Thanks for this post, this setup looks pretty nice. I’m pretty new to lando and docker. Do you have any idea why running : lando composer install gives me the error Composer could not find a composer.json file in /app. I followed the steps and just created a basic bedrock + sage setup and have the default composer.json in my project root folder.

0 Likes

#5

It seems like you are running lando composer install from web/app directory within Bedrock. Instead, you should run it from the root Bedrock directory since that is where the composer.json file is located.

0 Likes

#6

Looks like I was doing the right thing but I forgot to do a lando rebuild. Thanks a lot for your quick answer.

1 Like

opened #8
0 Likes

#9

Do you have any tutorial about deploying Lando on server?

0 Likes

#10

Lando isn’t actually designed to be a production/remote server solution, it’s for local development. From their docs:

It’s a free, open source, cross-platform, local development environment and DevOps tool built on Docker container technology and developed by Tandem.

I do know that there is integration with hosting providers like Pantheon, however, I do not have any experience with that.

0 Likes

#11

I see, thanks for clearing this out. I’m just new to Docker. But I’m trying to run Bedrock using Docker on server. But I don’t know what’s the best approach for it.

0 Likes

#12

I don’t have any experience with Docker for PHP applications in production, but I would recommend checking out something like Laradock. Bedrock shouldn’t be too difficult to set up with it.

0 Likes

#13

I have a question… I use lando for other projects and it works find… With this specific recipe I can’t let yarn work properly.

The problem is that when i run “yarn start”, it compules the first time all the assets but then it doesn’t take the changes and I have to work re-running yarn start any time. Do you have any idea of what it can be?

0 Likes

#14

Thank for the fantastic tutorial. I got all working in a few minutes but for some reason the Browsersync times out for me.

{
  "entry": {
    "main": [
      "./scripts/main.js",
      "./styles/main.scss"
    ],
    "customizer": [
      "./scripts/customizer.js"
    ]
  },
  "publicPath": "/app/themes/sage",
  "devUrl": "https://appserver_nginx.sovereign.internal",
  "proxyUrl": "https://localhost:3000",
  "cacheBusting": "[name]_[hash:8]",
  "watch": [
    "app/**/*.php",
    "config/**/*.php",
    "resources/views/**/*.php"
  ]
}

Any idea where I am going wrong?

0 Likes

#15

I found a solution, instead of running the Browsersync from the container, just run it local. Not a great solution, preferred way would be to run inside it.

For anyone using Capistrano for deploy, I managed to get it working with those small additions to the lando.yml

name: sovereign
recipe: wordpress
proxy:
theme:

  • localhost:3000
    config:
    php: ‘7.2’
    via: nginx
    webroot: web
    database: mariadb
    xdebug: true

services:
theme:
type: node
overrides:
ports:
- 3000:3000
ruby:
type: ruby:2.4
install_dependencies_as_me:

  • gem install capistrano
  • gem install capistrano-composer
  • gem install capistrano-wpcli
  • gem install bedrock-capistrano-uploads
  • gem install capistrano-file-permissions
    tooling:
    yarn:
    service: theme
    gem:
    service: ruby
    ruby:
    service: ruby
    cap:
    service: ruby
    database:
    portforward: 3306
0 Likes