I'm trying to manage a ruby script with supervisord but because I haven't fully understood how RVM works I have not been able to do it properly.
Normally I would just do the following:
# sourcing of rvm done automatically on ssh login
cd /var/rails/myapp
RAILS_ENV="production" bundle exec ./script/backgroundrb
But with the following configuration file I cannot do it:
[program:owgm]
directory=/var/rails/owgm
command=bundle exec ./script/backgroundrb
environment=RAILS_ENV="production"
PATH="/usr/local/rvm/gems/ree-1.8.7-2012.02@global/bin/bundle:$PATH"
autostart=true
autorestart=true
I get the following error:
Could not load OpenSSL. You must recompile Ruby with OpenSSL support or change the sources in your Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL using RVM are available at rvm.io/packages/openssl.
It looks like I'm not managing to get the right ruby environment.
I thought setting the path would work, because if I do:
which bundle
I get: /usr/local/rvm/gems/ree-1.8.7-2012.02@global/bin/bundle
But I'm not even sure of what is happening.
With Python I would do something like:
command=/path/to/virtualenv/bin/python /path/to/script.py
Is there something similar I could do with ruby?
The output of rvm info is:
ree-1.8.7-2012.02:
system:
uname: "Linux owtb2 3.2.0-44-generic #69-Ubuntu SMP Thu May 16 17:35:01 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux"
system: "ubuntu/12.04/x86_64"
bash: "/bin/bash => GNU bash, version 4.2.25(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.21.3 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]"
updated: "4 months 4 days 3 hours 54 minutes 35 seconds ago"
ruby:
interpreter: "ruby"
version: "1.8.7"
date: "2012-02-08"
platform: "x86_64-linux"
patchlevel: "2012-02-08 MBARI 8/0x6770 on patchlevel 358"
full_version: "ruby 1.8.7 (2012-02-08 MBARI 8/0x6770 on patchlevel 358) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2012.02"
homes:
gem: "/usr/local/rvm/gems/ree-1.8.7-2012.02"
ruby: "/usr/local/rvm/rubies/ree-1.8.7-2012.02"
binaries:
ruby: "/usr/local/rvm/rubies/ree-1.8.7-2012.02/bin/ruby"
irb: "/usr/local/rvm/rubies/ree-1.8.7-2012.02/bin/irb"
gem: "/usr/local/rvm/rubies/ree-1.8.7-2012.02/bin/gem"
rake: "/usr/local/rvm/gems/ree-1.8.7-2012.02@global/bin/rake"
environment:
PATH: "/usr/local/rvm/gems/ree-1.8.7-2012.02/bin:/usr/local/rvm/gems/ree-1.8.7-2012.02@global/bin:/usr/local/rvm/rubies/ree-1.8.7-2012.02/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
GEM_HOME: "/usr/local/rvm/gems/ree-1.8.7-2012.02"
GEM_PATH: "/usr/local/rvm/gems/ree-1.8.7-2012.02:/usr/local/rvm/gems/ree-1.8.7-2012.02@global"
MY_RUBY_HOME: "/usr/local/rvm/rubies/ree-1.8.7-2012.02"
IRBRC: "/usr/local/rvm/rubies/ree-1.8.7-2012.02/.irbrc"
RUBYOPT: ""
gemset: ""
Thanks to the suggestion of @mpapis I have been able to figure out something that works.
His suggestion unfortunately didn't, but he was right in the fact that I had to look in /usr/local/rvm/wrappers
This is the working config file:
[program:owgm]
directory=/var/rails/owgm
command=/usr/local/rvm/wrappers/ree-1.8.7-2012.02/bundle exec ./script/backgroundrb
environment=RAILS_ENV="production"
autostart=true
autorestart=true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With