Robust way to deploy a Rack application (Sinatra)

2020-06-18 09:06发布

问题:

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?

回答1:

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/ .



回答2:

Nginx / passenger.

Nginx is very light, performant and has readable configuration files. Passenger is solid, easy to set up and works very well with rack - just have your config.ru in your app's main dir. Passenger can also take care of spawning processes and load balancing for you.