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

时间:2018-08-16 06:19:07

标签: ruby-on-rails ruby capistrano

当我使用capistrano部署我的rails应用程序时,捆绑软件安装在停止sidekiq之前,如果捆绑软件安装失败,则不应停止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:

我的上限文件:

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

有人对此有好主意吗?在此先感谢!

1 个答案:

答案 0 :(得分:1)

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