Add new comment

Automate tests and more with Acquia Cloud Hooks

Acquia Dev Cloud is the Drupal cloud hosting platform for developers, and today I'm really psyched to announce availability of a frequently requested developer feature: Acquia Cloud Hooks. Of course, since Dev Cloud and Managed Cloud run on the same technology, Cloud Hooks are fully supported on Managed Cloud as well.

If you'd rather try Cloud Hooks instead of reading about them, you can sign up right now and use coupon code BJB111209 to get the first 30 days free.

What are Cloud Hooks?

In my previous post about the Acquia Cloud Workflow UI, I explained how Acquia Cloud automates the most common tasks involved in managing a Drupal site: deploying code from a version control system, and migrating code, databases, and files across your Development, Staging, and Production environments.

Cloud Hooks go much farther by allowing you to automate almost anything else as part of your Workflow actions. A Cloud Hook is a script in your code repository that Acquia Cloud executes on your behalf when a triggering action occurs. Examples of tasks that you can automate with Cloud Hooks include:

  • Perform Drupal database updates, run a test suite, or run a performance/load test each time new code is deployed.
  • "Scrub" your Production database when it is copied to Dev or Staging by removing customer emails or disabling production-only modules.
  • Supposing your site copies its user-uploaded files in S3, you can synchronize your S3 buckets each time you copy files between your Dev, Staging, or Production environments.

A quick example

Cloud Hook scripts are simple and can be written in shell, PHP, Perl, Ruby, or even C if you want to compile it yourself. Here's an example that runs "drush updatedb" (the equivalent of running database updates via update.php):

#!/bin/sh
#
# Cloud Hook: update-db
#
# Run drush updatedb in the target environment. This script works as
# any Cloud hook.

site="$1"
target_env="$2"

drush @$site.$target_env updatedb --yes

Drop this script into /hooks/common/post-code-deploy/update-db.sh and it will run every time you deploy a new code branch or tag from Git or SVN to any of your environments. If you only want it to run when you deploy new code to your Production environment, put it in /hooks/prod/post-code-deploy/update-db.sh instead.

Get started and contribute

Getting started instructions, complete documentation, hook templates, and sample scripts are available at https://github.com/acquia/cloud-hooks.

We know that our users will think of more creative uses for Cloud Hooks than we will (in fact, the idea for the S3-syncing script came from our friends at musescore.com). We encourage you develop and share your own Cloud Hook scripts. You can fork the GitHub repo and submit pull requests for scripts that you want to contribute. We can wait to see what you come up with!

Remember, you can sign up for Dev Cloud right now and use coupon code BJB111209 to get a Developer subscription with a 1 ECU/10 GB server free for the first 30 days.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Filtered HTML

  • Use [acphone_sales], [acphone_sales_text], [acphone_support], [acphone_international], [acphone_devcloud], [acphone_extra1] and [acphone_extra2] as placeholders for Acquia phone numbers. Add class "acquia-phones-link" to wrapper element to make number a link.
  • To post pieces of code, surround them with <code>...</code> tags. For PHP code, you can use <?php ... ?>, which will also colour it based on syntax.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <h4> <h5> <h2> <img>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.