Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## some basic tasks
- require 'palmtree/recipes/mongrel_cluster'
- # == RUBY GEMS =================================================================
- namespace :ruby_gems do
- desc "Updates RubyGems version"
- task :update_system do
- sudo "gem update --system"
- end
- desc "Install a RubyGem from remote source"
- task :install do
- puts "USAGE: GEM=gemname cap gems_install" and next unless ENV['GEM']
- sudo "gem install #{ENV['GEM']} --no-ri --no-rdoc"
- end
- end
- # == NGINX =====================================================================
- namespace :nginx do
- desc "Start Nginx on the app server."
- task :start, :roles => :app do
- sudo "/etc/init.d/nginx start"
- end
- desc "Restart the Nginx processes on the app server by starting and stopping the cluster."
- task :restart , :roles => :app do
- sudo "/etc/init.d/nginx restart"
- end
- desc "Stop the Nginx processes on the app server."
- task :stop , :roles => :app do
- sudo "/etc/init.d/nginx stop"
- end
- end
- # == BACKGROUNDRB ==============================================================
- namespace :drb do
- desc 'Start backgroundrb'
- task :start, :roles => :app do
- run "#{current_path}/script/backgroundrb start"
- end
- desc 'Stop backgroundrb'
- task :stop, :roles => :app do
- run "#{current_path}/script/backgroundrb stop"
- end
- desc 'Restart backgroundrb'
- task :restart, :roles => :app do
- stop
- start
- end
- end
- # == MONGREL ===================================================================
- namespace :deploy do
- desc "Start mongrel cluster"
- task :start, :roles => :app do
- run "cd #{current_path} && sudo mongrel_rails cluster::start"
- end
- desc "Stop mongrel cluster"
- task :stop, :roles => :app do
- run "cd #{current_path} && sudo mongrel_rails cluster::stop"
- end
- desc "Restart mongrel cluster"
- task :restart, :roles => :app do
- run "cd #{current_path} && sudo mongrel_rails cluster::restart"
- end
- end
- # == CONFIG ====================================================================
- namespace :init do
- namespace :config do
- desc "Create database.yml"
- task :database do
- set :db_host, Capistrano::CLI.ui.ask("database host: ")
- set :db_user, Capistrano::CLI.ui.ask("database user: ")
- set :db_pass, Capistrano::CLI.password_prompt("database password: ")
- database_configuration =<<-EOF
- ---
- production:
- adapter: mysql
- database: #{application}
- host: #{db_host}
- username: #{db_user}
- password: #{db_pass}
- EOF
- run "mkdir -p #{shared_path}/config"
- put database_configuration, "#{shared_path}/config/database.yml"
- end
- desc "Symlink shared configurations to current"
- task :localize, :roles => [:app] do
- %w[memcached.yml mongrel_cluster.yml gateway.yml amazon_s3.yml amazon_sqs.yml database.yml backgroundrb.yml].each do |f|
- run "rm -f #{current_path}/config/#{f}"
- run "ln -nsf #{shared_path}/config/#{f} #{current_path}/config/#{f}"
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment