Getting Started with Lando - testing a fresh Drupal 8 Umami site

Umami demo profile running on Lando for Drupal 8
Testing out the new Umami demo profile in Drupal 8.6.x.

I wanted to post a quick guide here for the benefit of anyone else just wanting to test out how Lando works or how it integrates with a Drupal project, since the official documentation kind of jumps you around different places and doesn't have any instructions for "Help! I don't already have a working Drupal codebase!":

  1. Install Docker for Mac / Docker for Windows / Docker CE (if it's not already installed).
  2. Install Lando (on Mac, brew cask install lando, otherwise, download the .dmg, .exe., .deb., or .rpm).
  3. You'll need a Drupal codebase, so go somewhere on your computer and use Git to clone it: git clone --branch 8.6.x https://git.drupal.org/project/drupal.git lando-d8
  4. Change into the Drupal directory: cd lando-d8
  5. Run lando init, answering drupal8, ., and Lando D8.
  6. Run lando start, and wait while all the Docker containers are set up.
  7. Run lando composer install (this will use Composer/PHP inside the Docker container to build Drupal's Composer dependencies).
  8. Go to the site's URL in your web browser, and complete the Drupal install wizard with these options:
    1. Database host: database
    2. Database name, username, password: drupal8

At the end of the lando start command, you'll get a report of 'Appserver URLs', like:

APPSERVER URLS  https://localhost:32771                        
                 http://localhost:32772                         
                 http://lando-d-8.lndo.site                     
                 https://lando-d-8.lndo.site

You can also get this info (and some other info, like DB connection details) by running lando info. And if you want to install Drupal without using the browser, you could run the command lando drush site-install -y [options] (this requires Drush in your Drupal project, which can be installed via composer require drush/drush).

It looks like Lando has a CloudFlare rule set up that redirects *.lndo.site to 127.0.0.1, and the https version uses a bare root certificate, so if you want to access the HTTPS version of the default site Lando creates, you need to add an exception to your browser when prompted.

Note that Little Snitch reported once or twice that the lando cli utility was calling out to a metrics site, likely with some sort of information about your environment for their own metrics and tracking purposes. I decided to block the traffic, and Lando still worked fine, albeit with a few EHOSTDOWN errors. It looks like the data it tried sending was:

data={"action":"start","app":"0cb10c9ac6d1515dc9f1e857b212d70c636fffcc","type":"drupal8","services":["php:7.1","mysql"],"mode":"cli","devMode":false,"version":"3.0.0-beta.35","os":{"type":"Darwin","platform":"darwin","release":"17.4.0","arch":"x64"},"nodeVersion":"v8.0.0","created":"2018-03-12T18:55:30.947Z"}

Nothing pernicious; I just don't like my desktop apps sending metrics back to a central server.

Docker Notes

For those who also use many other dev environments (some of us are crazy like that!), I wanted to note a few things specific to Lando's Docker use:

  • Lando starts 3 containers by default: one for MySQL, one for Apache/PHP, and one for Traefik. The Traefik container grabs host ports 80, 443, and 58086.
  • Running lando stop doesn't stop the Traefik container, so whatever ports it holds won't be freed up until you run lando poweroff.
  • If another running container (or some other service) is already binding to port 80, lando start will find a different free port and use that instead (e.g. http://lando-d-8.lndo.site:8000).

Comments

Any similar directions for DrupalVM with Docker? :)

Sure!

  1. Ensure you have Docker for Mac/Windows/etc. installed.
  2. docker run -d -p 80:80 -p 443:443 --name=drupalvm --privileged geerlingguy/drupal-vm
  3. docker exec drupalvm install-drupal 8.x-dev
  4. Go to http://localhost/

What is your opinion about lando vs ddvev ? Which one will make it in the future ?

Awesome to see you taking Lando for a spin Jeff! If anyone has questions about using the project, hit us up on Slack (https://launchpass.com/kalabox) or dive into the issue queue on Github. You can turn metrics tracking off in your `~/.lando/config.yml` so that it stops trying to phone home to the metrics tracker, though we definitely appreciate the data we get from the service. See the example config file in the root of the project and just flip the true to a false to handle that.

You can also run with the proxy off if you want by similarly mucking with the config.yml file. Happy local deving!

You can turn metrics tracking off in your ~/.lando/config.yml so that it stops trying to phone home to the metrics tracker, though we definitely appreciate the data we get from the service.

Thanks for that, will do so I don't keep getting errors in the console :)

Another thing worth noting about the Traefik container is it will be restarted automatically when Docker Engine is restarted. Dev machine or Docker Engine restarts can put the container back online w/o the end user realizing it. This can become an issue if you happen to be working on various docker-based projects.

I need HELP here, i am new in lando and Drupal 8, but i manage to install lando and drupal 8 receipt. i am done building my blog type of site. Now my problem is i don't know what files to upload to the hosting. I will use cheap hosting right now due to i am not sure what i am doing for now of my website. i just try and see what happen, and play with it. can you guide me what file to upload to hosting. i am not using the pantheon hosting that Lando recommend coz of the price that i am not sure what i gonna do of the website.

I've done this setup and in step #8, I don't get the install wizard for Drupal 8. I just get the Umami demo template. I don't have any login access to the test site now. How do I get that?

Thank you for the very clear tutorial.
I am new to this whole web development thing, but I am eager to learn..
I am working on few projects at the same time. What should I do to set 'another' drupal instance (or more). Should I repeat instruction #3 and download and a new drupal code base each time? or is there a way to use the same downloaded code base to link it or clone it?

ps. I am used drupal's multi-site where I download the base only once, so I am confused here