Question

unicorn/nginx doesn't work after changing default capistrano deployment directory

  • Posted March 1, 2014

Hi Everyone,

I installed a ruby on rails pre-packaged version to ubuntu 12.4. And use capistrano to deploy my app. I changed the default app directory from /home/rails to /var/www/apps/. The deployment was successful, but i got unicorn errors and the end result is timeout on the page. Please help me with this, this has confused me for quite a while, I can’t really figure out why.

Thanks,

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi,

solution for rails 3.2.x is to stop unicorn and uninstall rack 1.5.2:

service unicorn stop
gem uninstall rack -v 1.5.2

after that I have also uninstalled rack 1.5.2 dependencies:

gem uninstall actionpack-4.1.6
gem uninstall actionpack-4.0.2

, but I thing it is not necessary.

Than run bundle install and restart nginx:

service nginx restart

Finally start unicorn:

service unicorn start

It should work. After that I had to solve some other problems, but it were small things compare to this problem.

Cheers Kuba

so what’s the solution?

There’s your error: <br><blockquote>/usr/local/rvm/gems/ruby-2.0.0-p353/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup’: You have already activated rack 1.5.2, but your Gemfile requires rack 1.4.5. Using bundle exec may solve this. (Gem::LoadError)</blockquote>

this is what i see from the unicorn error log: <br> <br>E, [2014-03-02T15:27:43.334218 #2773] ERROR – : reaped #<Process::Status: pid 31276 exit 1> worker=1 <br>I, [2014-03-02T15:27:43.334663 #2773] INFO – : worker=1 spawning… <br>I, [2014-03-02T15:27:43.341445 #31282] INFO – : worker=1 spawned pid=31282 <br>I, [2014-03-02T15:27:43.347471 #31282] INFO – : Refreshing Gem list <br>/usr/local/rvm/gems/ruby-2.0.0-p353/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in block in setup': You have already activated rack 1.5.2, but your Gemfile requires rack 1.4.5. Using bundle exec may solve this. (Gem::LoadError) <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/bundler-1.3.5/lib/bundler/runtime.rb:19:in setup’ <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/bundler-1.3.5/lib/bundler.rb:120:in setup' <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in <top (required)>’ <br> from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in require' <br> from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in rescue in require’ <br> from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in require' <br> from /var/www/apps/lga/releases/20140225181502/config/boot.rb:6:in <top (required)>’ <br> from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' <br> from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require’ <br> from /var/www/apps/lga/releases/20140225181502/config/application.rb:1:in <top (required)>' <br> from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require’ <br> from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' <br> from /var/www/apps/lga/releases/20140225181502/config/environment.rb:2:in <top (required)>’ <br> from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require' <br> from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in require’ <br> from config.ru:4:in block in <main>' <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/rack-1.5.2/lib/rack/builder.rb:55:in instance_eval’ <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/rack-1.5.2/lib/rack/builder.rb:55:in initialize' <br> from config.ru:1:in new’ <br> from config.ru:1:in <main>' <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn.rb:48:in eval’ <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn.rb:48:in block in builder' <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:750:in call’ <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:750:in build_app!' <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:623:in init_worker_process’ <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:643:in worker_loop' <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:527:in spawn_missing_workers’ <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:538:in maintain_worker_count' <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:303:in join’ <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/bin/unicorn:126:in <top (required)>' <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/bin/unicorn:23:in load’ <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/bin/unicorn:23:in <main>' <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in eval’ <br> from /usr/local/rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>’ <br>E, [2014-03-02T15:27:43.424026 #2773] ERROR – : reaped #<Process::Status: pid 31279 exit 1> worker=0 <br>I, [2014-03-02T15:27:43.424524 #2773] INFO – : worker=0 spawning… <br>I, [2014-03-02T15:27:43.427174 #31285] INFO – : worker=0 spawned pid=31285 <br>I, [2014-03-02T15:27:43.433696 #31285] INFO – : Refreshing Gem list <br>

<blockquote>i got unicorn errors</blockquote>Can you post the errors?