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

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.

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.

Poll

Add comment

Comments

If you replace post-code-deploy with post-code-update in the blog above then your scripts will run after a git push (rather than after a code deploy which is something you have to trigger from the web interface). This allows you to, have the dev environment track a branch (e.g. master) and it will run the script every time code is pushed into master.