victoria web design information architecture (IA)

Research

victoria web design

Design

Drupal CMS Web Development

Develop

victoria website Maintenance

Launch

How to use DDEV to install a Drupal 10 site locally

DDEV, an open-source tool built on Docker, simplifies the creation and management of local development environments, especially for web developers using popular CMS platforms like WordPress, Drupal, and others. While Docker is a powerful platform for containerizing applications, DDEV abstracts its complexities, offering a more user-friendly interface tailored for web development.

How does DDEV relate to Docker?

DDEV stands for Docker Development Environments. It leverages Docker to provide isolated, consistent, and pre-configured environments, making it easier for developers to get started quickly. Unlike Docker, which requires manual setup of container configurations, DDEV automates this process, allowing developers to focus on coding rather than managing their environment. It's useful in its ability to streamline and standardize local development environments with plenty of customization features to match your live site. You can specify versions of MySQL, MariaDB, PHP, and Drupal along with a host of other parameters.

How to Set Up a Drupal Local Server with DDEV and Orbstack

In this example, I'll be sharing some steps on how to use ddev for Drupal, along with Orbstack (a the fast, light, and easy way to run Docker containers and Linux. See their website for more details.) You can use this to start a Drupal site from scratch, or to copy an existing one from a live server.

This article assumes you have Docker, Orbstack and DDEV installed already. Fire up your Terminal and let's get started:

Make sure ddev is up to date:

brew upgrade ddev/ddev/ddev

Start Orbstack and set up the project files

mkdir my-site-name;
cd my-site-name

Configure DDEV for Drupal

ddev config --project-type=drupal10 --create-docroot --docroot web

(Optional) Modify DDEV Configuration to your liking by editing .ddev/config.yaml, to specify MySQL, set the upload directories, etc. (Leave the type as drupal. Don't set it to php):

database:
  type: mysql
  version: "8.0"
upload_dirs: 
  ["sites/default/files", "../private"]

Start DDEV

ddev start

Download Drupal Core

ddev composer create drupal/recommended-project:\^10 -y

Install Drush

ddev composer require --dev drush/drush

(Optional) Set the db prefix and the Private File Path in web/sites/default/settings.php. Around line 93 find

$databases = [];

and replace with your specifics:

 

$databases['default']['default'] = [
  'prefix' => 'myprefix_',
];
// Set the private file path 
$settings['file_private_path'] = '../private';

Save and close settings.php.

Install Drupal Using Drush

ddev drush site:install --account-name=youradminuser --account-pass=youradminpass -y

(Optional) Install phpMyAdmin

ddev get ddev/ddev-phpmyadmin

Restart DDEV and View URLs

ddev restart;
ddev describe

Take a Snapshot

ddev snapshot

Enjoy.