简体   繁体   中英

bundle install failed but still stop sidekiq when use capistrano deploy

When I use capistrano to deploy my rails app, the bundle install before stop sidekiq, when bundle install failed, the sidekiq should not be stopped, but in fact, the sidekiq process is stopped.

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:

my 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

What could be the reason for this?

The reason sidekiq:stop is being called is, in Capfile you have this require 'capistrano/sidekiq' in your Capfile . Keep in mind, in Capfile ORDER matters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM