The more you automate your software configuration tasks, the more time you save. Here’s how we used Hubot, a “virtual user” add on for HipChat and Slack, to deploy software (and more!) with ease.

In our work, we always favor automation over manual work especially for repeatable tasks - time is always money and manual tasks mean added time, after all! Easy to configure, automated solutions, via bots such as Hubot, can be found for all sorts of tasks and you can execute them from your preferred team messaging platform, like Slack.

The project, we take a look at today, required our developers to deploy a client’s application and create database backups without direct access to the production servers. Unfortunately, due to the configuration, we weren’t able to hook into an external CI server that could do it for us - which is a preferable solution in such a scenario. Plus, the deployment process was much more complex than just a simple git push command! To do all this manually was a bit of a pain, and was taking up time better spent on other tasks.

So how’d we do it? By writing scripts for performing all the necessary work through available APIs - like the interface for deploying the web app and workers, and getting database dumps - all of which was executed via Hubot.

What is Hubot?

In the words of GitHub, Hubot is a customizable, life embetterment robot. Which of course, sounds like your ideal friend for any situation! In a more succinct sense, he’s a “virtual user” (or bot), sitting in your Slack or HipChat rooms, waiting to respond to your questions, commands, or participate in conversation. This bot listens for messages that are published in the room and, if he can understand them, jumps in and responds in an automated way.

What Hubot can be used for:

He can be used to do various tasks like:

  • Posting images
  • Translating languages
  • Creating Hangouts for meetings
  • Creating polls
  • Sending notifications whenever a document in your docs repository (i.e. Confluence) is updated
  • And much more! You can check out the hubot-scripts page for loads more examples

How we use Hubot for automation

Our infrastructure for the project contains 2 parts:

  • A custom script to add new functionality to Hubot, to understand our commands and process them,
  • A server with an ssh-command wrapper for running these commands inside screen sessions.


Slack integration

We had to add a custom script for Hubot to be able to run our custom commands such as:

  • db-dump - to create a full database backup
  • db-delta-dump - to create a delta dump based on latest full dump (more on that later!)
  • deploy <production, staging> <all, app, workers> - to deploy a given variant (app or worker) to a specific environment (staging or production)
  • help - to print all available commands with their description

We register each command with our custom script, which basically sends the specified command to our dedicated server. Because all these commands run asynchronously, they need to be run in a screen session - to ensure even when network connections are interrupted, we can continue where we left off upon reconnect to the server. When each command is finished (either with success or failure), the server sends a notification to our Slack room. For the deploy command, users can also check the progress via the browser - where the script’s output is shown.

Server for performing jobs

The server we mentioned above is a small VPC instance, which allows for an SSH connection from hubot with a specialized ssh-command wrapper (SSH forced command approach). This wrapper ensures there are only a few commands available to the user, and runs the appropriate script for each of the commands. Hubot does not provide direct instructions of how to perform each command - he just passes messages to dedicated scripts to do the work.


Using custom Hubot commands for this project allowed us to automate as much work as possible, leaving developers to do their work instead of interrupting the flow by continuously configuring deployment on their own.

Are people in your business performing manual software configuration tasks over and over again? Is deployment tedious? At iRonin, we are experts in helping to automate processes to save your team more time - time best spent on other tasks. Reach out to us for more information on how we can help with your business automation.