pl1nk
pl1nk

Reputation: 1972

Capistrano deploy:setup works but not deploy:check

Testing capistrano with a simple recipe.

$ cap deploy:setup
  * executing `deploy:setup'
  * executing "sudo -p 'sudo password: ' mkdir -p /u/apps/ [..]
    [..]

deploy:setup works as exprected.

However

$ cap deploy:check
  * executing `deploy:check'
  * executing "test -d /u/apps/[..]
    [..]

When running deploy:check I get the following error:

The following dependencies failed. Please check them and try again:
--> You do not have permissions to write to `/u/apps/
[..]
--> `/u/apps/app/shared is not writable [..]

It seems that capistrano is not using sudo while in deploy:check mode.

I don't get it!

While in deploy:setup the whole directory structure was created by capistrano without any issue?

Why capistrano doesn't use sudo as in deploy:check?

Upvotes: 3

Views: 1079

Answers (2)

Dan Caddigan
Dan Caddigan

Reputation: 1598

I also ran into this issue and it turned out capistrano was creating all of the folders under the <user> group except for the shared folder. SSH onto your server and do a long listing ls -l. If you see - root - root - for the shared folder, you'll just need to update the permissions on the folder:

sudo chown <user> shared
sudo chgrp <user> shared

Upvotes: 2

Marius Butuc
Marius Butuc

Reputation: 18250

I ran into the same issue: the trick is to explicitly configure Capistrano not to use sudo.
You can turn that off in your deploy.rb file with:

set :use_sudo, false

If you need to use sudo, how about using the sudo DSL Action Invocation in your commands:

run "#{sudo} apachectl restart"

Upvotes: 1

Related Questions