Here is my basic approach to spinning up a new Drupal site for development or testing. At the time I am writing this, the current version of Drupal is 9.3.5. This assumes that ddev and Docker are installed and that one is working in a ddev container using mostly the command line interface (CLI).

  • Create a new directory in /Users/username/Sites: mkdir <project_name> and cd into <project_name>
  • Configure ddev for Drupal9 site: $ ddev config --project-type=drupal9 --docroot=web --create-docroot --mariadb-version="" --mysql-version="8.0"
  • Start the ddev container: $ ddev start
  • Use Composer to install Drupal:  $ ddev composer create “drupal/recommended-project:^9.3.0”
  • Add the modules that I am sure I will use:
    • $ ddev composer require “drupal/ctools:^3.7”
    • $ ddev composer require “drupal/pathauto:^1.9”
    • $ ddev composer require “drupal/token:^1.10”
    • $ ddev composer require “drupal/backup_migrate:^5.0”
    • $ ddev composer require “drupal/admin_toolbar:^3.1”
    • $ ddev composer require “drupal/module_filter:^3.2”
    • $ ddev composer require 'drupal/libraries:^3.0@beta'
    • (Can do the ddev composer require statement with a series of arguments separated by a space.)
    • Conclude with $ ddev composer install
  • Install drush: $ ddev composer require “drush/drush”
  • Launch and configure db
    • $ ddev launch (this brings you to the Drupal install gui to set things like site name, email address, time zone, and the like.)
    • (or)
    • $ ddev drush uli
  • Clean up:
    • $ ddev drush updb
    • $ ddev drush cr
  • Modify settings:
    • For tmp: create tmp directory in project root (not web root) and set path in settings.php to $settings['file_temp_path'] = $app_root . '/../tmp';
    • For config/sync: create nested config/sync directory in project root (not web root) and set path in settings.php to $settings['config_sync_directory'] = $app_root .'/../config/sync';
    • For private create private directory in project root (not web root) and set path in settings.php to $settings['file_private_path'] = $app_root . '/../private';
Code_topic