Lando

Lando is a very interesting cross platform, free and open source alternative built on Docker technology to get your local development environment up and running ! Lando is designed to work with most major languages, frameworks and services, it provides an easy way for developers of all skill levels to specify simple or complex requirements for their projects, and then quickly get to work on them.

We received before, questions from readers asking for local development platforms, should you use LAMP, WAMP, MAMP, Docker, Laragon …etc ? In reality it really depends from a developer to another, in the last years we started preferring to use virual containers such as Docker, since it will avoid any interaction with the local system and in the same time you can have everything you want inside a container that you can move everywhere.

Lando features

Lando is great to mimic your production environment locally, it helps standardizing your team’s dev environments and tooling on OSX, Windows and Linux, and provides you with a complete set of tools to automate your local environment development. With such tool you can automatically set up normally arduous things like SSL, SSH keys, pretty urls, cross container networking, build steps, run time automation events and fast file sharing.

Finally, you can easily run your CI tests locally, and your local tests in CI, and Integrating with hosting providers like Lagoon, Pantheon and Platform.sh. Lando could be considered as both an abstraction layer and superset of Docker Compose as well as a Docker Compose utility. It comes with a great set of recipes, services and advanced configuration available by default, that you can directly use or customize for your project.

Lando

For example you can quickly install a Vanilla Drupal 7 instance using :

# Create a new directory for this example and enter it
mkdir drupal7 && cd drupal7

# Initialize a new lando drupal using vanilla d7
lando init \
  --source remote \
  --remote-url https://ftp.drupal.org/files/projects/drupal-7.59.tar.gz \
  --remote-options="--strip-components 1" \
  --recipe drupal7 --webroot . \
  --name hello-drupal7

# Start the site
lando start

# Use the lando-provided drush to do a site install
lando drush si --db-url=mysql://drupal7:drupal7@database/drupal7 -y

# Check out your new site!
open https://hello-drupal7.lndo.site

# Destroy it
lando destroy -y

Then you can customize the Lando configuration by adding node tooling, solr, phpmyadmin, custom php config etc… we can see below an example of WordPress recipe with Postgres database, PHP7.3 and xdebug enabled :

name: my-app
recipe: wordpress
config:
  database: postgres
  php: '7.3'
  xdebug: true
  config:
    php: my-custom-php.ini
events:
  post-db-import:
    - appserver: wp search-replace
proxy:
  pma:
   - database-my-app.lndo.site
services:
  appserver:
    build_as_root:
      - apt update -y && apt-get install vim -y
      - /helpers/my-script-to-install-php-extension.sh memcached
    build:
      - composer install
    overrides:
      environment:
        APP_LEVEL: dev
        TAYLOR: swift
  index:
    type: solr
  node:
    type: node:10
    globals:
      gulp: latest
    build:
      - yarn
  frontend:
    type: node:10
    command: yarn start
    build:
      - yarn
  pma:
    type: phpmyadmin
    hosts:
      - database
tooling:
  yarn:
    service: node
  node:
    service: node
  gulp:
    service: node
  test:
    cmd:
      - appserver: composer test
      - frontend: yarn test
  deploy:
    service: appserver
    cmd: /path/to/script.sh

Starting your new Lando project is quiet simple and easy using start command, but you can also see what tools are available in your app, run wp-cli commands, drop into a postgres shell, import database, run composer and yarn tests, install a node package or even start up a gulp watch.

# See what tools are available in your app
lando

# Run wp-cli commands
lando wp

# Drop into a postgres shell
lando psql

# Import a database
lando db-import dump.sql

# Run composer and yarn tests
lando test

# Install more node packages
lando yarn add bootstrap

# Start up gulp watch
lando gulp watch

Once you are eeling good about your Landofile, commit it to your repository so other developers can easily get spun up. Your local development team will simply pull the git repository then start lando.

Lando is an open source software released under a GPLv3 license. More information and download at https://lando.dev/

LEAVE A REPLY

Please enter your comment!
Please enter your name here