About two years ago, the team at Heroku announced the creation of a button that would simplify the app deployment process. The Heroku Button allows you deploy an app without ever leaving the browser.
Instead of having to use the command line to both create a git repository and push the code to Heroku, you can instead just click the Heroku button. After being taken to a deployment page and filling out the necessary configuration variables, you can have a brand new app up and running within seconds! Heroku claims that this button will “obviate reams of README on public repos describing how to configure apps to run on Heroku.”
Case Study: Tweet from Slack App
All of us at LaunchPad Lab have been really enjoying using Slack as a means of team communication — so much so that we decided to create an app that would allow us to post tweets to our LaunchPad Lab Twitter account from a Slack channel, as well. Enter Tweet from Slack!
Taking the app a step further, we decided Tweet from Slack would be a good candidate for integration with the Heroku button. It would be perfect for people to be able to deploy their own Tweet from Slack app and easily get to tweeting.
The only requirements for using the Heroku Button are:
- Valid app.json file. Heroku uses this file to figure out what add-ons, config, and other deployment steps are necessary to make the code run.
- Code is hosted in a GitHub repository. Support for both public and private repositories was added about a year ago.
The button can be added as a Markdown or HTML snippet to the repository’s README file. Check out ours below. In the URL, you can also specify which branch you would like Heroku to use when deploying by including a ‘template’ parameter. We used this option a lot during testing.
We ran into a few complications along the way when trying to integrate the Heroku Button with the Tweet from Slack app. The fact that the app uses Twitter OAuth presented a problem because we needed a way to save security tokens in a place other than as environment (a.k.a. config) variables. Heroku only allows the user to add these config variables during the initial app setup on the deployment page. However, we needed to save access tokens after the user authenticates their Twitter account through the app itself. We ended up using Memcachier as an add-on to cache these variables.
OAuth also added another layer of complexity to the app setup. The user needs to create their own app through Twitter in order to obtain a valid pair of Consumer Keys. In addition, the user needs to create their own Slack Outgoing Webhook integration. The Slack token and Twitter Consumer keys all need to be entered as config variables during the initial app setup. All in all, the README ended up being a bit more complicated than we would have liked.
All of these complications specific to the Tweet from Slack app aside, the Heroku Button still feels like a super easy way to deploy an app. It seems particularly suited for demo apps or sharing apps among your team, when you need a to get a working version of an app into a client’s or fellow developer’s hands quickly. We look forward to discovering new ways to integrate the button into our deployment process.