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?
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.
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.
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/ .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With