Skip to main content

As Drupal developers, having a fast and reliable local development environment is key to a smooth workflow. When combined with Pantheon — a powerful cloud-based Drupal hosting platform — Lando can significantly improve how you build, test, and deploy Drupal sites. In this guide, we’ll explore how to leverage both tools together to create an optimized local development experience for Drupal sites hosted on Pantheon.

🔹 What Is Lando?

Lando is a Docker-based local development environment designed to help developers quickly set up and manage complex web applications. It provides pre-configured environments for popular CMS platforms like Drupal, WordPress, and Laravel, all with an easy-to-use configuration file (.lando.yml) that enables you to spin up your entire stack in just a few commands.

Lando allows you to emulate your production environment on your local machine, making the development process much smoother, and ensuring consistency between environments.

🔹 Why Use Pantheon and Lando Together?

Pantheon is a managed hosting platform designed specifically for Drupal and WordPress, providing optimized environments for development, staging, and production. By combining Pantheon’s cloud platform with Lando’s local development environment, developers can:

  • Work locally in an environment that mirrors Pantheon’s infrastructure.

  • Sync databases and files between local and remote environments with minimal friction.

  • Use Pantheon’s powerful tools like Terminus to automate deployments, backups, and more from within your Lando environment.

🔹 Setting Up Lando for Local Drupal Development

Here’s how to set up Lando for a Drupal site hosted on Pantheon:


Step 1: Install Lando

If you haven't already installed Lando, head to Lando’s official installation page and follow the instructions for your operating system.

Once installed, verify it by running:

 
lando version

Step 2: Create a .lando.yml File

In the root directory of your Drupal project, create a .lando.yml file. Here’s a basic configuration for a Drupal 9 or 10 project hosted on Pantheon:

 
name: my-drupal-site services:  appserver:    type: php:8.2-apache    via: php-fpm    webroot: web    xdebug: true  database:    type: mariadb:10.4    creds:      user: drupal      password: drupal      database: drupal    portforward: true tooling:  drush:    service: appserver    cmd: drush  php:    service: appserver    cmd: php 

This configuration defines the basic services Lando will create:

  • appserver: A PHP 8.2 Apache server that serves your Drupal site.

  • database: A MariaDB database container for local development.

  • drush: Custom tooling to run Drush commands from within the Lando environment.


Step 3: Start Lando and Import Your Pantheon Site

In your terminal, navigate to your project folder and start Lando:

 
lando start

Once the Lando environment is up and running, you can connect your local environment with the Pantheon site by pulling the latest database and files.

  1. Install Terminus (Pantheon’s CLI tool) if you don’t have it already:

 
curl -sS https://github.com/pantheon-systems/terminus/releases/download/3.x/terminus.phar -o /usr/local/bin/terminus chmod +x /usr/local/bin/terminus
  1. Authenticate Terminus:

 
terminus auth:login
  1. Pull the database and files from Pantheon:

 
# Replace with your Pantheon site name terminus drush <pantheon-site>.dev -- sql-dump --result-file=db.sql terminus sftp <pantheon-site>.dev --get=files

Now, you can place the db.sql file into your Lando environment’s database and the files directory into sites/default/files/ in your local directory.

 
lando drush sql:cli < db.sql

Your local site should now be synced with Pantheon’s database and files.


🔹 Using Pantheon’s Multidev with Lando

Pantheon’s Multidev allows developers to create isolated environments for features, bug fixes, or QA. You can easily integrate this into your local workflow by creating a new multidev environment on Pantheon and syncing it to Lando.

  1. Create a Multidev Environment:

terminus multidev:create <pantheon-site>.dev feature-branch
  1. Sync Database and Files to Local:

terminus drush <pantheon-site>.feature-branch -- sql-dump --result-file=db-feature.sql terminus sftp <pantheon-site>.feature-branch --get=files
  1. Import to Lando:

 
lando drush sql:cli < db-feature.sql

This allows you to develop new features or fixes in isolation while maintaining parity with Pantheon’s cloud infrastructure.


🔹 Automating the Workflow with Pantheon’s Terminus and Lando

Once you have your Lando environment set up, it’s time to automate your development workflow by integrating Pantheon Terminus commands within Lando. You can create custom Lando commands to make database imports, exports, and other Pantheon tasks seamless.

 
tooling:  terminus:    service: appserver    cmd: terminus 

Now you can use lando terminus to execute Terminus commands directly from your local environment:

lando terminus drush <pantheon-site>.dev cr

🔹 Conclusion

Integrating Lando with Pantheon for local Drupal development streamlines the process of building, testing, and deploying your site. By combining Pantheon’s powerful cloud infrastructure with Lando’s fast local environments, you create a flexible and consistent workflow that reduces deployment errors and improves collaboration across teams.

Whether you're building on Drupal 9 or 10, Lando makes it easy to match your local environment to Pantheon’s cloud infrastructure, creating a seamless transition between environments.


🔑 Takeaways:

  • Lando can replicate Pantheon’s environment locally, making it easier to test and develop.

  • Pantheon Terminus integrates into Lando for smooth syncing of files and databases.

  • Multidev allows you to work on different features in isolation, syncing easily with your local environment.

Would you like this as a downloadable file or need help with specific Lando configurations for your project?

Tags