views:

124

answers:

2

This is my first time trying to set up capistrano to deploy a rails application. I am deploying from my local machine to my remote server that has the repo, web, app, and mysql servers all on the same machine. I am following this walk through: http://www.capify.org/index.php/From_The_Beginning

I get to the command

cap deploy:start

Then I get this error:

*** [err :: example.com] sudo: unknown user: app
   command finished
failed: "sh -c 'cd /var/www/example/current && sudo -p '\\''sudo password: '\\'' -u app nohup script/spin'" on example.com

Am I supposed to add an 'app' user, or is there a way of changing what user the command runs as?

This is my deploy.rb:

set :application, "example"
set :repository,  "[email protected]:example.git"
set :user, "trobrock"
set :branch, 'master'

set :deploy_to, "/var/www/example"

set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`

role :web, "example.com"                           # Your HTTP server, Apache/etc
role :app, "example.com"                           # This may be the same as your `Web` server
role :db,  "example.com", :primary => true         # This is where Rails migrations will run

And obviously everywhere it says example.com is my servers hostname and every it just says example is the app name.

A: 

The failed command is trying to sudo. Perhaps you should set use_sudo to false

set :use_sudo, false 

I get a similar exception when this is not set to false

Good luck

magagnon
A: 

I think that you'll find that the 'runner' your application is using for this command is defaulting to 'app'. As you've got the :user set, I imagine that you either need to set :runner or :admin runner to 'trobrock'. For more information, see the blog post on runners. The syntax will be something like:

set :runner, 'trobrock'
set :admin_runner, 'trobrock'

I think you'll find that :runner is what you're after.

That said, it looks like deploy:start is deprecated and shouldn't be used. I've certainly been overriding it for ages now in all recipes. Since you've got as far as setting up your deployment, I'd suggest just jumping into 'cap deploy' and seeing what happens.

If you have any further issues, feel free to ping me when you've posted a new question :)

Sam Phillips