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

hging · 发布于 2014年6月06日 · 最后由 lionzixuanyuan 回复于 2014年6月06日 · 1857 次阅读
11562

执行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
>

共收到 4 条回复
3735

cap2 ? gem net-ssh ?

11562

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

11562

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

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册