The Fastest Way to Get a Site Online

I am a big fan of Sinatra. I love the framework for its simple elegance, but I particularly love it because it’s Rack-compatible, and thus can be easily deployed to Heroku. Both Sinatra and Heroku are geared towards facilitating utter, brain-dead web development simplicity. Pairing them together is the fastest way I’ve found to get a website online.

The Heroku docs for deploying a Sinatra app are excellent, but perhaps make the process more intimidating than necessary for novices, if only because the page includes supplementary info for “pure” Rack apps and other Ruby DSLs. Last week I was helping a friend stick his toe in the water with web development. I wanted to show him how easy it could be to have his own site running on a real live URL. I showed him the Heroku docs, but his response wasn’t “holy shit, this is mind-boggling easy.” Which is a shame, because Sinatra/Heroku deserve that response.

So I made my Sinku repo public on Github. This is what I use as a baseline for Sinatra apps. It’s little more than a raw Sinatra repo, but it takes the timeframe for deploying Sinatra to Heroku down to under a mintute. To deploy a site on a Mac, open the Terminal and type the following [1]:

mkdir -p ~/Sites/project && cd ~/Sites/project
git clone https://github.com/jack7890/Sinku.git ./
bundle install
heroku create
git push heroku master

You can then of course edit the contents of index.rb and create other files to personalize the app. But that’s all you need to get something online. You can see the site by typing heroku open in the terminal. You could also create this with a more concise, single-line version:

mkdir -p ~/Sites/project && cd ~/Sites/project && git clone https://github.com/jack7890/Sinku.git ./ && bundle install && heroku create && git push heroku master

I create Sinatra apps frequently, often for trivial uses. An example from a few weeks ago: I was sending a long Powerpoint to a big group of people. I was afraid that I’d made a mistake or two in the presentation, and that one of the recipients would point this out before everyone in the group got my email. In case this happened, I wanted to be able to host the file on a Cloud App URL and then stick that URL behind a redirect so I could swap in an updated file if necessary. But no URL shorteners that I use (goo.gl, bit.ly, etc) allow for changing a URL once a shortlink has been created. So, instead, I created Sinatra app that would serve as a redirect. Due to the simplicity of Sinatra and Heroku, I was able to do all of this in a minute or two.

I gave this example to my aforementioned friend. It got him much more engaged in learning to code than the 500+ page intro to Rails book he had. He cloned the Sinku repo and immediately began building a less trivial application in Sinatra. The simplicity of Sinatra and Heroku is great for teaching web development. It’s also quite good at empowering those who are more experienced.

Thanks to Eric Waller and Laura Groetzinger for reading this before publishing.


[1] You will obviously want to customize the directory name, “project” in this example. There are a few dependencies necessary to make this work on a fresh OS X installation, including git, bundler, and heroku.

 
212
Kudos
 
212
Kudos

Now read this

A/B Testing

We launched SeatGeek in 2009 at TechCrunch 50 (now renamed “Disrupt”). The elevator pitch was “Farecast for sports and concert tickets.” The site forecasted if ticket prices for an event would rise or fall so that a buyer could time her... Continue →