Much of this will be deprecated (manual init.d installation, compiling from source, etc) but documenting for good measure --jmw
./configure --with-http_ssl_module --sbin-path=/usr/local/sbin/ sudo make install
=> bins get put in in /usr/local/sbin => conf/logs/etc live in /usr/local/nginx/{conf,logs,etc}
in RAILS_ROOT/config/etc/ I've stashed the (custom) init.d scripts for both servers, which live in /etc/init.d
To have them launch at boot: $ update-rc.d nginx defaults $ update-rc.d unicorn defaults
TODO: add logrotate config files
TODO: use some custom .deb packages, yeesh!
TODO: clean up logging locations
nginx is currently going to /usr/local/nginx/logs/...
An alternate unicorn init.d I liek: http://gist.github.com/308216
Launch unicorn manually: $ unicorn_rails -c config/unicorn.rb -E production -D
- OR - $ sudo invoke-rc.d unicorn start
Test nginx config: $ nginx -t
Launch nginx: $ nginx
- OR - $ sudo invoke-rc.d nginx start
It's referred to as "upgrading" if you are sidel-ing in a new version of Rails -- Unicorn does a running restart, one worker at a time
To upgrade: send the unicorn master process a USR2 signal. Cake.
$ PID=#{RAILS_ROOT}/tmp/pids/unicorn.pid; test -s "$PID" && kill -USR2 cat $PID
To actually restart, which causes a lag on 1st request while Rails re-loads:
$ PID=#{RAILS_ROOT}/tmp/pids/unicorn.pid; test -s "$PID" && kill -USR cat $PID
For deployment with capistrano:
- replace the 'deploy:restart' task to send USR2 (or better: invoke the init.d script)