How to debug while deploying in capistrano?

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 installing the gem file / bundle.

How is it possible to get a more verbose error log where I can see exactly where the problem is.

+3


source to share


1 answer


it looks like you ran one of the commands with sudo

, this will result in incorrect permissions for /var/www/app/shared/cached-copy/.git/FETCH_HEAD

, the easiest fix will most likely be to clear the entire directory:

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

      



If the problem persists for other directories, try:

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

      

+2


source







All Articles