Ticket #44 (assigned defect)

Opened 10 months ago

Last modified 10 months ago

default group and user assumptions cause failures during deploy:setup

Reported by: zippy Assigned to: mbailey (accepted)
Priority: major Milestone:
Component: recipes Version: 1.99
Keywords: 1.99 Cc:

Description

deploy:setup fails (when trying to create the application directories) under the default values of user and group. See the trace below.

The question here is really what the user assumptions should be. This trace is on a project with a Capfile that only has "require 'deprec'" added to it, and uses the default deploy.rb installed by capify with very little modification.

Prior to running deploy:setup I've created a user 'eric' as an admin (as describe in README.slicehost), which is the user being used. deploy.rb doesn't set a user. So the conflict clearly comes because cap is logging in as 'eric' but is trying to create the files as deploy.

Perhaps this will all go away when deprec -A has been updated for deprec2.

But this raises another issue about deprec2.mkdir which I'll make a separate ticket for.

eric% cap deploy:setup
    triggering before callbacks for `deploy:setup'
  * executing `deprec:rails:setup_user_perms'
  * executing "sudo -p 'sudo password: ' grep 'deploy:' /etc/group || sudo /usr/sbin/groupadd deploy"
    servers: ["myserver.com"]
    [myserver.com] executing command
Password: 
*** [err :: myserver.com] 
 ** [out :: myserver.com] deploy:x:1002:
    command finished
  * executing "sudo -p 'sudo password: ' groups eric | grep ' deploy ' || sudo /usr/sbin/usermod -G deploy -a eric"
    servers: ["myserver.com"]
    [myserver.com] executing command
    command finished
  * executing `deprec:rails:setup_paths'
  * executing "sudo -p 'sudo password: ' sh -c 'test -d /var/www/apps/rubyom || mkdir -p /var/www/apps/rubyom'"
    servers: ["myserver.com"]
    [myserver.com] executing command
    command finished
  * executing "sudo -p 'sudo password: ' chmod 0775 /var/www/apps/rubyom"
    servers: ["myserver.com"]
    [myserver.com] executing command
    command finished
  * executing "sudo -p 'sudo password: ' grep 'deploy:' /etc/group || sudo /usr/sbin/groupadd deploy"
    servers: ["myserver.com"]
    [myserver.com] executing command
 ** [out :: myserver.com] deploy:x:1002:eric
    command finished
  * executing "sudo -p 'sudo password: ' chgrp -R deploy /var/www/apps/rubyom"
    servers: ["myserver.com"]
    [myserver.com] executing command
    command finished
  * executing "sudo -p 'sudo password: ' sh -c 'test -d /var/www/apps/rubyom/shared || mkdir -p /var/www/apps/rubyom/shared'"
    servers: ["myserver.com"]
    [myserver.com] executing command
    command finished
  * executing "sudo -p 'sudo password: ' chmod 0775 /var/www/apps/rubyom/shared"
    servers: ["myserver.com"]
    [myserver.com] executing command
    command finished
  * executing "sudo -p 'sudo password: ' grep 'deploy:' /etc/group || sudo /usr/sbin/groupadd deploy"
    servers: ["myserver.com"]
    [myserver.com] executing command
 ** [out :: myserver.com] deploy:x:1002:eric
    command finished
  * executing "sudo -p 'sudo password: ' chgrp -R deploy /var/www/apps/rubyom/shared"
    servers: ["myserver.com"]
    [myserver.com] executing command
    command finished
  * executing `deprec:rails:setup_shared_dirs'
  * executing `deploy:setup'
  * executing "umask 02 && mkdir -p /var/www/apps/rubyom /var/www/apps/rubyom/releases 
/var/www/apps/rubyom/shared /var/www/apps/rubyom/shared/system /var/www/apps/rubyom/shared/log 
/var/www/apps/rubyom/shared/pids"
    servers: ["myserver.com"]
    [myserver.com] executing command
*** [err :: myserver.com] mkdir: cannot create directory `/var/www/apps/rubyom/releases': Permission denied
*** [err :: myserver.com] mkdir: cannot create directory `/var/www/apps/rubyom/shared/system': Permission denied
*** [err :: myserver.com] mkdir: cannot create directory `/var/www/apps/rubyom/shared/log': Permission denied
*** [err :: myserver.com] mkdir: cannot create directory `/var/www/apps/rubyom/shared/pids': Permission denied
    command finished
command "umask 02 && mkdir -p /var/www/apps/rubyom /var/www/apps/rubyom/releases 
/var/www/apps/rubyom/shared /var/www/apps/rubyom/shared/system /var/www/apps/rubyom/shared/log
/var/www/apps/rubyom/shared/pids" failed on myserver.com

Change History

01/31/08 03:09:20 changed by zippy

Actually the issue in deprec2.mkdir isn't really an issue. Is there a way to edit the original ticket contents for a ticket I submitted?

01/31/08 19:36:23 changed by mbailey

  • owner changed from somebody to mbailey.

Yes, you should be able to edit the ticket contents in "Change Properties" fieldset of the same form you submit comments through.

01/31/08 21:45:09 changed by mbailey

  • status changed from new to assigned.

Capistrano's :user defaults to the $USER environment variable. So you'll usually be logging in using the same username as on your local box.

The issue here appears to be that deploy:setup tries to create some dirs using your regular user. This user has just been added to the deploy group so should be able to create these directories but not until it starts a new session.

I'll look up how to kill the ssh session and start a new one during a task.

(in reply to: ↑ description ) 02/02/08 01:03:05 changed by zippy

  • version set to 1.99.

02/03/08 13:17:00 changed by mbailey

  • component changed from component1 to recipes.

02/06/08 12:36:22 changed by zippy

As a work-around I simply re-run the deploy:setup again, and it worked fine. This could be documented.