Local Dev Environments: Lando vs Drupal VM

Benji Fisher

August 4, 2020

Introduction

Follow along

About Me

Yellow Pig 

About ???

Outline

  • Introduction
  • Lando vs. Drupal VM
  • Drupal and Gatsby with Lando
  • Automated Tests with Lando
  • Other Stuff (optional)

Lando vs. Drupal VM

Current Project: ACSF and BLT

  • Lando is my usual preference.
  • Drupal VM may have better performance, esp. on Macs.
  • Plan: support both, test performance, optimize.

Lando Quick Start

Lando Config (snippet)

Drupal VM Requirements

  • VirtualBox
  • Vagrant
  • PHP, at least version 7.3.0.
  • Composer, at least version 1.10.1.
  • Git
  • Ansible (optional, for performance)
  • Python 3

Drupal VM Quick Start

  • git clone ...
  • cd ...
  • composer install
  • vagrant up
  • vagrant ssh
  • blt setup

Drupal and Gatsby with Lando

My Drupal/Gatsby Quick Start

  • One repo, one Lando file, get Drupal and Gatsby
  • git clone https://gitlab.com/benjifisher/lando-gatsby-drupal.git
  • cd lando-gatsby-drupal
  • lando start

Lando Gatsby Drupal: https://gitlab.com/benjifisher/lando-gatsby-drupal

LGD Config

Automated Tests with Lando

Lando + Drupal Contribution (@serundeputy)

Automated Tests

  • Hard part: run chromedriver for JS tests.
  • Blog post: How to run Drupal’s PHPUnit tests in Lando (Tancredi D’Onofrio, agile.coop)
  • Twitter (@AgileCollective, @karimboudjema, @serundeputy, @benji17fisher)
  • Pull Request

Lando Config for Testing

name: drupal-contributions
recipe: drupal8
config:
  webroot: web

services:
  appserver:
    run:
      # @todo remove invocation of drupal-phpunit-upgrade again once https://www.drupal.org/project/drupal/issues/3099061 is resolved.
      - cd /app/web && composer install && composer run-script drupal-phpunit-upgrade
    overrides:
      environment:
        SIMPLETEST_BASE_URL: "https://drupal-contributions.lndo.site/"
        SIMPLETEST_DB: "sqlite://localhost/tmp/db.sqlite"
        MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", {"browserName":"chrome","chromeOptions":{"args":["--disable-gpu","--headless", "--no-sandbox"]}}, "http://chrome:9515"]'
  chrome:
    type: compose
    app_mount: false
    services:
      image: drupalci/webdriver-chromedriver:production
      command: chromedriver --log-path=/tmp/chromedriver.log --verbose --whitelisted-ips=

tooling:
  drush:
    service: appserver
    cmd:
      drush --root=/app/web --uri=https://drupal-contributions.lndo.site
  si:
    service: appserver
    description: Install Drupal
    cmd:
      - appserver: /app/scripts/site-install.sh
  patch:
    service: appserver
    description: Get a patch from a Drupal project issue queue
    cmd:
      - appserver: php /app/scripts/patch-helpers.php
    options:
      url:
        describe: The url of the patch from the issue queue
  revert:
    service: appserver
    description: Apply a patch from a Drupal project issue queue
    cmd:
      - appserver: php /app/scripts/patch-helpers.php --revert
    patch:
      describe: The name of the patch to revert; i.e. DESCRIPTION-XXXXXXX-YY.patch
  create-patch:
    service: appserver
    description: Creat a patch from your committed changes on your branch.
    cmd:
      - appserver: php /app/scripts/patch-helpers.php --create-patch
  phpunit:
    service: appserver
    user: www-data
    cmd:
      - appserver: /app/web/vendor/bin/phpunit -c /app/config

  test:
      service: appserver
      cmd:
        - php /app/web/core/scripts/run-tests.sh --php /usr/local/bin/php --url https://drupal-contributions.lndo.site --color --verbose

events:
  post-destroy:
    - rm -rfv web
  pre-rebuild:
    - rm -rfv web
    - appserver: php /app/scripts/get-drupal.php
  post-rebuild:
    - appserver: /app/scripts/rebuild.sh

Other Stuff (optional)

Fences

Fences: https://www.drupal.org/project/fences

Drupal 8.9.0 Release Notes

Two issues called out under “Corrected deprecation errors” in release notes:

Both were Novice issues that I created.

Migrate API

Copyleft

Creative Commons License
This slide deck by Benji Fisher is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Based on a work at https://gitlab.com/benjifisher/slide-decks.