Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

good unicorn + nginx + cap deploy howto?

Can anyone suggest a good good unicorn + nginx + cap deploy how to? I have searched high and low spend like 5 hours getting my deploy up and running with all kind or errors.

like image 322
Rubytastic Avatar asked Mar 15 '12 23:03

Rubytastic


2 Answers

I like this one

http://ariejan.net/2011/09/14/lighting-fast-zero-downtime-deployments-with-git-capistrano-nginx-and-unicorn

Also github did a pretty good writeup on nginx and unicorn

https://github.com/blog/517-unicorn

like image 147
aa_memon Avatar answered Oct 26 '22 05:10

aa_memon


Just yesterday I had to setup some Unicorns and nginx. I followed:

  • The article aa_memon already mentioned and
  • http://www.slideshare.net/mauricio.linhares/deploying-your-rails-application-to-a-clean-ubuntu-10

Also, here is my Unicorn config and init.d script: https://gist.github.com/2049606.

The deploy script I ended up using is almost identical to those mentioned in the links above. If you are using RVM, make sure you add something like:

$:.unshift(File.expand_path('./lib', ENV['rvm_path']))  # Add RVM's lib directory to the load path.
require "rvm/capistrano"                                # Load RVM's capistrano plugin.
set :rvm_ruby_string, '1.9.3-p125@YOURGEMSET'           # Or whatever env you want it to run in.

A critical point is that you specify the PID files to be in the correct places (I mistyped that and it took me half an hour to find my mistake). Also make sure your user can write all necessary files.

like image 35
Pascal Avatar answered Oct 26 '22 05:10

Pascal