Talking Drupal #116 - Deploying Drupal

March 23, 2016

In episode #116 we discuss automating the deployment process with Rob Aubin.





  • Deployment process
  • Dev - Staging - Traing - Production
  • Using GIT
  • Strategy for deployment
  • Why automation
  • Automation risks
  • Jenkins and other tools


Module of the Week: 

Smart IP

Smart IP identify visitor's geographical location (longitude/latitude), country, region, city and postal code based on the IP address of the user. These information will be stored at session variable ($_SESSION) with array key 'smart_ip' and Drupal $user->data object with array key 'geoip_location' of the user but optionally it can be disabled (by role) at Smart IP admin page. Other modules can use the function smart_ip_get_location($ip_address) that returns an array containing the visitor's ISO 3166 2-character country code, longitude, latitude, region (FIPS), city and postal code. It provides a feature for you to perform your own IP lookup and admin spoofing of an arbitrary IP for testing purposes.



Good show, but there was some stuff missed when you got off onto the rabbit trail about just doing a git pull from the server. Jenkins just checks out the code and gets it to the server; you need something else to actually get the code where you want it. Before switching to Acquia hosting, we used Jenkins for deployment, and we used Phing (Jenkins has a plugin) for moving the code to the correct place, creating symlinks, creating the settings.php file with the appropriate values, etc. I would use a build.xml file on the server (and not in my repo, since it had db connection info) that had all the values and steps, and the plugin would look for it and use it to get the code deployment all pretty. The step were basically:

1) Copy code from Jenkins directory to build directory
2) Copy default.settings.php to settings.php
3) Replace placeholders in settings.php with values from build.xml
4) Delete webroot symlink to previous build directory
5) Create webroot symlink to new build directory
6) Create symlink from sites/default/files to files directory (located outside the build directory)
7) Run drush cc

Before using this setup, I had tried just using git pull from the prod server, and it was a nightmare, because of things like merge conflicts that had to be resolved, and other issues. This makes it so much easier, because you're basically just creating an entirely new copy of your code instead of modifying an existing code copy. In addition, if you deploy and run into problems, you can also roll back to a previous working deployment very quickly.

Back when I did the Acquia podcast, I did an episode with Steven Merrill (now with Phase2) on using Hudson (now Jenkins), and he was an absolute guru with it (I would put in the link to it, but for some reason it's not available on the Acquia site any more). He would have it running Drupal tests and then posting updates into IRC and email if something failed, among other integrations. It was a very useful tool.

Thanks for the feedback, Steve! It's always great to hear about other people's experiences with these tools. There's so many different ways that Jenkins can be used in a team's workflow and while we've been using it for quite some time, I often feel like we're just getting started with the ways we can leverage automation.

I agree, there can be processes that need to be adjusted based on where sites are hosted and we have a few different flavors of deployment workflows that we use in different situations.

Thanks for your feedback, especially on using Git as a deployment tool. While I haven't tried it myself, I can imagine that merge conflicts and issues like it could introduce some risk into a deployment workflow.

Steve - thanks for this additional, valuable, information. 

I tried DeployBot ( and had success.    I was able to automate deployments to  Digitial Ocean servers in a few hours.   Recommend. 

Add new comment