Posting Drush Site Audits to Slack with Quicksilver

Developers make mistakes.

In fact, for some—that’s entirely the name of the game. Find errors, squash bugs, deploy, rinse, repeat.

The reason why developers are great at fixing those mistakes is because they are usually readily visible, apparent even to the untrained eye. Visual errors you find as soon as the page loads. Functional errors you find through experiencing the website first hand. But the most elusive? Performance—until it’s too late.

But deploy in the dark no longer!

Drupal Site Health

The kinds of mistakes we’re going to talk about today are process mistakes. Pantheon has some great tools that are readily available for anyone who knows how to look for them.

The site health page on the dashboard is one of the most useful Pantheon offers out of box. The difficulty there is: how often do you login and look at it?

Answer: Not often. At least not if you’re deploying using terminus. Who needs the well-designed user interface of a website? Not I! Multicolored serif font on a dark background, please.

So, what can you do in order to expose that dashboard to your team? How can you ensure that what gets pushed to production, is performance optimized and you didn’t stub your toe on deployment?

Enter: The Quicksilver Post Site Audit to Slack

If you’re a fan of both Quicksilver and Slack like I am, you’ve probably already spent some time automating your workflows on Pantheon. Making sure your team and clients get timely messages on deployments and progress has been made fairly painless with Slack, so why not add more solutions there?

Set it up in 1,2,3 Copypasta!

These steps assume you have already set up Quicksilver Slack notifications before and your secret key is already stored for this site. If you have not done so, check the Quicksilver examples for more information.

  1. Copy the slack_notify_drush_site_audit.php into your /private/scripts folder.

  2. Make any absolutely necessary changes such as:

    1. The Slack #channel you’d like to post to (#quicksilver is the default), and

    2. Personalizing the emoji you want to display in the slack message (:helmet_with_white_cross: is the default).

  3. Update your /pantheon.yml such that the slack_notify_drush_site_audit.php fires post-deploy.

# Code Deploys: Notify, and notify completion



     - type: webphp

       description: Post Environment Status to Slack after each deploy

       script: private/scripts/env_status_to_slack_after_deploy.php

  1. Git commit and push!

Don’t forget that the script won’t fire until after it has already been pushed to that environment. It won’t show up on the first try, but soon thereafter you’ll be seeing your site report!

Partial of Full Report

With your scripts deployed, you can now set about properly responding to teammates when they’ve fudged the performance settings. Because the only thing more satisfying than not having performance issues, is the perfect use of an emoji when it all goes south.


Topics Development, Drupal

Let’s get in touch