RVM & Unicorn Deployment

My RVM is installed as root. When I try to start the unicorn socket, it prints

user@9001-3 :~$ /etc/init.d/unicorn start Starting myapp app: /usr/bin/env: ruby: No such file or directory unicorn. 

But if I type

 user@9001-3 :~$ ruby -v ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux] 

/usr/local/rvm/gems/ruby-1.9.2-p180/bin/unicorn exists.

My unicorn configuration: https://gist.github.com/1010519

+7
source share
4 answers

/etc/init.d/unicorn does not know where to find Ruby because it is managed through RVM. Usually your .bashrc or similar file executes and sets up the environment; this does not happen in initialization scripts (or probably anything else executed by root).

The solution is to use wrappers. For example, to create a binary called system_ruby that loads RVM 1.9.2p180 and then ruby , do the following:

 rvm wrapper ruby-1.9.2-p180 system ruby 

For more information and more details, check out my answer that addresses a similar issue.

+10
source

Symlink also works,

 which ruby<your version> ln-s /ruby/path/ruby<your version> /ruby/path/ruby 
+1
source

Type: which ruby (show the ruby ​​bin path), enter the following: ln -s (change_to_ruby_path) /usr/bin/env/ruby (create the correct access for your system)

0
source

I had the same problem and this is for me

 rvm --default use <version> 
0
source

All Articles