Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

Johan S�rensen http://johansorensen.com

« Newer Snippets
Older Snippets »
1 total  XML / RSS feed 

Solaris Capistrano deploy.rb

// capiwhatisit recipe for solaris
// most important thing is overriding some tasks to use GNU ln, since solaris' ln are subtly different

set :application, "awesomeapp"
set :repository, "http://example.com/repos/#{application}/trunk"

role :web, "foo.com"
role :app, "bar.com"
role :db,  "baz.com", :primary => true

set :deploy_to, "/path/to/app"
set :user, "appuser"
set :svn, "/opt/csw/bin/svn"
set :rake, "/opt/csw/bin/rake"
set :mongrel_config, "#{deploy_to}/shared/config/mongrel_cluster.yml"

set :use_sudo, false

desc "The spinner task is used by :cold_deploy to start the application up"
task :spinner, :roles => [:web, :app, :node] do
  run "/opt/csw/bin/mongrel_rails cluster::start -C #{mongrel_config}" # or SMF
end

desc "Restart the Mongrel processes on the app server."
task :restart, :roles => [:web, :app, :node] do
  run "/opt/csw/bin/mongrel_rails cluster::restart -C #{mongrel_config}" # or SMF
end

desc "Symlinks the database.yml into the current release"
task :after_update_code, :roles => [:web, :app, :node] do
    run "/opt/csw/bin/gln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end

# Run rake migrate after the symlinking has been done, just because I'm a lazy bum
task :after_symlink, :roles => :db do
  backup
  migrate
end

# =====================================================================================
# = Overriding these tasks because we need to use GNU ln and need the full path to it =

desc <<-DESC
Update the 'current' symlink to point to the latest version of
the application's code. Using GNU ln
DESC
task :symlink, :roles => [:app, :db, :web, :node] do
  on_rollback { run "/opt/csw/bin/gln -nfs #{previous_release} #{current_path}" }
  run "/opt/csw/bin/gln -nfs #{current_release} #{current_path}"
end

desc <<-DESC
Rollback the latest checked-out version to the previous one by fixing the
symlinks and deleting the current release from all servers.
DESC
task :rollback_code, :roles => [:app, :db, :web] do
  if releases.length < 2
    raise "could not rollback the code because there is no prior release"
  else
    run <<-CMD
      /opt/csw/bin/gln -nfs #{previous_release} #{current_path} &&
      rm -rf #{current_release}
    CMD
  end
end



« Newer Snippets
Older Snippets »
1 total  XML / RSS feed