我有一个使用resque,capistrano和capistrano-resque gem的应用程序, 这是我的deploy.rb:
role :resque_worker, "webmaster@url"
role :resque_scheduler, "webmaster@url"
set :application, 'app_name'
set :repo_url, 'git@url'
set :scm, :git
set :branch, "master"
set :keep_releases, 2
set :ssh_options, { forward_agent: true }
set :workers, { "*" => 2 }
# Uncomment this line if your workers need access to the Rails environment:
set :resque_environment_task, true
set :bundle_roles, :all
set :linked_files, %w{config/database.yml config/initializers/secret_token.rb config/aws.rb}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :mkdir, "-p #{release_path.join('tmp')}"
execute :touch, release_path.join('tmp/restart.txt')
end
end
end
after "deploy:restart", "resque:restart", "resque:scheduler:restart"
当然我在gemfile中拥有所有必需的宝石,一切都运行良好,但现在每个部署都崩溃了,错误:
SSHKit::Command::Failed: kill exit status: 1
kill stdout: Nothing written
kill stderr: kill: No such process
我将* .pid添加到gitignore,但它没有帮助。
以下是更详细的输出:
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host staging.shoko-service.projects.digitalizm.com: kill exit status: 1
kill stdout: Nothing written
kill stderr: kill: No such process
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/command.rb:97:in `exit_status='
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:148:in `block (5 levels) in _execute'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `call'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:551:in `do_request'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:561:in `channel_request'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:269:in `wait'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:170:in `block (3 levels) in _execute'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `call'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:172:in `block (2 levels) in _execute'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:186:in `with_ssh'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:131:in `block in _execute'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `tap'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:128:in `_execute'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/bundler/gems/capistrano-resque-94c388e01574/lib/capistrano-resque/tasks/capistrano-resque.rake:77:in `block (5 levels) in <top (required)>'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/bundler/gems/capistrano-resque-94c388e01574/lib/capistrano-resque/tasks/capistrano-resque.rake:76:in `each_line'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/bundler/gems/capistrano-resque-94c388e01574/lib/capistrano-resque/tasks/capistrano-resque.rake:76:in `block (4 levels) in <top (required)>'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/abstract.rb:77:in `within'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/bundler/gems/capistrano-resque-94c388e01574/lib/capistrano-resque/tasks/capistrano-resque.rake:74:in `block (3 levels) in <top (required)>'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/xamenrax/.rvm/gems/ruby-2.1.1@rails-4/gems/sshkit-1.5.1/lib/sshkit/runners/parallel.rb:13:in `block (2 levels) in execute'
exectued command
INFO[ec1820b4] Running /usr/bin/env kill -s QUIT $(cat tmp/pids/resque_work_1.pid) && rm tmp/pids/resque_work_1.pid on host
DEBUG[ec1820b4] Command: cd /home/webmaster/www/host/current && /usr/bin/env kill -s QUIT $(cat tmp/pids/resque_work_1.pid) && rm tmp/pids/resque_work_1.pid
DEBUG[ec1820b4] kill: No such process