Using Slack to deploy code to production. Yes really.

Mikhail Simin
Nextdoor Engineering
2 min readAug 2, 2016

--

Our original release process was crude:

  • SSH into the machine. Yes, we had only one.
  • git pull
  • Restart Apache.

For a private-beta company with 5 employees this technique satisfied all the needs. Since then, Nextdoor’s release process has matured, and the requirements of the release process have changed.

Our long-term goal is to enter a world of Continuous Deployment (CD), where every commit will trigger a production release. Prior to achieving that goal we still have room for improvements in our current process, which is time consuming and involves manually entering critical values.

Quick wins, FTW!

Manual work is prone to errors, takes up time, and relies on some internal knowledge. We want the exact opposite. A production release should be error-free, quick, and simple!

Our team has discussed various automation approaches. One solution sounded crazy, and crazy appealing. We’ve decided to leverage ChatOps — a term coined by GitHub. Using Slack for automation allowed for several quick wins for the release process:

  • A way for others to learn by example.
  • Slack’s Message Buttons leave no room for errors or typos.
  • We get mobile friendliness for free.

The build and deploy process are both done from Slack. My coworker Steve demonstrates:

Mr.Rogers is our neighborly bot powered by Alphabot.

The build command is initiated through a message in Slack. When the build is finished the release is offered as a button rather than requiring a new command. This ensures that there is no room for typos.

A few minutes later he decides to press it :)

The original buttons are removed, and replaced with a confirmation.

This is a quick win for our team, and it does not require much code.

The Setup

Our build infrastructure is run by Jenkins. Jenkins jobs can be triggered by web hooks such as from git commits, via direct API calls, or in our case - a chat button. The following, trivialized, Alphabot code provides the build command and the release Slack button. Alphabot is Nextdoor’s open-source bot for interacting with Slack. It’s written in python and uses Tornado for coroutine executions:

One key piece of infrastructure that is abstracted from this code is that Slack requires the bot to be associated with a Slack App for this to work. The app is then configured with a URL which can receive a Slack payload for Alphabot. Slack has extensive documentation on this.

We’re constantly working on improving our release process. We welcome comments and questions on how you can do this at your company, or what else could benefit from ChatOps automation.

--

--