RailsCasts Pro episodes are now free!

Learn more or hide this

Kresimir Bojcic's Profile

GitHub User: drKreso

Site: kresimirbojcic.com

Comments by Kresimir Bojcic


I know this is old but since I've lost 12 hours, leaving it for future reference...

My restart went fine and new PIDS for unicorn where given... but if I deleted "old" release folder it would break (unicorn was still pointing there). I thought it has to do with symlinking the in the wrong moment, but it was more sinister...

The unicorne process points to the wrong Gemfile, it fails or something and dies silently. (Ok not silently, but I overlooked).

GemFile not found

Unicorn restart/upgrade doesn't work

Adding this to my unicorn.rb solved the issue

before_exec do |server|
  ENV['BUNDLE_GEMFILE'] = "/rails_app/current/Gemfile"

You can also set ENV variable when invoking form capistrano like this, or probably just using capistrano-unicorn gem would be enough!

*It's really important that after change you stop/start unicorn after first redeploy. After that the "before_exec" block will go in memory and wait for the next deploy!