On Thursday afternoon, I had an idea for just about the smallest web app I could think of (since then, I’ve even cut out a couple features). It didn’t make sense to use all of Ruby on Rails for this considering how tiny it was.
Seemed like a great opportunity to try out Sinatra1
- Write the app
- Vendor Sinatra and Rack (that’s just good practice)
- Submit a ticket requesting a port
- Add a config.ru file to your app’s directory (for Rack) containing the following
# PATH TO VENDOR-ED RACK AND SINATRA
:run => false,
:environment => :production
- Add a config.yml file to your app’s directory for Thin containing the following
Follow the Setting up and Configuring Lighttpd instructions on the Joyent Wiki(See update below)
- Add another Bootup Action for Thin
thin -s 1 -C /path/to/config.yml -R /path/to/config.ru start
thin -s 1 -C /path/to/config.yml -R /path/to/config.ru stop
- Follow the Proxying to a Port instructions on the Joyent Wiki
1. If the time I spent building this app was a cocktail, it’d be 1 part programming, 2 parts design, 3 parts deployment. That’s a huge part of why I wrote this post.
UPDATE: March 8, 2009
My gut says Lighttpd + Thin is redundant, so I’ve turned Lighttpd off.