Code Monkey home page Code Monkey logo

Comments (9)

tmm1 avatar tmm1 commented on June 25, 2024

Try rvmsudo

from god.

JDutil avatar JDutil commented on June 25, 2024

I've tried to use rvmsudo god and tried to use rvmsudo with a god wrapper, and both cases still result in the same error of the gem not being found...

Just trying to use: rvmsudo god did result in god running from the proper gemset, but the gem missing errors still make no sense since the gem is installed in the gemset, and every other rubygems instance on the server...

from god.

tmm1 avatar tmm1 commented on June 25, 2024

How about rvmsudo bundle exec god?

from god.

JDutil avatar JDutil commented on June 25, 2024

Awesome thank you @tmm1 that did the trick :)

Definitely going to put some information together in the wiki on my setup. I fought for several days to get my initial setup working, and then this issue has been plaguing me for a couple weeks without any decent information found through google or anywhere else I looked.

Seems like all the information I can find on god is all based before rvm and bundler became the more mature defacto choices of development that they are now.

from god.

JDutil avatar JDutil commented on June 25, 2024

This is still an issue for me even after updating my capistrano tasks to use rvmsudo bundle exec god. It fixed the problem last time, but I updated another gem tonight causing it to occur again. God is failing again unable to find the new gem. Once again I've tried to install the gem under the system default ruby, ruby 1.9.2-p290@global, ruby 1.9.2-p290@custom.

This is an example of my capistrano god tasks:

require 'bundler/capistrano'

after 'deploy:symlink', 'god:restart'

# RVM Integration
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, '1.9.2-p290@global'
set :rvm_type, :user

namespace :god do
  task :start, :roles => :app do
    god_config_file = "#{latest_release}/config/#{rails_env}.god"
    run "cd #{latest_release}; rvmsudo bundle exec god --log-level debug -c #{god_config_file}"
  end
  task :stop, :roles => :app do
    run "cd #{latest_release}; rvmsudo bundle exec god terminate" rescue nil
  end
  task :restart, :roles => :app do
    if rails_env == 'staging'
      god.load_config
    else
      god.stop
      god.start
    end
  end
  task :status, :roles => :app do
    run "sudo god status"
  end
  task :load_config, :roles => :app do
    god_config_file = "#{latest_release}/config/#{rails_env}.god"
    run "cd #{latest_release}; rvmsudo bundle exec god load #{god_config_file}"
  end
  task :log, :roles => :app do
    run "tail -f #{latest_release}/log/god.#{rails_env}.log"
  end
end

from god.

tmm1 avatar tmm1 commented on June 25, 2024

I'm not really sure. Try opening a ticket on bundler

from god.

JDutil avatar JDutil commented on June 25, 2024

Well closing out since this is related to rvm/bundler.

I'm able to solve this issue by running bundle for the system default ruby to ensure bundler is able to find the gems for both the system default ruby and the apps rvm gemset.

I'm not sure exactly why I have to do this even if I'm using an rvm god wrapper with rvmsudo, but if anyone else runs into this also you must ensure to bundle for the system default not just install the gem.

from god.

JDutil avatar JDutil commented on June 25, 2024

I've been attempting to setup god running with RVM on a new server & app, and am experiencing the same issue. This time I have not installed god under the system rubygems because I have no system rubygems only my RVM installation. I have bundler installed in the gemset. I've made sure that the rvm wrapper I created was using the gemset's copy of god, but running god through the rvm wrapper w/rvmsudo still causes god to look for the system rubygems, which don't exist. I receive errors that the command bundle doesn't exist despite the fact bundler is installed and used to bundle dependencies on deployment fine.

The process appears to run using the proper ruby/gemset, but the actions god runs don't work because it can't find bundler in the gemset.

root     15238 16.5  0.7  29800 13112 pts/1    Sl   19:57   0:00 /home/ubuntu/.rvm/rubies/ruby-1.9.2-p290/bin/ruby /home/ubuntu/.rvm/gems/ruby-1.9.2-p290@econdo/bin/god --log-level debug -c /var/www/econdo/shared/staging.god

Perhaps this is related to the way my god configuration is setup or how the god gem runs it's processes?

Heres a sample of my sphinx configuration:

RAILS_ENV    = 'staging'
RAILS_ROOT  = "/var/www/econdo/current"
RUBY_PATH   = "/home/ubuntu/.rvm/rubies/ruby-1.9.2-p290/bin/ruby"
SHARED_ROOT = "/var/www/econdo/shared"
USER        = "ubuntu"
GROUP       = "ubuntu"

# Watch Sphinx
God.watch do |w|
  w.env = {
    'RAILS_ROOT' => RAILS_ROOT,
    'RAILS_ENV'  => RAILS_ENV,
    'PATH'       => "#{RUBY_PATH}:/usr/bin:/bin"
  }
  w.group         = RAILS_ENV
  w.name          = "#{RAILS_ENV}-Sphinx"
  w.interval      = 30.seconds # default
  w.dir           = RAILS_ROOT
  w.start         = "cd #{RAILS_ROOT} && RAILS_ENV=#{RAILS_ENV} bundle exec rake ts:start --trace"
  w.stop          = "cd #{RAILS_ROOT} && RAILS_ENV=#{RAILS_ENV} bundle exec rake ts:stop --trace"
  w.restart       = w.stop + " && " + w.start
  w.start_grace   = 10.seconds
  w.restart_grace = 10.seconds
  w.pid_file      = File.join(SHARED_ROOT, "log/searchd.#{RAILS_ENV}.pid")
  w.log           = File.join(SHARED_ROOT, "log/god.#{RAILS_ENV}.log")
  w.uid           = USER
  w.gid           = GROUP
end

If anyone can help me figure out what I might be doing wrong with my configuration that would be great.

from god.

JDutil avatar JDutil commented on June 25, 2024

Solved this issue thanks to help over on the RVM issues. rvm/rvm#437

Basically for anyone else running into this you should be using the rvm rake bin path, and rvm ruby bin path to run rake tasks and scripts rather than trying to use bundler.

So for DelayedJob:

RUBY_BIN = '/home/ubuntu/.rvm/bin/ruby-1.9.2-p290'

w.start         = "cd #{RAILS_ROOT} && RAILS_ENV=#{RAILS_ENV} #{RUBY_BIN} script/delayed_job -n 1 start"
w.stop          = "cd #{RAILS_ROOT} && RAILS_ENV=#{RAILS_ENV} #{RUBY_BIN} script/delayed_job stop"

For Sphinx:

RAKE_BIN = '/home/ubuntu/.rvm/bin/rake-ruby-1.9.2-p290'

  w.start         = "cd #{RAILS_ROOT} && RAILS_ENV=#{RAILS_ENV} #{RAKE_BIN} ts:start --trace"
  w.stop          = "cd #{RAILS_ROOT} && RAILS_ENV=#{RAILS_ENV} #{RAKE_BIN} ts:stop --trace"

from god.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.