Closed l4u closed 13 years ago
I don't work directly on init_services, but I run it on a bunch of servers running ubuntu/rvm.
Couple questions:
The root of the issue is that your rubygems can't find the "trinidad" gem when it loads.
I have seen this when the configs aren't aligned (rvm => gemset => trinidad_init_services => bundle) I would guess you just need to make sure that you are telling your machine to use the same/right jruby and gems when starting the service.
thanks for for the hints. I have fixed that by adding rvm to the root.
and if I use gemset should I add "rvm use jruby@my_project" after the "cd $APP_PATH" line?
I am facing the exact same issue. By adding rvm to root, I can get it working if I am logged in a root (su -) and run the init.d script from command line. However, it doesnt work if I run it as sudo or on a reboot. Any ideas?
Got it working by replacing "#! /bin/sh" with "#!/usr/bin/env bash"
Thank you @sujithrs, I've replaced the shebang line in the template.
I'm currently facing the same issue with this service. What is meant by "adding rvm to root" and telling the init script to use the particular jruby gemset on the server?
Try rvm Multi-User installation http://beginrescueend.com/rvm/install/ http://beginrescueend.com/support/troubleshooting/#sudo
@ckwang8128: I meant adding multi-User installation as @l4u have mentioned.
However, I found it difficult to work with rvm in production env. I have since moved to rbenv https://github.com/sstephenson/rbenv. It's much simpler and easier to work with imho.
Thanks! I will explore both of these.
I've also had this issue when using bundler. If trinidad is only installed by bundler inside the application, it won't show up. I worked around it by just installing trinidad as a system gem.
I did not want to install RVM multi-user or for root. So here is how I fixed this issue (and used a similar solution other times when I need root to do something relative to my rails application running under non root with its own RVM).
source /home/yourrvmuser/.rvm/environments/default
Of course, you can also point it to a specific ruby rather than default.
Hope this helps someone.
Regarding the previous comment, you can also run as non-root if you propagate the environment variables by replacing:
JSVC="sudo -u $RUN_USER $JSVC"
with
JSVC="sudo -E -u $RUN_USER $JSVC"
on the init script.
Well this is an old issue. But I am getting the same error. If I run trinidad daemon using sudo then I get "no such file to load -- trinidad". But if I dont specify sudo correctly.
JRubyDaemon: Script raised an error: org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- trinidad org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- trinidad at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1038) at Kernel.require(/home/ubuntu/.rvm/rubies/jruby-1.6.1/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29) at home.ubuntu.$_dot_rvm.gems.jruby_minus_1_dot_6_dot_1.gems.trinidad_daemon_minus_0_dot_4_dot_1.lib.trinidad_daemon.(root)(/home/ubuntu/.rvm/gems/jruby-1.6.1/gems/trinidad_daemon-0.4.1/lib/trinidad_daemon.rb:2) Cannot load daemon Service exit with a return value of 3
but starting trinidad without init script works