Simply deploy Sinatra permanently

Sinatra is an awesome tool for creating dynamic websites really really fast. But their deployment recommendations just don't match their overall KISS ethos. So here is my recommendation if you want to deploy a sinatra app really quickly:

If your sinatra app is in:


Just insert in /etc/rc.local (before the "exit 0" line)

nohup /usr/bin/ruby /var/www/sinatra/cool_app.rb&

And then run the same command. Now your application is running, and the next time your system reboots it will start up again.


Update. I probably wouldn't recommend doing this anymore. The world has come a long way since then. It's still a pain to do this right (using something like apache passenger), but you can do a lot better than the above by doing a few more things:

Install shotgun and thin:

sudo gem install shotgun thin

And then put this at the end of /etc/rc.local:

/usr/local/bin/shotgun /var/www/sinatra/cool_app.rb&

It should work the same as before, but also be able to handle more than one request at a time.

3 Response to Simply deploy Sinatra permanently

  1. Unknown says:

    Nice one, but this doesnt work too well with RVM!

    Get errors :-
    :29:in `require': no such file to load -- sinatra (LoadError)
    from :29:in `require'
    from /var/www/update/update.rb:2:in `'

    You shouldnt need the nohup!

  2. Yeah I wrote this in the days before rvm was widely used.

    This approach will require an rvm profile to be setup for root. Should be possible still.

    And yeah - I don't know why I was using nohup.

  3. Unyo says:

    i've been searching for hours for a nice way to deploy a sinatra app. this is epic.

Post a Comment