You have not configured your deployment recipe. Edit config/
deploy.rb.
Here’s a fleshed-out example (for cap 1.4), invoked as:
cap TASK ACTION
e.g.
cap production deploy
–
Capistrano deployment
acting user
this is the login/username for your remote machines, svn repos, etc
set :user, “FOOUSER”
svn repository config… note usage of svn+ssh, alter as necessary
default deploy is trunk
to specify a tag or branch:
cap staging deploy -Sbranch=candidate-1.2.3
cap production deploy -Stag=release-1.2.3
set :base_repository, “svn+ssh://svn.FOOBAR.com/usr/local/repos/FOOBAR/
site”
if variables[:tag]
set :repository, “#{base_repository}/tags/#{variables[:tag]}”
elsif variables[:branch]
set :repository, “#{base_repository}/branches/
#{variables[:branch]}”
else
set :repository, “#{base_repository}/trunk”
end
ssh options
ssh_options[:keys] = %w(/path/to/my/key /path/to/another/key)
ssh_options[:port] = 25
production and dev/staging tagets; this is how you handle
differences in paths etc…
exa: the dev machine is a linux box, the production target is
multiple solaris zones
hosted at joyent/textdrive
production
task :production do
set :application, “FOOBAR”
set :deploy_to, “/opt/csw/yb/#{application}/”
set :mongrel_conf, “/opt/csw/yb/#{application}/shared/config/
mongrel_cluster.yml”
set :svn, “/opt/csw/bin/svn”
set :sudo, “/opt/csw/bin/sudo”
set :mongrel_rails, "/opt/csw/bin/mongrel_rails"
role :web, "FOOBAR.com"
role :app, "FOOBAR.com", "w1.FOOBAR.com", "w2.FOOBAR.com",
“w3.FOOBAR.com”, “w4.FOOBAR.com”, “w5.FOOBAR.com”, “w6.FOOBAR.com”,
“w7.FOOBAR.com”
role :db, “FOOBAR.com”, :primary => true, :no_release => true
end
dev/staging
task :stage do
set :application, “FOOBAR”
set :deploy_to, “/var/rails/#{application}/”
set :mongrel_conf, “/var/rails/#{application}/shared/config/
mongrel_cluster.yml”
set :svn, “/usr/local/bin/svn”
set :sudo, “/usr/bin/sudo”
set :mongrel_rails, “/usr/local/bin/mongrel_rails”
role :web, "dev.FOOBAR.com"
role :app, "dev.FOOBAR.com"
role :db, "dev.FOOBAR.com", :primary =>
true, :no_release=>true
end
desc “things to do after the initial setup”
task :after_setup do
run “mkdir #{shared_path}/images”
run “mkdir #{shared_path}/config”
end
desc “”
task :before_update_code, :role => :app do
ENV[‘REASON’] = “scheduled maintenance”
ENV[‘UNTIL’] = (Time.now + 600).to_s
end
desc “things to do after the code update, before a migration and/or
restart”
task :after_update_code, :role => :app do
upon first depoyment, these will not exist in shared, so we copy
them if not present in shared
unless File.exist? “#{shared_path}/config/backgroundrb.yml”
run “cp #{release_path}/config/backgroundrb.yml
#{shared_path}/config/backgroundrb.yml”
end
unless File.exist? “#{shared_path}/config/database.yml”
run “cp #{release_path}/config/database.yml #{shared_path}/
config/database.yml”
end
unless File.exist? “#{shared_path}/config/mongrel_cluster.yml”
run “cp #{release_path}/config/mongrel_cluster.yml
#{shared_path}/config/mongrel_cluster.yml”
end
end
desc “”
task :before_symlink, :role => :app do
solaris ln oddity(?) – subsequent symlinks wind up IN current,
not replacing it
run “rm -f #{deploy_to}/current”
end
desc “after the release/current symlink is set, restore links to
shared config files”
task :after_symlink, :role => :app do
run “rm -f #{deploy_to}/current/config/backgroundrb.yml”
run “ln -s #{shared_path}/config/backgroundrb.yml #{deploy_to}/
current/config/backgroundrb.yml”
run “rm -f #{deploy_to}/current/config/mongrel_cluster.yml”
run “ln -s #{shared_path}/config/mongrel_cluster.yml #{deploy_to}/
current/config/mongrel_cluster.yml”
run “rm -f #{deploy_to}/current/config/database.yml”
run “ln -s #{shared_path}/config/database.yml #{deploy_to}/current/
config/database.yml”
end
desc “update code from svn w/o creating a new deployment… migrate
and restart”
task :soft_deploy do
transaction do
run “cd #{deploy_to}/current/app; #{svn} up”
run “cd #{deploy_to}/current/script; #{svn} up”
run “cd #{deploy_to}/current/public; #{svn} up”
run “cd #{deploy_to}/current/vendor; #{svn} up”
run “cd #{deploy_to}/current/lib; #{svn} up”
run “cd #{deploy_to}/current/db; #{svn} up”
run “cd #{deploy_to}/current/test; #{svn} up”
run “cd #{deploy_to}/current/config/; #{svn} up environment.rb”
run “cd #{deploy_to}/current/config/environments; #{svn} up
production.rb”
migrate
end
restart
end
–
On Sep 6, 9:22 am, Jim N. [email protected]