views:

32

answers:

1

I'm new to deploying with Capistrano, and I'm trying the following:

deploy.rb:

set :application, "example.co.uk"

# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
set :deploy_to, "/home/example/#{application}"

# SCM Options
default_run_options[:pty] = true  # Must be set for the password prompt from git to work
ssh_options[:forward_agent] = true # Agent forwarding keys
set :repository, "[email protected]:mongeese/example.git"  # Your clone URL
set :scm, "git"
set :branch, "master"
set :deploy_via, :remote_cache
set :user, "james"  # The server's user for deploys

role :app, "example.co.uk"
role :web, "example.co.uk"
role :db,  "example.co.uk", :primary => true

set :use_sudo, false 

I get the following output:

  * executing `deploy:restart'
  * executing "/home/example/example.co.uk/current/script/process/reaper"
    servers: ["example.co.uk"]
    [example.co.uk] executing command
 ** [out :: example.co.uk] sh: /home/example/example.co.uk/current/script/process/reaper: not found
    command finished

The "james" user can sudo. If I take out :use_sudo, I get the following error:

  * executing "sudo -p 'sudo password: ' -u app /home/example/example.co.uk/current/script/process/reaper"
    servers: ["example.co.uk"]
    [example.co.uk] executing command
 ** [out :: example.co.uk] sudo: unknown user: app
    command finished

I'm obviously missing something completely, as Google only seems to turn up old results about this.

A: 

There must have been a problem with the recipes, the following override works fine:

set :application, "example.co.uk"

# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
set :deploy_to, "/home/example/#{application}"

# SCM Options
default_run_options[:pty] = true  # Must be set for the password prompt from git to work
ssh_options[:forward_agent] = true # Agent forwarding keys
set :repository, "[email protected]:example/MyRepo.git"  # Your clone URL
set :scm, "git"
set :branch, "master"
set :deploy_via, :remote_cache
set :user, "james"  # The server's user for deploys

role :app, "example.co.uk"
role :web, "example.co.uk"
role :db,  "example.co.uk", :primary => true

namespace :deploy do
  desc "Restarting mod_rails with restart.txt"
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "touch #{current_path}/tmp/restart.txt"
  end

  [:start, :stop].each do |t|
    desc "#{t} task is a no-op with mod_rails"
    task t, :roles => :app do ; end
  end
end
James Inman