Unable to start Unicorn with Ruby 2.0

On my ubuntu machine, I can run the unicorn on ruby ​​1.9.3, however it doesn't seem to work with ruby ​​2.0. Any idea why?

root@dev :/home/karan# rvm use 1.9 Using /usr/local/rvm/gems/ruby-1.9.3-p429 root@dev :/home/karan# unicorn -v unicorn v4.6.3 root@dev :/home/karan# rvm use 2.0 Using /usr/local/rvm/gems/ruby-2.0.0-p195 root@dev :/home/karan# unicorn -v /usr/local/rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- unicorn/launcher (LoadError) from /usr/local/rvm/rubies/ruby-2.0.0-p195/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require' from /usr/bin/unicorn:3:in `<main>' 
+4
source share
2 answers

Try reinstalling the stone with 2.0.0.

The problem should have been caused by the fact that the stone was installed in 1.9.3.

+4
source

I have the same problem when I try to start a Unicorn server

 Starting Unicorn web server unicorn /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': cannot load such file -- unicorn/launcher (LoadError) 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' from /usr/bin/unicorn:3:in `<main>' 

However, Unicorn works great when I launch it from the rails application folder, just using the unicorn command.

I tried what you offer by setting the unicorn gem

 gem install 'unicorn' 

But this does not change the result.

I check which stone is installed:

 which gem 'unicorn' /usr/local/rvm/rubies/ruby-2.0.0-p353/bin/gem /usr/local/rvm/gems/ruby-2.0.0-p353/bin/unicorn 

I run the unicorn from the etc / init.d script file, which you can see here:

http://pastebin.com/qvwdmRJ2

and here for the default configuration:

http://pastebin.com/84FBQjMp

There seems to be some problem with the default PATH file configuration:

 PATH=/usr/local/rvm/rubies/ruby-2.0.0-p353/bin:/home/unicorn/.rvm/bin:/usr/local/sbin:/usr/bin:/bin:/sbin:$ 

Because, since I updated it with the new version installed, I get the error message shown at the top. If I delete it, Unicorn β€œapparently starts”, but the log shows crazy activity and nginx shows a blank screen.

I’m trying to find a solution and will share it here as soon as I find it.

thanks for the help

* UPDATE *

OK I found problems:

1) for the file /etc/init.d script:

You need to create a wrapper for Unicorn to work in the init.d script file:

rvm wrapper 2.0.0 ruby-2.0.0 unicorn

then replace the line

DAEMON = / usr / bin / unicorn

with this:

DAEMON = / USR / local / rbm / bin / ruby ​​2.0.0_unicorn

And now the team

unicorn service launch

more about rvm wrapper here: https://rvm.io/integration/init-d

2) I also had another problem that was difficult to identify in the journal:

I did not create the config / environment / staging.rb file

+3
source

Source: https://habr.com/ru/post/1496643/


All Articles