Drupal 8 Development & Deployment : a step by step guide

 
23 Mar 2018

We recently finished working for a digital agency without in-house Drupal expertise working on their first Drupal project. We delivered a really cool website built really well with a great content editor experience.

I always recommend handling deployments using a CI tool (Continuous Integration) to automate things as it is more reliable as reduced human error due to automation. It’s also faster to deploy, and in case of any issues quicker to rollback. I recommend tools include Jenkins CI, GitLab CI or using Drupal cloud hosting companies that have their own CI built into their product such as amazee.io (my preference whenever I host a Drupal website).

They have deployed onto their client’s hosting infrastructure which is not currently setup for auto-deployments which is a shame, but it will be fixed as soon as the Technical Director gets a chance. As a result they needed a step by step guide on what to do while we're no longer supporting them.

Although many of the steps can be automated in many different ways, and are recommended, they should always do this.

Development (if Production database config was changed directly)

Firstly this shouldn’t be done and is not recommended as it can cause differences between configuration during deployment and therefore issues.

For extra peace of mind, I recommend installing https://www.drupal.org/project/config_readonly to avoid this

  • Get a DB dump from Live and restore it to your local development site
  • Export configuration : drush cex -y
  • Git commit, git push
  • Continue to the section below `Development`

Development

  1. Git pull
  2. Composer install (in case other developers made changes)
  3. Apply database updates : drush updb
  4. Import configuration (in case other developers made changes) : drush cim -y
  5. Clear caches : drush cr
  6. Start work
  7. Finish work
  8. Export configuration : drush cex -y
  9. Git commit, git push

Deployment to Staging

I’ve replaced the Drush commands with things that can be done by a non-developer through the UI if logged in as a user with the Administrator role

  • Get a DB dump from Live and restore it to the Staging site
  • Deploy the latest code
  • Apply database updates : go to /update.php
  • Import configuration : /admin/config/development/configuration, review all changes make sense/are expected, then click `Import All`
  • Check that all new expected functionality has now been deployed
  • Clear caches : /admin/config/development/performance, then click `Clear All Caches`
  • Test to see what logged out users see

Deployment to Live

I’ve replaced the drush commands with things that can be done by a non-developer through the UI if logged in as a user with the Administrator role

  • Deploy the latest code
  • Apply database updates : go to /update.php
  • Import configuration : /admin/config/development/configuration, review all changes make sense/are expected, then click `Import All`
  • Check that all new expected functionality has now been deployed
  • Clear caches : /admin/config/development/performance, then click `Clear All Caches`
  • Test to see what logged out users see