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:
- Visit the DDEV installation guide for OS-specific instructions.
- Once installed, verify your setup by running:
ddev --version
Setting Up a New Drupal Project with DDEV
- Navigate to your Drupal project directory:
- Initialize DDEV:
- Follow the prompts to configure your project. Choose
drupal10
as the project type when prompted. - Start your environment:
- Access your site at http://<projectname>.ddev.site.
cd /path/to/your/drupal-project
ddev config
ddev start
Getting Started with Lando
Installing Lando
To install Lando:
- Follow the instructions from the official Lando installation page.
- Verify your installation using:
lando version
Setting Up a New Drupal Project with Lando
- Navigate to your Drupal project folder:
- Initialize Lando with the appropriate recipe:
- Start your Lando environment:
- Access your site via the URL provided by Lando, typically http://my-drupal-app.lndo.site.
cd /path/to/your/drupal-project
lando init --recipe drupal10 --webroot web --name my-drupal-app
lando start
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
orlando 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!