Ruby on rails 无法使用gem通过capistrano部署

Ruby on rails 无法使用gem通过capistrano部署,ruby-on-rails,ruby,capistrano3,whenever,whenever-capistrano,Ruby On Rails,Ruby,Capistrano3,Whenever,Whenever Capistrano,我正在尝试使用Capistraino部署RubyonRails应用程序。我有一个我计划随时使用的作业,但我在尝试部署时不断出错 下面的config deploy.rb出错 deploy.rb 如果我将deploy.rb更改为 deploy.rb 我得到这个错误 错误 卡普里 附表1.rb 它似乎在抱怨找不到常量Delayed::Job。根据,完整的Rails环境不会加载到schedule.rb文件中。您可能希望将延迟的作业排队放入一个运行程序中,如下所示: unless ENV['RAILS_E

我正在尝试使用Capistraino部署RubyonRails应用程序。我有一个我计划随时使用的作业,但我在尝试部署时不断出错

下面的config deploy.rb出错 deploy.rb 如果我将deploy.rb更改为

deploy.rb 我得到这个错误

错误 卡普里 附表1.rb
它似乎在抱怨找不到常量
Delayed::Job
。根据,完整的Rails环境不会加载到schedule.rb文件中。您可能希望将延迟的作业排队放入一个运行程序中,如下所示:

unless ENV['RAILS_ENV'] == 'test'
  every 30.minutes do
    runner 'Delayed::Job.enqueue(UpdateScoresJob.new(Article.published.all.pluck(:id)), priority: 1, run_at: 1.minute.from_now)'
  end
end

在您的cap文件中,您是否
需要“where/capistrano”
?@alexsmn是的,我刚在thanksAt上面发布了我的cap文件,就在我使用这个宝石的那一刻,不同的是,我没有在
deploy.rb
中设置
where
,但我在
计划中设置了我的cron作业。rb
@alexsmn在没有手动重启的情况下仍在运行?对我来说是这样的,我只需要部署,它会设置作业,或者,如果我修改它们并重新启动capistrano,它们会相应地更新,但仍会抛出捆绑程序错误
(回溯限制为导入的任务)cap中止!SSHKit::Runner::ExecuteError:作为执行时发生异常deploy@staging.company.com:bundle exec when exit status:10 bundle exec when stdout:找不到Gemfile或.bundle/目录bundle exec when stderr:未写入任何内容
是否在Capistrano设置中的任何位置设置了部署到“/rails/root”,以及,您的Gemfile是否已提交?Deploy to设置为应用程序根目录,yes Gemfile在将wherever路径更改为
set:where\u命令后提交,“cd~/app/myapplication/current&&bundle exec where”
我收到一个新错误。
cd~/app/myapplication/current&&bundle exec where stderr:config/schedule.rb:3:in“block in initialize”:未初始化常量where::JobList::Delayed(NameError)from/home/deploy/app/myapp/shared/bundle/ruby/2.1.0/gems/where-0.9.4/lib/where/job_list.rb:44:在config/schedule的'every'中。rb:2:在'initialize'中
# delayed-job
set :delayed_job_workers, 2
set :delayed_job_prefix, :drnow
set :delayed_job_roles, [:app, :background]

# whenever
set :whenever_identifier, -> { "#{fetch(:application)}_#{fetch(:stage)}" }
set :whenever_command, 'bundle exec whenever'
set :whenever_environment, defer { stage }
# whenever
set :whenever_identifier, -> { "#{fetch(:application)}_#{fetch(:stage)}" }
set :whenever_command, 'bundle exec whenever'
set :whenever_environment, ->{ fetch :rails_env, fetch(:stage, "production") }
DEBUG [e84fec09] Command: bundle exec whenever
DEBUG [e84fec09]    Could not locate Gemfile or .bundle/ directory
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@company.com: bundle exec whenever exit status: 10
bundle exec whenever stdout: Could not locate Gemfile or .bundle/ directory
bundle exec whenever stderr: Nothing written

SSHKit::Command::Failed: bundle exec whenever exit status: 10
bundle exec whenever stdout: Could not locate Gemfile or .bundle/ directory
bundle exec whenever stderr: Nothing written

Tasks: TOP => whenever:update_crontab
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy@company.com: bundle exec whenever exit status: 10
bundle exec whenever stdout: Could not locate Gemfile or .bundle/ directory
bundle exec whenever stderr: Nothing written
# Load DSL and set up stages
require 'capistrano/setup'

# Include default deployment tasks
require 'capistrano/deploy'
require 'capistrano/rails'
require 'capistrano/rvm'
require 'capistrano/faster_assets'
require 'capistrano/delayed-job'
require 'whenever/capistrano'
# Load custom tasks from `lib/capistrano/tasks' if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
unless ENV['RAILS_ENV'] == 'test'
  every 30.minutes do
    Delayed::Job.enqueue(UpdateScoresJob.new(Article.published.all.pluck(:id)), priority: 1, run_at: 1.minute.from_now)
  end
end
unless ENV['RAILS_ENV'] == 'test'
  every 30.minutes do
    runner 'Delayed::Job.enqueue(UpdateScoresJob.new(Article.published.all.pluck(:id)), priority: 1, run_at: 1.minute.from_now)'
  end
end