God/Resque Gemfile path not updated: Bundler::GemfileNotFound

84 views
Skip to first unread message

sambhav...@caroobi.com

unread,
Apr 3, 2016, 5:11:20 PM4/3/16
to god.rb
I am using God for monitoring resque process and capistrano for application deployment.

My resque.god.rb looks like this:

    rails_root  = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/..'
    rails_env   = ENV['RAILS_ENV'] or raise 'RAILS_ENV not set'
    queue_check_interval = 3
    num_workers = 1
    queue = ['requester']


    num_workers.times do |num|
    God.watch do |w|
      w.name         = "resque_#{rails_env}_#{num}"
      w.group    = 'resque'
      w.log             = "#{rails_root}/log/god.log"
    w.interval = 30.seconds
      w.env      = {'QUEUE'=>queue[num], 'RAILS_ENV'=>rails_env}
      w.start    = "rake -f #{rails_root}/Rakefile environment INTERVAL=#{queue_check_interval} resque:work"

      # restart if memory gets too high
      w.transition(:up, :restart) do |on|
        on.condition(:memory_usage) do |c|
          c.above = 300.megabytes
          c.times = 2
        end
      end

      # determine the state on startup
      w.transition(:init, { true => :up, false => :start }) do |on|
        on.condition(:process_running) do |c|
          c.running = true
        end
      end

      # determine when process has finished starting
      w.transition([:start, :restart], :up) do |on|
        on.condition(:process_running) do |c|
          c.running = true
          c.interval = 5.seconds
        end

        # failsafe
        on.condition(:tries) do |c|
          c.times = 5
          c.transition = :start
          c.interval = 5.seconds
        end
      end

      # start if process is not running
      w.transition(:up, :start) do |on|
        on.condition(:process_running) do |c|
          c.running = false
        end
      end
    end
    end

Whenever I am trying to restart the process, I get the following error:

    /home/stage/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/definition.rb:22:in `build': /home/stage/app/project/releases/20160401213805/Gemfile not found (Bundler::GemfileNotFound)
    from /home/stage/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler.rb:120:in `definition'
    from /home/stage/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler.rb:88:in `setup'
    from /home/stage/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/setup.rb:18:in `<top (required)>'
    from /home/stage/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/stage/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'

clearly the gemfile path is not updated since it is looking for the gemfile in a past release which doesn't exist anymore since it has been removed by capistrano. 

How do I solve this issue?

Reply all
Reply to author
Forward
0 new messages