Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'capistrano/ext/multistage'
- set :application, "hyperactive"
- set :repository, "git://git.escapegoat.org/hyperactive.git"
- set(:rails_env) { "#{stage}" }
- set :keep_releases, 2 # number of deployed releases to keep
- set :scm, :git # defaults to :subversion
- set :scm_verbose, true
- set :use_sudo, true
- set :user, "hyper"
- namespace :deploy do
- # This is my experimental solution to the problem of restarting
- # backgroundrb during deployment.
- #
- namespace :backgroundrb do
- desc "Start backgroundrb for video encoding"
- task :start do
- run "cd #{deploy_to}current; rake backgroundrb:start RAILS_ENV=#{stage}"
- end
- desc "Stop backgroundrb for video encoding"
- task :stop do
- run "cd #{deploy_to}current; rake backgroundrb:stop RAILS_ENV=#{stage}"
- end
- desc "Restart backgroundrb for video encoding"
- task :restart do
- run "cd #{deploy_to}current; rake backgroundrb:restart RAILS_ENV=#{stage}"
- end
- end # end of backgroundrb namespace
- 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
- # desc "An after-update task to copy configurations into place."
- task :after_update_code, :roles => :app do
- db_config = "#{shared_path}/database.yml.production"
- run "cp #{db_config} #{release_path}/config/database.yml"
- mods_config = "#{shared_path}/mods_enabled.list"
- run "cp #{mods_config} #{release_path}/config/mods_enabled.list"
- dk_initializer = "#{current_path}/mods/denmark/config/initializers/dk_initializer.rb"
- run "cp #{dk_initializer} #{current_path}/config/initializers/dk_initializer.rb"
- end
- desc "A task demonstrating the use of transactions."
- task :long_deploy do
- backgroundrb.stop
- transaction do
- # chown_current_to_deployment_user
- update_code
- deploy.web:disable
- symlink
- migrate
- end
- restart
- backgroundrb.start
- deploy.web:enable
- cleanup
- # chown_to_www_data
- end
- # desc "Change group to deployment user so perms on the server actually work"
- # task :chown_current_to_deployment_user, :roles => [ :app, :db, :web ] do
- # sudo "chown -R #{user}:#{user} #{current_path}/*"
- # end
- # desc "Change group to www-data"
- # task :chown_to_www_data, :roles => [ :app, :db, :web ] do
- # sudo "chown -R www-data:www-data #{deploy_to}/releases/"
- # sudo "chown -R www-data:www-data #{current_path}"
- # end
- end
Add Comment
Please, Sign In to add comment