lowkey.digital

Environment Setup with DDEV

Setting Up Your Development Environment

DDEV Configuration

DDEV provides a containerized environment that abstracts away the complexity of local development. Let’s configure it for optimal Drupal 11 performance.

# .ddev/config.yaml
name: drupal-entertainment
type: drupal10
docroot: web
php_version: '8.4'
webserver_type: nginx-fpm
xdebug_enabled: false
additional_hostnames: []
additional_fqdns: []
database:
  type: mariadb
  version: '10.11'
use_dns_when_possible: true
composer_version: '2'
web_environment: []
corepack_enable: false

Reality Check: While DDEV defaults are generally solid, the PHP memory limit might need adjustment for Drupal’s composer operations. We’ll address this shortly.

Initial Setup Commands

# Create project directory and initialize DDEV
mkdir drupal-entertainment
cd drupal-entertainment
ddev config --project-type=drupal10 --docroot=web

# Increase PHP memory limit for Composer
ddev config --php-version=8.4

# Start DDEV
ddev start

Drupal 11 Installation

With our environment configured, let’s install Drupal 11 using Composer.

# Inside your project directory
ddev composer create "drupal/recommended-project:^11.0.0" --no-install
ddev composer require drush/drush --no-install
ddev composer install

War Story: “Once spent two hours debugging a composer memory error only to realize I needed to increase PHP memory limit. Now it’s the first thing I check.” - Mike, DevOps Engineer

Post-Installation Configuration

# Install Drupal using Drush
ddev drush site:install --account-name=admin --account-pass=admin --site-name="Entertainment Platform"

# Install and enable development modules
ddev composer require drupal/devel
ddev drush en devel devel_generate -y

# Set development settings
ddev drush config:set system.performance css.preprocess 0 -y
ddev drush config:set system.performance js.preprocess 0 -y

Debugging Setup

Let’s configure Xdebug for those inevitable debugging sessions:

# Turn on Xdebug
ddev xdebug on

# If needed, turn it off.
ddev xdebug off

Common Issues and Solutions

  1. White Screen of Death

    # Check PHP logs
    ddev logs -s web
    
    # Clear cache
    ddev drush cr
  2. Composer Memory Issues

    # Temporary memory increase
    ddev exec php -d memory_limit=-1 /usr/local/bin/composer require drupal/module_name

You’re Not Alone: Seeing the “Composer killed” message? Welcome to the club. It’s practically a Drupal developer initiation ritual.

Verification Steps

  1. Access your site at https://drupal-entertainment.ddev.site
  2. Verify database connection: ddev drush status
  3. Check PHP configuration: ddev php -i | grep memory_limit

Next up: Creating content types for our entertainment platform. But first, make sure you can access your site and Drush is working correctly.