Working with Backdrop

Lando offers a configurable recipe for spinning up Backdrop CMS apps. Let's go over some basic usage.

Prefer video tutorials?

Getting Started

Before you get started with this recipe we assume that you have:

  1. Installed Lando
  2. Read up on how to get a .lando.yml

If after reading #2 above you are still unclear how to get started then try this

# Go into a local folder with your site or app codebase
# You can get this via git clone or from an archive
cd /path/to/my/codebase

# Initialize a basic .lando.yml file for my recipe with sane defaults
lando init

# Commit the .lando.yml to your git repo (Optional but recommended)
git add -A
git commit -m "Adding Lando configuration file for easy and fun local development!"
git push

For more info on how lando init works check out this.

Starting Your Site

Once you've completed the above you should be able to start your Backdrop site.

# Start up app
lando start

# List information about this app.
lando info

If you visit any of the green-listed URLs that show up afterwards you should be welcomed with the Backdrop installation screen. Read below on how to import your database.

Importing Your Database

Once you've started up your Backdrop site you will need to pull in your database and files before you can really start to dev all the dev. Pulling your files is as easy as downloading an archive and extracting it to the correct location. Importing a database can be done using our helpful lando db-import command.

# Go into my app
cd /path/to/my/app

# Grab your database dump
curl -fsSL -o database.sql.gz ""

# Import the database
# NOTE: db-import can handle uncompressed, gzipped or zipped files
# Due to restrictions in how Docker handles file sharing your database
# dump MUST exist somewhere inside of your app directory.
lando db-import database.sql.gz

You can learn more about the db-import command over here


Each Lando Backdrop recipe will also ship with helpful dev utilities. This means you can use things like drush, composer and php-cli via Lando and avoid mucking up your actual computer trying to manage php versions and tooling.

lando composer                 Run composer commands
lando db-import <file>         Import <file> into database. File is relative to approot.
lando db-export                Export a database. Resulting file: {DB_NAME}.TIMESTAMP.gz
lando drush                    Run drush commands
lando mysql                    Drop into a MySQL shell
lando php                      Run php commands
# Download a dependency with drush
lando drush dl webform

# Check hte app's php version
lando php -v

You can also run lando from inside your app directory for a complete list of commands.


By default our Backdrop recipe will globally install the latest version of Drush 8 as well as the latest version of Backdrop Drush. This means that you should be able to use lando drush out of the box.

If you are using a nested webroot you will need to cd into your webroot and run lando drush from there. This is because many site-specific drush commands will only run correctly if you run drush from a directory that also contains a Backdrop site.

To get around this you might want to consider overriding the drush tooling command in your .lando.yml so that Drush can detect your nested Backdrop site from your project root. Note that hardcoding the root like this may have unforseen and bad consequences for some drush commands such as drush scr.

    service: appserver
      - "drush"
      - "--root=/app/PATH/TO/WEBROOT"



You can also manually configure the .lando.yml file to switch php versions, toggle between apache and nginx, activate xdebug, choose a database type and version, set a custom webroot location and use your own configuration files.

# Backdrop recipe
name: backdropcms

# Start with the default Backdrop recipe
recipe: backdrop

# Configure the Backdrop recipe

  # See:

  # Optionally specify the php version to use.
  # If ommitted this will default to the latest php version supported by Backdrop.
  # Consult the `php` service to see what versions are available. Note that all
  # such versions may not be supported in Backdrop so YMMV.
  # See:
  # NOTE: that this needs to be wrapped in quotes so that it is a string
  php: '7.0'

  # Optionally specify whether you want to serve Backdrop via nginx or apache
  # If ommitted this will default to the latest apache
  # See:
  # via: nginx

  # Optionally specify the location of the webroot relative to your approot.
  # If ommitted this will be your approot itself.
  webroot: www

  # Optionally specify how you want Lando to handle Backdrop Drush. There are a few options
  # If omitted this will globally install the latest stable version of Backdrop Drush 8
  # 1. Install Globally
  # This will globally install the corresponding version posted over at
  # backdrush: 0.0.6
  # 2. Do nothing
  # This will tell Lando to not do anything, e.g. it's up to the user
  # backdrush: false
  backdrush: 0.0.6

  # Optionally specify the database type, this can be one of:
  #   - `mysql`
  #   - `mariadb`
  # If ommitted this will default to the latest mysql. You can additionally provide
  # a version with `type:version` but you will need to consult the documentation
  # for the correct DB service to see what versions are available
  # See:
  database: mariadb

  # Optionally activate xdebug
  # If you are having trouble getting xdebug to work please see:
  xdebug: true

  # Optionally mix in your own config files
  # If ommitted this will use "sane defaults" for your recipe type
  # conf:

    # For more information on setting these files check out the documentation
    # and examples
    # Docs:
    # Examples:
    # server: config/backdrop.conf
    # php: config/php.ini

    # For more information on setting these files check out the documentation
    # and examples for the relevant services:
    # MySQL:
    # MariaDB:
    # PostGres:
    # Examples:
    # database: config/mysql

You will need to rebuild your app with lando rebuild to apply the changes to this file. You can check out the full code for this example over here.

Environment Variables

The below are in addition to the default variables that we inject into every container. These are accessible via php's getenv() function.

BACKDROP_SETTINGS should allow for Backdrop to automatically connect to your database.

# The below are specific examples to ILLUSTRATE the KINDS of things provided by these variables
# The content of your variables may differ

NOTE: These can vary based on the choices you make in your recipe config. NOTE: See this tutorial for more information on how to properly use $LANDO_INFO.


You can take advantage of Lando's events framework to automate common tasks. Here are some useful examples you can drop in your .lando.yml to make your Backdrop app super slick.


  # Clear backdrop caches after a database import
    - appserver: cd $LANDO_WEBROOT && drush cc all -y

  # Runs composer install and a custom php script after your app starts
    - appserver: cd $LANDO_MOUNT && composer install
    - appserver: cd $LANDO_WEBROOT && php script.php

Advanced Service Usage

You can get more in-depth information about the services this recipe provides by running lando info.

Read More

Workflow Docs

Advanced Usage

results matching ""

    No results matching ""