Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Robust way to deploy a Rack application (Sinatra)

I'm looking for a robust way to deploy a Rack application (in this case a Sinatra app). Requests will take a little time (0.25-0.5 sec waiting on proxied HTTP requests) and there may be a decent amount of traffic.

Should I go with a traditional mongrel cluster setup? Use HAProxy as a load balancer? nginx? rackup?

What solutions have you used and what are the advantages?

like image 639
Daniel Beardsley Avatar asked Dec 20 '10 01:12

Daniel Beardsley


People also ask

How do I deploy Sinatra app?

Set up Postgres on your machine (see here for a more detailed guide), then export the DATABASE_URL environment variable to ensure your local environment and Heroku environment are connected. Run export DATABASE_URL=postgres://$(whoami) . When you're ready, run git push heroku main . This should deploy the app.

What is rack in Sinatra?

Rack is just a stack of callable objects. Rack's interface and principals are actually very simple, it's just that we typically never need to think about them when working with Rails, Sinatra, Hanami or other frameworks built on top of Rack.


1 Answers

Nginx / Unicorn FTW!

Nginx in front to serve static files and unicorn to handle Sinatra app.

Benefits: Performance, good load balancing with unix socks and deploy/upgrade without any downtimes (you can upgrade Ruby/Nginx/Sinatra/app without downtime).

How-to : http://sirupsen.com/setting-up-unicorn-with-nginx/ .

like image 151
Nikkau Avatar answered Sep 19 '22 12:09

Nikkau