Express Drupal Setup with Acquia DevDesktop. Dev Environment setup in 15 minutes

Dev Desktop

Objective

In this document we will demonstrate a shortcut Drupal Website and local development environment setup using Acquia’s Dev Desktop. Following this setup can save a considerable amount of time and get us up and running in about fifteen to twenty minutes.

In this document we will install and setup a Drupal website from Acquia's cloud hosting and from a downloaded folder to demonstrate setup for two most common scenarios.

Checklist

Download and install Dev Desktop and follow onscreen instruction to complete the setup process. Integrate Dev Desktop with Acquia Cloud (for installing a website from Acquia cloud only) by adding required information (username, password, Public Key) on Settings >> General. More help in this step could be found at Acquia's Documentation.

  • Protip: Minimum Senior Developer credentials are required to pull from Acquia Cloud.

  • Protip: To set up from a downloaded folder, grab database file. (unless new setup)

Install Site using Dev Desktop

From Acquia cloud

To setup a remote site from Acquia Cloud, first click “generate cloud sites” button, this is more or less equivalent to generating Drush Aliases, it will also organize all your cloud sites on Dev Desktop along with their links without actually downloading them.

DevDesktop Layout
Everything at one place dev-desktop layout
  1. Pick the website and it’s Environment you wish to install locally. Left Red circle

  2. Click on the Button “Clone this site locally….”. Right Red circle

Cloning from cloud
Cloning cloud site with Dev Desktop
  1. Pick Site Name, Database Name etc. and Press ok.. Local site setup is complete at this stage.

From local code folder

  1. Click the + button seen in the first diagram and select “Import Local Site” next
Importing local site
Importing local site with Dev Desktop
  1. provide code folder, pick name and DB (new for a new site, select for existing)
  2. Drupal setup will begin, follow onscreen instructions and Local site setup should be done at this point.

Result

Dev desktop features
Dev Desktop important features
  • The left green circle indicates the white folder icon next to prod, this means we have this site locally installed. To visit click the link inside green circle on the right hand side. Local codebase folder shall open by clicking the link inside blue circle, PHPmyAdmin by clicking link inside red circle and lastly even a handy shortcut for opening terminal at the file location could also be seen inside the yellow circle.
  • Local site setup is complete, follow steps below to create a development Environment.

Configuring local development settings

At this stage, doing git status, produces following result:

Git diff
running git status at this point

Following processes below will make git diff disappear as well as create a proper debug and suggestions enabled Dev. Environment.

  • docroot/sites/sites.php is created by Dev Desktop, however upon inspecting this contains only comments. Therefore it’s safe to delete this file.
  • docroot/sites/default/settings.php appears to have a few changes made during the process. See screenshot below:
Settings File Diff
Dev Desktop Settings file changes
In the above diagram L#810 to L#817 is what dev desktop changed during installation. Save these in a safe spot and remove from this file.

Next Changes below are part of typical Dev Setup Copied below for convenience.

A. settings.local.php

  • In the settings.php, find the lines that refer to settings.local.php and uncomment them.
/**
* Load local development override configuration, if available.
*
* Use settings.local.php to override variables on secondary (staging,
* development, etc) installations of this site. Typically used to disable
* caching, JavaScript/CSS compression, re-routing of outgoing emails, and
* other things that should not happen on development and testing sites.
*
* Keep this code block at the end of this file to take full effect.
*/
if (file_exists(__DIR__ . '/settings.local.php')) {
 include __DIR__ . '/settings.local.php';
}
  • Copy docroot/sites/example.settings.local.php to docroot/sites/default/settings.local.php and open the file to modify it. Under the comment Enable local development services add some lines:
/**
* Enable local development services.
*/
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
  • Add New Lines
// THE NEW LINES ARE BELOW
if (file_exists(__DIR__ . '/services.local.yml')) {
 $settings['container_yamls'][] = __DIR__ . '/services.local.yml';
}
// NEW LINES FINISH

Review the other features of the settings.local.php file. Your life will be easier when $settings['skip_permissions_hardening'] = TRUE;

B. Customize services.local.yml

  • This file is included only on your local development environment, and since it is included after docroot/sites/default/services.yml, you can override values and avoid changing them in the shared file.
parameters:
 twig.config:
   debug: true
   cache: false
  • Remember the lines Saved in the second step, L#810 to L#817 from the file docroot/sites/default/settings.php above, place them at the end of docroot/sites/default/settings.local.php.
  • At this point git status would indicate no changes.

Fixing Head and Remote Uplink

One last remaining Side Effect of taking the shortcut is that we might loose our remote uplink during this process. Also our repository is most likely in hosted over in GitHub. This could be seen by running command git remote -v and git status Remote Uplink fix

Detached Head fix
Remote Uplink & Head

  • In case it’s a brand new project than git init and then create the repository on Github first and then follow along to link it to your repository.
  • For Existing project hosted on GitHub, uplink head to your remote repository by running following command.
git remote set-url origin [email protected]:myCompany/myProject.git
git checkout develop
git pull

Pro Tip: Clicking terminal icon inside Dev Desktop will open terminal inside docroot of your project. Remember to cd .. to get back to ROOT.