DEV Community

David Loor
David Loor

Posted on • Originally published at davidloor.com on

Setting Up a Drupal 9 Multisite Locally with DDEV: Hosted on Acquia with Acquia Pipelines

Drupal 10

In my current job, the team that I lead is providing support to three websites of a large private organization. The three websites are hosted on Acquia. The websites are part of a multisite setup and the source code is managed using the Acquia Pipelines service.

In a nutshell, Acquia Pipelines is a continuous integration and deployment service provided by Acquia, a cloud-based platform that provides enterprise-level hosting, support, and management for Drupal websites.

What is DDEV?

DDEV is a command-line tool that helps developers set up local development environments quickly and easily. It is designed to simplify the process of setting up a local web server, managing dependencies, and configuring development environments. If this is the first time that you are trying to work with DDEV, please make sure that you check this post to get started with DDEV.

What is a Drupal multisite?

Drupal multisite is a feature that allows multiple websites to be managed using a single Drupal codebase and database. In a Drupal multisite setup, multiple websites share a single Drupal installation, which can reduce maintenance time and costs.

Each website in a Drupal multisite configuration has its own unique domain or subdomain and can have its own theme, modules, content, and configurations. However, they share the same core codebase and database.

Drupal multisite is useful when you need to manage multiple websites that share a similar codebase, theme, or functionality, such as a network of related websites, or multiple language versions of a website. It can simplify website maintenance, reduce costs, and improve consistency across websites.

The recipe to setup the local multisite

  1. You need to set up the project using DDEV. Check this post out to get started.
    • The docroot location from where the site is served should be web/docroot. You will be asked a question about the docroot location when running the command ddev config
  2. In the .ddev folder, create a file name config.multisite.yaml
  3. The file config.multisite.yaml should have the following content:
additional_hostnames:
  - site1
  - site2
  - site3
Enter fullscreen mode Exit fullscreen mode
  1. Update the sites.php file to add the three local domains and their corresponding folders.

The sites.php file is a configuration file that allows you to map domain names or URLs to specific Drupal site directories.

$sites['site1.ddev.site'] = 'site1_directory';
$sites['site2.ddev.site'] = 'site2_directory';
$sites['site3.ddev.site'] = 'site3_directory';
Enter fullscreen mode Exit fullscreen mode
  1. Create three databases using PHPMyAdmin. If the name of the DDEV project were mysite , you can access phpmyadmin at https://mysite.ddev.site:8037/
  2. Export database backups from acquia and import them into the corresponding databases that you created as part of step 4.
    • If the databases are big, you can use a ddev command to import them: ddev import-db --target-db=DATABASE_NAME --src=.tarballs/DB-BACKUP_FILE.sql.gz
  3. In the directory of each file, you need to add this ddev file.
  4. The settings.php file of each site needs to be updated to include the code from this file.
  5. Run ddev ssh and after that composer install
    • the ddev ssh command allows you to access the command line interface (CLI) of a running ddev web container, so you can run composer, drush and other commands from inside the web container.

Top comments (0)