The checkout is never run via sudo. You need to make sure the
permissions on the directories created by deploy:setup are such that
your deploy user can create files in them without using sudo.
- Jamis
On 2/28/09 7:50 AM, j0llyr0g3r wrote:
> Hey guys,
>
> i am fairly new to capistrano.
>
> I am desperately trying to deploy a freshly created git-project to a
> totally empty directory on my test-server.
> So far, this has been a friggin nightmare unfortunately:
> - the code checkout itself fails no matter what i am trying
> - the error messages i get back are weird and not helpfull at all.
>
> Here is my deploy.rb (without tasks since the code checkout itself is
> not working):
>
> #############################################################
> # Application
> #############################################################
>
> set :application, "addloops"
> set :deploy_to, "/var/www/#{application}"
>
> #############################################################
> # Settings
> #############################################################
>
> set :use_sudo, true
> set :port, xxxx
>
> #############################################################
> # Servers
> #############################################################
>
> set :user, 'xxxx'
> set :password, 'xxxxx'
> role :app, "addloops.com"
> role :web, "addloops.com"
> role :db, "addloops.com", :primary => true
>
>
> #############################################################
> # SCM
> #############################################################
>
> set :scm, :git
> set :repository, "."
> set :deploy_via, :checkout
> #set :branch, "master"
>
> Now, a 'cap deploy:setup' is ok:
>
> ----Server------
> ls -al /var/www/addloops/
> total 8
> drwxrwxrwx 2 www-data root 4096 2009-02-28 15:41 .
> drwxr-xr-x 5 root root 4096 2009-02-27 14:12 ..
>
> -----Client-----
> cap deploy:setup
> * executing `deploy:setup'
> * executing "sudo -p 'sudo password: ' mkdir -p /var/www/addloops /
> var/www/addloops/releases /var/www/addloops/shared /var/www/addloops/
> shared/system /var/www/addloops/shared/log /var/www/addloops/shared/
> pids && sudo -p 'sudo password: ' chmod g+w /var/www/addloops /var/www/
> addloops/releases /var/www/addloops/shared /var/www/addloops/shared/
> system /var/www/addloops/shared/log /var/www/addloops/shared/pids"
> servers: ["addloops.com"]
> [addloops.com] executing command
> command finished
>
> -----Server again--------
> ls -al /var/www/addloops/
> total 16
> drwxrwxrwx 4 www-data root 4096 2009-02-28 15:42 .
> drwxr-xr-x 5 root root 4096 2009-02-27 14:12 ..
> drwxrwxr-x 2 root root 4096 2009-02-28 15:42 releases
> drwxrwxr-x 5 root root 4096 2009-02-28 15:42 shared
>
> -> Ok, so that went fine.
>
> But the checkout fails:
>
> cap deploy:cold
> * executing
> `deploy:cold'
> * executing
> `deploy:update'
> ** transaction:
> start
> * executing
> `deploy:update_code'
> executing locally: "git ls-remote .
> HEAD"
> * executing "git clone -q . /var/www/addloops/releases/
> 20090228144319 && cd /var/www/addloops/releases/20090228144319 && git
> checkout -q -b deploy 287dc08148f7ebcc271b82687b3704cf539115de &&
> (echo 287dc08148f7ebcc271b82687b3704cf539115de > /var/www/addloops/
> releases/20090228144319/
> REVISION)"
> servers:
> ["addloops.com"]
> [addloops.com] executing
> command
> ** [addloops.com :: err]
> mkdir:
> ** [addloops.com :: err] cannot create directory `/var/www/addloops/
> releases/
> 20090228144319'
> ** [addloops.com :: err] : Permission
> denied
> ** [addloops.com ::
> err]
> ** [addloops.com :: err] usage: git-clone [options] [--] <repo>
> [<dir>]
> ** [addloops.com ::
> err]
> ** [addloops.com ::
> err]
> ** [addloops.com :: err] -
> n
> ** [addloops.com ::
> err] ,
> ** [addloops.com :: err] --no-
> checkout
> ** [addloops.com :: err] don't create a
> checkout
> ** [addloops.com ::
> err]
> ** [addloops.com :: err] --
> bare
> ** [addloops.com :: err] create a bare
> repository
> ** [addloops.com ::
> err]
> ** [addloops.com :: err] --
> naked
> ** [addloops.com :: err] create a bare
> repository
> ** [addloops.com ::
> err]
> ** [addloops.com :: err] -
> l
> ** [addloops.com ::
> err] ,
> ** [addloops.com :: err] --
> local
> ** [addloops.com :: err] to clone from a local repository
>
> The problem seems to be:
>
> cannot create directory `/var/www/addloops/releases/
> 20090228144319'
>
> which is odd, because my specified user can do anything with sudo
> (even without password for testing purposes):
>
> On the server:
>
> sudo mkdir /var/www/addloops/releases/20090228144319
>
> -> is working!
>
> Now, since the error message is completely useless to me, i can only
> speculate what's going wrong here.
>
> - maybe this:
> set :repository, "."
> in my deploy.rb? (when i execute capistrano i am within my local git-
> repo)
> - or maybe this:
> set :deploy_via, :checkout
> ?
>
> Any help would be greatly appreciated since i am totally stuck.......
>
> >
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---