I don't have a ~/.caprc file

My Capfile is just the default with an extra line to load config/
deploy for multistage:

load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy'

The relevant parts of my deploy.rb:

set :stages, %w(canada_prod development edge production replica
research staging)
set :default_stage, "development"

require "capistrano/ext/multistage"
require "mongrel_cluster/recipes"

#dependency checking
depend :remote, :gem, "mongrel", ">=1.1.5", :roles => [:app]
depend :remote, :gem, "memcache-client", ">=1.5.0", :roles => [:app]
depend :remote, :gem, "fb_adapter", ">=0.5.6", :roles => [:app]
depend :remote, :gem, "pdf-writer", ">=1.1.8", :roles => [:app]
depend :remote, :gem, "fb", ">=0.5.5", :roles => [:app]
depend :remote, :gem, "color-tools", ">=1.3.0", :roles => [:app]
depend :remote, :gem, "uuidtools", ">-1.0.3", :roles => [:app]
depend :remote, :command, "svn", :roles => [:app, :web]
depend :remote, :command, "apachectl", :roles => [:web]

#application variables
set :application, "ids"
set :deploy_to, "/var/www/#{application}"
set :runner, "webapp"

#database variables
set :db_adapter, "fb"
set :db_username, "blahblah"
set :db_password, Proc.new{Capistrano::CLI.password_prompt('Database
password')}
set :db_role, "blah"

#subversion
set :svn_username, Proc.new{Capistrano::CLI.ui.ask('SVN Username:')}
set :checkout, "export"

#pull a specific tag from subversion, defaults to head if nothing is
entered
desc "Specify tag to pull - defaults to Head revision if no tag is
specified"
task :before_update_code do
  set :svn_tag, Proc.new{Capistrano::CLI.ui.ask('Tag to deploy - press
enter to default to head:')}
  if "#{svn_tag}".strip.empty?
    set :repository, Proc.new{"--no-auth-cache --username
#{svn_username} " + "https://path/to/repo/trunk/projects/IDS"}
  else
    set :repository, Proc.new{"--no-auth-cache --username
#{svn_username} " + "https://path/to/repo/tags/#{svn_tag}"}
  end
end

desc "Generate mongrel_cluster.yml"
task :mongrelconf do
  mongrel_conf = <<-EOF
---
num_procs: "2"
cwd: #{current_path}
log_file: #{deploy_to}/shared/log/mongrel.log
port: #{mongrel_port}
environment: #{stage}
pid_file: #{deploy_to}/shared/pids/mongrel.pid
servers: #{mongrel_servers}
  EOF
  put mongrel_conf, "#{deploy_to}/shared/config/mongrel_cluster.yml"
end

desc "Generate database.yml"
task :dbconf do
  db_conf = <<-EOF
login: &login
  adapter: #{db_adapter}
  username: #{db_username}
  password: #{db_password}

#{stage}:
  database: #{db}
  host: #{db_host}
  role: #{db_role}
  <<: *login

test:
  #{stage}

EOF
  put db_conf, "#{deploy_to}/shared/config/database.yml"
end

desc "Places and links generated configuration files on the
application server(s)"
task :before_symlink, :roles => :app do
  sudo "mkdir -p #{deploy_to}/shared/config"
  sudo "chown -R #{uid}:#{gid} #{deploy_to}"
  sudo "chmod -R g+ws #{deploy_to}"
  dbconf
  mongrelconf

  if "#{stage}" != "production" && !File.exists?("/var/www/ids/shared/
attachments")
    sudo "mkdir -p #{deploy_to}/shared/attachments #{deploy_to}/shared/
logos"
  end

end

desc "Relink static assests for application servers"
task :after_symlink, :role => :app do
  sudo "rm -rf #{current_path}/public/attachments"
  sudo "rm -rf #{current_path}/public/logos"
  sudo "ln -nsf #{nfs_share}/attachments #{current_path}/public/
attachments"
  sudo "ln -nsf #{nfs_share}/logos #{current_path}/public/logos"
  sudo "ln -nsf #{deploy_to}/shared/config/database.yml
#{current_path}/config/database.yml"
  sudo "ln -nsf #{deploy_to}/shared/config/mongrel_cluster.yml
#{current_path}/config/mongrel_cluster.yml"
end

desc "Relink static assets for web servers"
after "after_symlink", :websymlink, :roles => :web

 task :websymlink, :roles => :web do
  sudo "rm -rf #{current_path}/public/attachments"
  sudo "rm -rf #{current_path}/public/logos"
  sudo "ln -nsf #{deploy_to}/shared/attachments #{current_path}/public/
attachments"
  sudo "ln -nsf #{deploy_to}/shared/logos #{current_path}/public/
logos"
end

And my minimal ~/config/deploy/development.rb file

role :web, "localhost"
role :app_slow, "leatherface"
role :app_fast
role :app, {:app_slow, :app_fast}

set :server_name, "localhost"

set :db_host, "localhost"
set :web_host, "127.0.0.1"

set :db, "/path/to/testdb/test.fdb"

set :mongrel_servers, 8
set :mongrel_start_port, 8100

set :nfs_share, "/path/to/nfsmount"

set :current_path, "/var/www/ids/test"


On Jul 2, 10:14 am, Jamis Buck <[EMAIL PROTECTED]> wrote:
> I can't duplicate this. Could you share more of your deploy.rb? Also,  
> the Capfile and ~/.caprc, if those have anything in them.
>
> - Jamis
>
> On Jul 2, 2008, at 10:51 AM, miss.magenta wrote:
>
>
>
> > So, I changed things around to this:
>
> > task :after_symlink, :roles => :app do
> >  sudo "rm -rf #{current_path}/public/attachments"
> >  sudo "rm -rf #{current_path}/public/logos"
> >  sudo "ln -nsf #{nfs_share}/attachments #{current_path}/public/
> > attachments"
> >  sudo "ln -nsf #{nfs_share}/logos #{current_path}/public/logos"
> >  sudo "ln -nsf /var/www/ids/shared/config/database.yml
> > #{current_path}/config/database.yml"
> >  sudo "ln -nsf #{deploy_to}/shared/config/mongrel_cluster.yml
> > #{current_path}/config/mongrel_cluster.yml"
> > end
>
> > after "after_symlink", :websymlink, :roles => :web
>
> > task :websymlink, :roles => :web do
> >  sudo "rm -rf #{current_path}/public/attachments"
> >  sudo "rm -rf #{current_path}/public/logos"
> >  sudo "ln -nsf #{deploy_to}/shared/attachments #{current_path}/public/
> > attachments"
> >  sudo "ln -nsf #{deploy_to}/shared/logos #{current_path}/public/
> > logos"
> > end
>
> > And it still executes :websymlink on both :app and :web instead of
> > just :web.
>
> >    triggering after callbacks for `after_symlink'
> >  * executing `websymlink'
> >  * executing "sudo -p 'sudo password: ' rm -rf /var/www/ids/test/
> > public/attachments"
> >    servers: ["leatherface", "localhost"]
> >    [localhost] executing command
> >    [leatherface] executing command
> >    command finished
>
> > localhost is in the :web role and leatherface, a vm on my local
> > machine, is in the :app role.
>
> > On Jul 2, 8:31 am, "miss.magenta" <[EMAIL PROTECTED]> wrote:
> >> I have one task that is scoped to :app that calls another task that  
> >> is
> >> scoped to :web.  When the second task is called, it is applied to
> >> both :app and :web instead of just :web.  Is this expected behavior?
> >> I thought in 2.4.0 and above that tasks would only act on the roles
> >> they are assigned to regardless of what role the calling task is
> >> assigned to.
>
> >> Am I missing something?
>
> >> Here are my tasks:
>
> >> desc "Relink static assets for application servers"
> >> task :after_symlink, :role => :app do
> >>   sudo "rm -rf #{current_path}/public/attachments"
> >>   sudo "rm -rf #{current_path}/public/logos"
> >>   sudo "ln -nsf #{nfs_share}/attachments #{current_path}/public/
> >> attachments"
> >>   sudo "ln -nsf #{nfs_share}/logos #{current_path}/public/logos"
> >>   sudo "ln -nsf /var/www/ids/shared/config/database.yml
> >> #{current_path}/config/database.yml"
> >>   sudo "ln -nsf #{deploy_to}/shared/config/mongrel_cluster.yml
> >> #{current_path}/config/mongrel_cluster.yml"
>
> >>   websymlink
> >> end
>
> >> desc "Relink static assets for web servers"
> >> task :websymlink, :role => :web do
> >>   sudo "rm -rf #{current_path}/public/attachments"
> >>   sudo "rm -rf #{current_path}/public/logos"
> >>   sudo "ln -nsf #{deploy_to}/shared/attachments #{current_path}/
> >> public/
> >> attachments"
> >>   sudo "ln -nsf #{deploy_to}/shared/logos #{current_path}/public/
> >> logos"
> >> end
>
>
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to