0

我正在部署 Rails 应用程序并在运行时

帽部署:冷

我收到错误消息

  * 2012-11-02 23:53:26 executing `deploy:migrate'
  * executing "cd /home/mr_deployer/apps/prjct_mngr/releases/20121102225224 && bundle exec rake RAILS_ENV=production  db:migrate"
    servers: ["xxxxxxxxxx"]
    [xxxxxxxxxx] executing command
    command finished in 7464ms
  * 2012-11-02 23:53:34 executing `deploy:start'
  * executing "/etc/init.d/unicorn_prjct_mngr start"
    servers: ["xxxxxxxxxx"]
    [xxxxxxxxxx] executing command
 ** [out :: xxxxxxxxxx] /etc/init.d/unicorn_prjct_mngr: 33: cd: can't cd to /home/mr_deployer/apps/prjct_mngr/current;
    command finished in 694ms
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell '1.9.3-p125@prjct_mngr' -c '/etc/init.d/unicorn_prjct_mngr start'" on xxxxxxxxxx

但我的应用程序根在那里!为什么找不到呢?这是我的unicorn_init.sh 文件的一部分:

  1 #!/bin/sh
  2 set -e
  3 # Example init script, this can be used with nginx, too,
  4 # since nginx and unicorn accept the same signals
  5 
  6 # Feel free to change any of the following variables for your app:
  7 TIMEOUT=${TIMEOUT-60}
  8 APP_ROOT=/home/mr_deployer/apps/prjct_mngr/current
  9 PID=$APP_ROOT/tmp/pids/unicorn.pid
 10 CMD="cd $APP_ROOT; bundle exec unicorn -D -E production -c $APP_ROOT/config/unicorn.rb"
 11 # INIT_CONF=$APP_ROOT/config/init.conf
 12 AS_USER=mr_deployer
 13 action="$1"
 14 set -u
 15 
 16 # test -f "$INIT_CONF" && . $INIT_CONF
 17 
 18 old_pid="$PID.oldbin"
 19 
 20 cd $APP_ROOT || exit 1
 21 
 22 sig () {
 23   test -s "$PID" && kill -$1 `cat $PID`
 24 }
 25 
 26 oldsig () {
 27   test -s $old_pid && kill -$1 `cat $old_pid`
 28 }
 29 case $action in
 30 
 31 start)
 32   sig 0 && echo >&2 "Already running" && exit 0
 33   $CMD
 34   ;;
 35 
 36 stop)
 37   sig QUIT && exit 0
 38   echo >&2 "Not running"
 39   ;;
 40 
 41 force-stop)
 42   sig TERM && exit 0
 43   echo >&2 "Not running"
 44   ;;
 45 
 46 restart|reload)
 47   sig HUP && echo reloaded OK && exit 0
 48   echo >&2 "Couldn't reload, starting '$CMD' instead"
 49   $CMD
 50   ;;
 51 
 52 upgrade)
 53   if sig USR2 && sleep 2 && sig 0 && oldsig QUIT
 54   then
 55     n=$TIMEOUT
 56     while test -s $old_pid && test $n -ge 0
 57     do
 58       printf '.' && sleep 1 && n=$(( $n - 1 ))
 59     done
 60     echo
 61 
 62     if test $n -lt 0 && test -s $old_pid
 63     then
 64       echo >&2 "$old_pid still exists after $TIMEOUT seconds"
 65       exit 1
 66     fi
 67     exit 0
 68   fi
 69   echo >&2 "Couldn't upgrade, starting '$CMD' instead"
 70   $CMD
 71   ;;
 72 
 73 reopen-logs)
 74 sig USR1
 75 ;;
 76 
 77 *)
 78   echo >&2 "Usage: $0 <start|stop|restart|upgrade|force-stop|reopen-logs>"
 79   exit 1
 80   ;;
 81 esac

--------------------------------------

更新:

我运行了它抱怨的命令(下)

cd /home/mr_deployer/apps/prjct_mngr/current; bundle exec unicorn -D -E production -c /home/mr_deployer/apps/prjct_mngr/current/config/unicorn.rb

在我的 VPS 上,它起作用了!当我限制部署时它不起作用:冷。这是为什么?

4

1 回答 1

0

访问权限是否正确设置?您正在设置AS_USER变量,但您是否使用该用户来启动服务器?

于 2012-11-02T23:01:04.167 回答