Capistrano rails跳过任务`部署:更新',因为它之前已被调用

时间:2017-07-17 05:40:12

标签: ruby-on-rails capistrano capistrano3 rvm-capistrano rvm1-capistrano3

我使用rvm,

在轨道上

在使用capistrano时出现以下错误:

Skipping task `deploy:updating'.
Capistrano tasks may only be invoked once. Since task `deploy:updating' was previously invoked, invoke("deploy:updating") at /home/ziaulrehman/.rvm/gems/ruby-2.3.4/gems/capistrano-3.8.2/lib/capistrano/tasks/framework.rake:64 will be skipped.
If you really meant to run this task again, first call Rake::Task["deploy:updating"].reenable
THIS BEHAVIOR MAY CHANGE IN A FUTURE VERSION OF CAPISTRANO. Please join the conversation here if this affects you.
https://github.com/capistrano/capistrano/issues/1686

我的capfile有:

require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/bundler'
require 'capistrano/rails'
require 'rvm1/capistrano3'
require 'capistrano/puma'
require 'capistrano/sidekiq'
install_plugin Capistrano::Puma
install_plugin Capistrano::Puma::Nginx

require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git

require "capistrano/rails/assets"
# there are no customm tasks
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

我的deploy.rb看起来像:

# config valid only for current version of Capistrano
lock "3.8.2"

set :application,     "webapp"
set :deploy_via,      :remote_cache
set :keep_releases,   5
set :repo_url,        "git@github.com:org/webapp.git"

append :linked_files, 'config/database.yml', 'config/secrets.yml', '.env.generic'
append :linked_dirs,  'vendor/bundle', 'public/uploads'

# Default deploy_to directory is /var/www/my_app_name
set :deploy_to,       "/home/deployer/www/webapp"

set :rvm1_ruby_version, 'ruby-2.3.4'
# set :rvm_type, :user
# set :default_env,      { rvm_bin_path: '~/.rvm/bin' }
# fetch(:default_env).merge!( rvm_path: '~/.rvm/bin' )
set :rvm1_map_bins, -> { fetch(:rvm_map_bins).to_a.concat(%w{rake gem bundle ruby foreman}).uniq }

before 'deploy', 'rvm1:install:ruby'

set :sidekiq_processes => 2
set :keep_assets, 2
set :sidekiq_config =>    '#{release_path}/config/sidekiq.yml'

set :pty, true

我绝对没有自定义任务或任何东西,这些都是我正在使用的宝石,我怀疑宝石中存在某种冲突。

如果有人能够确切地指出这个问题的确切位置以及如何解决这个问题,那就太棒了。另外,我想知道这个问题的含义。现在一切似乎都很好。

1 个答案:

答案 0 :(得分:2)

这是由rvm1-capistrano3 gem引起的问题。我快速浏览了GitHub上的gem的源代码,它正在做一些奇怪的事情,比如注册这样的钩子:

before :ruby, "deploy:updating"

这对我没有意义;这意味着如果您在部署开始时调用rvm1:install:ruby(如README所建议的那样),那么在部署开始之前它将触发deploy:updating。通常应该在部署的 end 处触发。这个宝石的工作原理令人惊讶。

Skipping task警告非常重要。您的部署可能会起作用,但它仍然令人担忧。我建议找一个rvm1-capistrano3 gem的替代品。