By: Hashik
May 24 2018

Setting up a Drupal 8 Site on DDEV

Handling multiple projects on multiple platforms with multiple technologies and hosting them can turn out to be tedious. DDEV lets you concentrate on the development of the project rather than worrying and wasting time on the deployment of the project. The best thing is it is open source and so is licensing. DDEV supposedly makes setting up and running PHP development environment easy, that is just what Drud, the parent company of DDEV says, so is it true?

I will let you be the judge of the verdict.

Things you need before you start

Given that DDEV runs on Docker it’s no surprise that you need Docker.

  • Git is a must if you download manually.
  • Composer is also optional. 
  • And you might need an internet connection, obviously. 

Downloading and Installing Docker

  • Go to Docker site and download the installation file. Keep note that the installation file is subjective to your operating system. Since I am running Windows I am going to download Docker for Windows, it redirected me to Docker store. Wait for the download to finish. 
     
  • Run the Docker installation and let it finish, it asks for you to log out of the Windows to complete the installation.
     
  • Docker runs in the background when you open it.
    downloading ddev binary
    Downloading DDEV binary

     

  • There are a couple of ways in which you can download the Ddev binary.
     
  • The first one is to use the shell script you can do this by using the following command.
curl https://raw.githubusercontent.com/drud/ddev/master/install_ddev.sh | bash
  • The second is doing it manually, we’ll do it manually in Windows.
     
  • Go to this site to download the latest release of the Ddev binary. The version number may vary depending upon the time you are accessing the download site.
    downloading the latest release

For Window:

  • I am downloading Windows installer and run the executable file and finish the installation.
  • Now run the ddev in the command prompt or shell to test the installation.

For Linux or Mac:

  • Download and extract them and move ddev to /usr/local/bin using the command 
    mv ddev /usr/local/bin/ (it may need super user permission).
  • Run ddev in the terminal to test your installation.

Configuring DDEV in our Project 

  • To demonstrate the configuring process, I will be taking a demo Drupal 8 project. Run the command ddev list, you can see that there are no running ddev projects.
     
  • Use Git to clone the repository of the project in which you have to set up DDEV. 
    git clone <repository name here> 
     
  • Wait for Git to clone the repository, remember you could just use the original Drupal repository clone to test or configure ddev.
     
  • Use cd to move into the cloned directory.
    cd <Repository name/ Drupal project name> 
     
  • You need to create a configuration of ddev in the project to do so use the following command. Remember that you have to be in the project directory to create a configuration of the ddev file.
     
  • ddev config
    It will ask you for project name you want to create the configuration for by default it gives you the current project you have navigated to, so just press enter.
     
  • Now, it asks for the root directory since you have already navigated to the directory or the root directory just press enter, you can change it if you wish to.
     
  • It asks for the type of project you are working on type drupal8 and press enter.
    ddev config root directory
     
  • Now, you are done. You can run the ddev by typing.
     
  • ddev start
    (You might need superuser/administrator permission)

    While for the first time it might take some time since to set up a couple of containers for Ngnix servers, MariaDB, so, be patient. Docker may prompt asking permission for the drive, give the permission and give the password for your file system, the password is a must according to a closed question on their GitHub repository.

    Here, you are good to go, you must be prompted with successfully started <Your project name> and you will be given a local URL where you can access your site.

ddev config root directory

Now, you can use ddev to describe to see the passwords, usernames, ports etc of your project.

I would say, this is fast but hey, let yourself be the judge. If you want to start the second site you can set it up in just a few minutes. It’s easy. Setting up for Drupal 7 is pretty much the same. Good luck cutting the time for deployment of the project with ddev.

Hashik is an enthusiastic coder and a self-learner. Other than coding he is a crazy basketball lover and would love to play than watch others play on TV. He’s fond of Late Night Shows and a big fan of FRIENDS and Breaking Bad. He loves to teach and yet the irony, he’s an awful teacher