Using DDEV or Lando for local Drupal sitesfor Drupal 8 , 9 , 10 , and 11

Last updated :  

Introduction

As you advance in your Drupal journey, developing your site locally becomes essential. Local development environments offer a sandbox to experiment with features, troubleshoot, and make changes without affecting the live site. Two popular tools that streamline this process are DDEV and Lando. In this lesson, we'll explore how to set up these tools, configure them for Drupal, and manage your local site effectively.

Why Use DDEV or Lando?

Both DDEV and Lando are Docker-based, enabling consistent, containerized environments across different systems. This reduces the "it works on my machine" problem by providing a uniform setup that's isolated from your local system. These tools manage the complexities of server configuration, allowing you to focus on development.

Prerequisites

Before setting up DDEV or Lando, ensure you have the following:

  • Docker installed and running on your system.
  • Basic knowledge of command-line operations.
  • Previously completed Drupal installation steps.

Getting Started with DDEV

Installing DDEV

To get started with DDEV:

  1. Visit the DDEV installation guide for OS-specific instructions.
  2. Once installed, verify your setup by running:
  3. ddev --version

Setting Up a New Drupal Project with DDEV

  1. Navigate to your Drupal project directory:
  2. cd /path/to/your/drupal-project
  3. Initialize DDEV:
  4. ddev config
  5. Follow the prompts to configure your project. Choose drupal10 as the project type when prompted.
  6. Start your environment:
  7. ddev start
  8. Access your site at http://<projectname>.ddev.site.

Getting Started with Lando

Installing Lando

To install Lando:

  1. Follow the instructions from the official Lando installation page.
  2. Verify your installation using:
  3. lando version

Setting Up a New Drupal Project with Lando

  1. Navigate to your Drupal project folder:
  2. cd /path/to/your/drupal-project
  3. Initialize Lando with the appropriate recipe:
  4. lando init --recipe drupal10 --webroot web --name my-drupal-app
  5. Start your Lando environment:
  6. lando start
  7. Access your site via the URL provided by Lando, typically http://my-drupal-app.lndo.site.

Common Features

Both DDEV and Lando provide several features to streamline development:

  • Database Management: CLI access and interfaces like Adminer.
  • Custom Commands: Automate tasks using ddev exec or lando exec.
  • Logging and Debugging: Access logs and debugging tools directly from the command line.

Benefits and Considerations

While both DDEV and Lando facilitate seamless Drupal development, consider the following when choosing:

  • Community and Support: DDEV and Lando both have active communities. Evaluate which aligns more with your needs.
  • Integration with Tools: Check compatibility with other tools you may use, such as Composer.

Troubleshooting Tips

Common issues might include:

  • Docker Compatibility: Ensure Docker is properly installed and running.
  • Configuration Errors: Review configuration files for typos or incorrect settings.

Conclusion

Setting up local development environments with DDEV or Lando significantly enhances your Drupal development workflow by providing a reliable, repeatable setup. Whether you choose DDEV for precise control or Lando for flexibility, both offer excellent platforms for local Drupal development.

Next Lesson Preview: Setting Site Name, Email, and Timezone

In the next lesson, we will refine your site configuration by setting the site name, email, and timezone—key elements that personalize your Drupal installation and ensure proper site operation. Stay tuned to learn how these settings impact your site's functionality and user experience!