捆绑安装失败但在使用 capistrano 部署时仍然停止 sidekiq

bundle install failed but still stop sidekiq when use capistrano deploy

当我使用capistrano部署我的rails应用程序时,bundle install before stop sidekiq,当bundle install失败时,sidekiq不应该被停止,但实际上,sidekiq进程被停止了。

02:01 bundler:install
      01 $HOME/.rbenv/bin/rbenv exec bundle install --path /var/www/server/shared/bundle --without development test --deployment --quiet

** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:
.........
master@f366d90)

02:03 sidekiq:stop
      01 $HOME/.rbenv/bin/rbenv exec bundle install --path /var/www/server/shared/bundle --without development test --deployment --quiet
      01 You are trying to install in deployment mode after changing
      01 your Gemfile. Run `bundle install` elsewhere and add the
      01 updated Gemfile.lock to version control.
      01 
      01 The list of sources changed
      01 
      01 You have added to the Gemfile:

我的 capfile:

require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git

require 'capistrano/rbenv'
# require 'capistrano/chruby'
require 'capistrano/rails'
#require 'capistrano/puma'
#require 'capistrano/puma/jungle'
require 'capistrano/rails/console'
require 'capistrano/sidekiq'
#require 'capistrano/sidekiq/monit'

require "whenever/capistrano"

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

deploy.rb

set :application, 'readio'
set :repo_url, 'git@github.com:eum/readio.git'
set :repository_cache, 'git_cache'
set :deploy_via, :remote_cache
set :keep_releases, 2

set :sidekiq_config, -> { File.join(current_path, 'config', 'sidekiq.yml') }

set :whenever_identifier, -> { "#{fetch(:application)}_#{fetch(:stage)}" }
set :whenever_roles, %i[admin]

set :deploy_to, '/var/www/readio_server'
set :rbenv_ruby, File.read('.ruby_version').chomp
set :bundle_bins, fetch(:bundle_bins, []).push('wkhtmltoimage')
set :ssh_options, forward_agent: true, user: 'deploy', keys: %w[~/.ssh/id_rsa], port: 8822

set :pty, false

set :rails_env, :production

set :linked_files, %w[
  config/environments/production.rb
  config/zetting.yml
  config/mongoid.yml
  config/puma.rb
]

set :linked_dirs, %w[
  log
  node_modules
  tmp/puma
  tmp/cache
  tmp/pids
  tmp/sockets
  resources
]

namespace :deploy do
  task :restart do
    on roles(:puma_app), in: :sequence, wait: 5 do
      execute "/home/deploy/.rbenv/shims/pumactl --state #{current_path}/tmp/puma/state restart"
    end
  end

  after :publishing, :restart
end

这可能是什么原因?

调用 sidekiq:stop 的原因是,在 Capfile 中,您在 Capfile 中有此要求 'capistrano/sidekiq'。请记住,Capfile ORDER 很重要。