A previously working Rails app, after a successful Capistrano deploy cycle, stops responding and the server returns the http status code 504.
I was able to successfully access the Droplet by way of SSH. Looking at the logs I noticed the unicorn server was having trouble [re]starting.
tail -f /home/unicorn/log/unicorn.log
This was the [repeating] entry in the log file
I, [2014-04-19T02:31:20.223963 #11885] INFO -- : Refreshing Gem list
config.ru:1:in `<main>': cannot load such file -- rack/builder (LoadError)
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn.rb:48:in `eval'
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn.rb:48:in `block in builder'
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:722:in `call'
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:722:in `build_app!'
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:595:in `init_worker_process'
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:615:in `worker_loop'
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:500:in `spawn_missing_workers'
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:511:in `maintain_worker_count'
from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:277:in `join'
Closer examimation revealed that the application had depencies expecting Rack version 1.4.2 but Rack 1.5.2 is already installed.
cd /home/rails/current
, the location of the Rails application
gem uninstall rack -v 1.5.2
touch tmp/restart.txt && service nginx restart && service unicorn restart