新手问题 Capistrano + Nginx + Unicorn 部署报错

hging · June 06, 2014 · Last by lionzixuanyuan replied at June 06, 2014 · 3690 hits

执行 bundle exec cap production deploy 时候,执行到最后的** Execute unicorn:duplicate 执行失败。

cap aborted!
DEBUG [39d8e2fb]    master failed to start, check stderr log for details
if [ -e /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid ] && kill -0 `cat /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid` > /dev/null 2>&1; then echo "Duplicating Unicorn..."; kill -s USR2 `cat /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid`; else if [ -e "/u/apps/rongyi_term_nanshan/current/config/unicorn.rb" ]; then UNICORN_CONFIG_PATH=/u/apps/rongyi_term_nanshan/current/config/unicorn.rb; else if [ -e "/u/apps/rongyi_term_nanshan/current/config/unicorn/production.rb" ]; then UNICORN_CONFIG_PATH=/u/apps/rongyi_term_nanshan/current/config/unicorn/production.rb; else echo "Config file for "production" environment was not found at either "/u/apps/rongyi_term_nanshan/current/config/unicorn.rb" or "/u/apps/rongyi_term_nanshan/current/config/unicorn/production.rb""; exit 1; fi; fi; if [ -e "/u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid" ]; then if kill -0 `cat /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid` > /dev/null 2>&1; then echo "Unicorn is already running!"; exit 0; fi; rm /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid; fi; echo "Starting Unicorn..."; cd /u/apps/rongyi_term_nanshan/current/ && RAILS_ENV=production BUNDLE_GEMFILE= /usr/local/rvm/bin/rvm 2.0.0-p353 do bundle exec unicorn -c $UNICORN_CONFIG_PATH -E deployment -D ; fi; stdout: Nothing written
if [ -e /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid ] && kill -0 `cat /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid` > /dev/null 2>&1; then echo "Duplicating Unicorn..."; kill -s USR2 `cat /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid`; else if [ -e "/u/apps/rongyi_term_nanshan/current/config/unicorn.rb" ]; then UNICORN_CONFIG_PATH=/u/apps/rongyi_term_nanshan/current/config/unicorn.rb; else if [ -e "/u/apps/rongyi_term_nanshan/current/config/unicorn/production.rb" ]; then UNICORN_CONFIG_PATH=/u/apps/rongyi_term_nanshan/current/config/unicorn/production.rb; else echo "Config file for "production" environment was not found at either "/u/apps/rongyi_term_nanshan/current/config/unicorn.rb" or "/u/apps/rongyi_term_nanshan/current/config/unicorn/production.rb""; exit 1; fi; fi; if [ -e "/u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid" ]; then if kill -0 `cat /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid` > /dev/null 2>&1; then echo "Unicorn is already running!"; exit 0; fi; rm /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid; fi; echo "Starting Unicorn..."; cd /u/apps/rongyi_term_nanshan/current/ && RAILS_ENV=production BUNDLE_GEMFILE= /usr/local/rvm/bin/rvm 2.0.0-p353 do bundle exec unicorn -c $UNICORN_CONFIG_PATH -E deployment -D ; fi; stderr: Nothing written
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/sshkit-1.3.0/lib/sshkit/command.rb:94:in `exit_status='
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:142:in `block (4 levels) in _execute'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:551:in `call'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:551:in `do_request'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:561:in `channel_request'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:205:in `process'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:269:in `wait'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:164:in `block (2 levels) in _execute'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:514:in `call'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:205:in `process'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:166:in `block in _execute'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `tap'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `_execute'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:66:in `execute'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/bundler/gems/capistrano-unicorn-bf75a238fde0/lib/capistrano/tasks/unicorn.cap:121:in `block (3 levels) in <top (required)>'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `run'
/home/gong/.rvm/gems/ruby-2.0.0-p353@rongyi_term/gems/sshkit-1.3.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => unicorn:duplicate
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Command::Failed: if [ -e /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid ] && kill -0 `cat /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid` > /dev/null 2>&1; then echo "Duplicating Unicorn..."; kill -s USR2 `cat /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid`; else if [ -e "/u/apps/rongyi_term_nanshan/current/config/unicorn.rb" ]; then UNICORN_CONFIG_PATH=/u/apps/rongyi_term_nanshan/current/config/unicorn.rb; else if [ -e "/u/apps/rongyi_term_nanshan/current/config/unicorn/production.rb" ]; then UNICORN_CONFIG_PATH=/u/apps/rongyi_term_nanshan/current/config/unicorn/production.rb; else echo "Config file for "production" environment was not found at either "/u/apps/rongyi_term_nanshan/current/config/unicorn.rb" or "/u/apps/rongyi_term_nanshan/current/config/unicorn/production.rb""; exit 1; fi; fi; if [ -e "/u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid" ]; then if kill -0 `cat /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid` > /dev/null 2>&1; then echo "Unicorn is already running!"; exit 0; fi; rm /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid; fi; echo "Starting Unicorn..."; cd /u/apps/rongyi_term_nanshan/current/ && RAILS_ENV=production BUNDLE_GEMFILE= /usr/local/rvm/bin/rvm 2.0.0-p353 do bundle exec unicorn -c $UNICORN_CONFIG_PATH -E deployment -D ; fi; stdout: Nothing written
if [ -e /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid ] && kill -0 `cat /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid` > /dev/null 2>&1; then echo "Duplicating Unicorn..."; kill -s USR2 `cat /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid`; else if [ -e "/u/apps/rongyi_term_nanshan/current/config/unicorn.rb" ]; then UNICORN_CONFIG_PATH=/u/apps/rongyi_term_nanshan/current/config/unicorn.rb; else if [ -e "/u/apps/rongyi_term_nanshan/current/config/unicorn/production.rb" ]; then UNICORN_CONFIG_PATH=/u/apps/rongyi_term_nanshan/current/config/unicorn/production.rb; else echo "Config file for "production" environment was not found at either "/u/apps/rongyi_term_nanshan/current/config/unicorn.rb" or "/u/apps/rongyi_term_nanshan/current/config/unicorn/production.rb""; exit 1; fi; fi; if [ -e "/u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid" ]; then if kill -0 `cat /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid` > /dev/null 2>&1; then echo "Unicorn is already running!"; exit 0; fi; rm /u/apps/rongyi_term_nanshan/current/tmp/pids/unicorn.pid; fi; echo "Starting Unicorn..."; cd /u/apps/rongyi_term_nanshan/current/ && RAILS_ENV=production BUNDLE_GEMFILE= /usr/local/rvm/bin/rvm 2.0.0-p353 do bundle exec unicorn -c $UNICORN_CONFIG_PATH -E deployment -D ; fi; stderr: Nothing written
>

cap2 ? gem net-ssh ?

#1 楼 @smallX capistrano3 的.... 之前一直都没问题,今天稀里糊涂不能部署了。

各位看官 - - 非常感谢。问题已经解决。是因为同事注释代码的时候少注释掉一个 end..在 development 环境没问题,部署正式就出问题了。我在想要不要艾特一下那个人-,- 纠结了我整整一下午....

You need to Sign in before reply, if you don't have an account, please Sign up first.