trinidad / trinidad_init_services

Run Trinidad as a service (based on Commons-Daemon and JRuby-JSVC)
Other
28 stars 10 forks source link

no such file to load -- trinidad #2

Closed l4u closed 13 years ago

l4u commented 13 years ago

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

abrandoned commented 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:

  1. Are you using gemsets through rvm for your trinidad install? If so, you need to tell your init script to use the gemset when starting up trinidad (I don't see a gemset in the path where init_services is looking for trinidad, if you aren't using gemsets then I would recommend it when you transition to a production environment)
  2. Can you provide some more context about your environment? (running an init.d script along with rvm and all the layers of indirection in an rvm install it would be very helpful to see the top config section of your /etc/init.d/trinidad file and to see an "ls" output of /home/ubuntu/.rvm/jruby-1.6.1/gems, also if you have a .rvmrc file in your app root directory then post what ruby/gemset it chooses)

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.

l4u commented 13 years ago

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?

sujithrs commented 13 years ago

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?

sujithrs commented 13 years ago

Got it working by replacing "#! /bin/sh" with "#!/usr/bin/env bash"

calavera commented 13 years ago

Thank you @sujithrs, I've replaced the shebang line in the template.

ckwang8128 commented 12 years ago

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?

l4u commented 12 years ago

Try rvm Multi-User installation http://beginrescueend.com/rvm/install/ http://beginrescueend.com/support/troubleshooting/#sudo

ghost commented 12 years ago

@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.

ckwang8128 commented 12 years ago

Thanks! I will explore both of these.

baroquebobcat commented 12 years ago

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.

mark100net commented 12 years ago

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).

  1. Do not tell the installer that you are running as nonroot (i.e. if your init script has a "RUN_USER" line, remove it or comment it out).
  2. Add this line to the top of the init script:

source /home/yourrvmuser/.rvm/environments/default

Of course, you can also point it to a specific ruby rather than default.

Hope this helps someone.

elmer-garduno commented 12 years ago

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.

ajinkyapisal commented 9 years ago

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.