I was sitting in Twilio’s new UK digs yesterday, and I thought to myself: wouldn’t it be great if you could administer your Heroku app by sending a text. Imagine you’re out on the town and you get a call from your boss, he’s mad because the website is down and you’re on the front page of Hacker News. Ouch, good luck finding a laptop and wifi so you can scale up those Dynos! Imagine all those influential visitors not being able to see your site, what a wasted opportunity.
I shuddered at that thought, Twilio is a startup too and there is not a person in the house who would stand by and let something like that happen, so I got to hacking and roughly one hour later Dynosaur was born.
Dynosaur is a simple Sinatra app that exposes a your Heroku app via SMS, it works exactly like the Heroku CLI except instead of typing heroku at the command line followed by your arguments, you simply text your arguments.
Simple Scaling By Text Message
As they say a picture is worth a thousand words so look how easy it is to scale your dynos up and down.
Man, that is easy. Next time you get an angry after hours call from your boss, tell him “Yo, I got this”, spin up some dynos by sending a text to dynosaur, and be about your business.
Getting Started with Dynosaur
Clone the repo
$ git clone git://github.com/stevegraham/dynosaur.git
Make your configuration file by copying the example, and substitute your own Twilio and Heroku credentials into it.
$ cp config.yaml.example config.yaml
Add the config file to your repo and commit it
$ git add . $ git commit -m 'config file'
Create new Heroku app and push to Heroku
$ heroku create $ git push heroku master
Buy a number from Twilio and set the “friendly name” of the number to the name of your Heroku app.
Set the SMS URL and SMS Fallback URL to the URL of the new heroku app.
It was really easy to implement Dynosaur with Twilio, go take a look at the code and see for yourself. I used the heroku gem and twilio-rb, sprinkled some Ruby over the top and had something working in less than an hour. If you haven’t made your own Twilio app yet, give it a go, it’s easy and fun and if you have any questions along the way, shoot us an email at email@example.com and we will be happy to help.