在部署capistrano时如何调试?

时间:2022-04-11 07:25:10

I am getting this error when deploying to production server:

我在部署到生产服务器时出现了这个错误:

$ cap production deploy
    triggering load callbacks
  * ←[32m2013-02-16 00:06:00 executing `production'←[0m
    triggering start callbacks for `deploy'
  * ←[32m2013-02-16 00:06:00 executing `multistage:ensure'←[0m
  * ←[32m2013-02-16 00:06:00 executing `deploy'←[0m
  * ←[32m2013-02-16 00:06:00 executing `deploy:update'←[0m
 ** transaction: start
  * ←[32m2013-02-16 00:06:00 executing `deploy:update_code'←[0m
    updating the cached checkout on all servers
    ←[33mexecuting locally: "git ls-remote git@github.com:user/app.git
production"←[0m
    ←[2;37mcommand finished in 3350ms←[0m
  * ←[33mexecuting "if [ -d /var/www/app/shared/cached-copy ]; then cd /var/
www/app/shared/cached-copy && git fetch -q origin && git fetch --tags -q ori
gin && git reset -q --hard f736340ecbsadasd948234f370c9d2bb && git clean
 -q -d -x -f; else git clone -q git@github.com:user/app.git /var/www/app/shared/cached-copy && cd /var/www/app/shared/cached-copy && git checko
ut -q -b deploy f736340ecasdsadasf795761f370c9d2bb; fi"←[0m
    servers: ["x"]
Password:
    [x] executing command
 ** ←[31m[x :: out] error: cannot open .git/FETCH_HEAD: Permission d
enied←[0m
    ←[2;37mcommand finished in 570ms←[0m
*** [←[34mdeploy:update_code←[0m] ←[34mrolling back←[0m
  * ←[33mexecuting "rm -rf /var/www/app/releases/20130215230611; true"←[0m
    servers: ["x"]
    [x] executing command
    ←[2;37mcommand finished in 176ms←[0m
failed: "sh -c 'if [ -d /var/www/app/shared/cached-copy ]; then cd /var/www/
app/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin
&& git reset -q --hard f736340342af1bsad79453761f370c9d2bb && git clean -q
-d -x -f; else git clone -q git@github.com:user/app.git /var/www/app
o/shared/cached-copy && cd /var/www/app/shared/cached-copy && git checkout -
q -b deploy f736340ecb6af1bgaasd5549d2bb; fi'" on x
$

But the error is not that important it just tells me that there is a problem with the gem file/bundle install.

但是错误并不重要,它只是告诉我gem文件/bundle安装存在问题。

How is it possible get an more detailed error log, where I can see precise where the problem lies.

怎么可能得到一个更详细的错误日志,在那里我可以看到问题的确切位置。

1 个解决方案

#1


2  

it looks like you have ran one of the commands with sudo, this lead to wrong permissions for /var/www/app/shared/cached-copy/.git/FETCH_HEAD, the easiest fix would be most likely to clean whole directory:

看起来您已经使用sudo运行了其中一个命令,这导致了/var/www/app/shared/cached-copy/的错误权限。git/FETCH_HEAD,最简单的修复方法是清理整个目录:

sudo rm -rf /var/www/app/shared/cached-copy

If the problem repeats for other directories then try:

如果其他目录的问题重复出现,请尝试:

sudo chown -R $USER: /var/www/app

#1


2  

it looks like you have ran one of the commands with sudo, this lead to wrong permissions for /var/www/app/shared/cached-copy/.git/FETCH_HEAD, the easiest fix would be most likely to clean whole directory:

看起来您已经使用sudo运行了其中一个命令,这导致了/var/www/app/shared/cached-copy/的错误权限。git/FETCH_HEAD,最简单的修复方法是清理整个目录:

sudo rm -rf /var/www/app/shared/cached-copy

If the problem repeats for other directories then try:

如果其他目录的问题重复出现,请尝试:

sudo chown -R $USER: /var/www/app