## # EXPERIMENTAL! Use at your own risk. # # For use with Capistrano 2.1 or later. # http://capify.org # # See also # # http://peepcode.com/products/capistrano-2 # http://topfunky.net/svn/plugins/peepserver # # Provided without any warranty by Topfunky Corporation http://topfunky.com # PeepCode Screencasts http://peepcode.com # # Works best if you have a passwordless SSH key installed between # the production server and the git server. # ============================================================================= # REQUIRED VARIABLES # ============================================================================= set :application, "example.com" set :domain, "example.com" set :rails_env, "production" set :deploy_to, "/var/www/apps/#{application}" set :user, "deploy" set :scm, :git set :repository, "#{user}@site.com:/var/git/#{application}" # Git repository set :repository_cache, "git_master" set :deploy_via, :remote_cache # set :branch, "origin/capistrano" # set :scm_command, "/usr/local/bin/git" # Automatically symlink these directories from curent/public to shared/public. set :app_symlinks, %w(files) set :rails_config_files, %w(database.yml mailer.yml) # ============================================================================= # ROLES # ============================================================================= role :web, domain role :app, domain role :db, domain, :primary => true # ============================================================================= # MONGREL OPTIONS # ============================================================================= set :mongrel_config, "/etc/mongrel_cluster/#{application}.conf" # ============================================================================= # Overrides and callbacks # ============================================================================= # NOTE You must create shared/config and save your production config files there. after "deploy:update_code", "deploy:copy_config_files" namespace :deploy do desc "Copy config files from shared/config to release dir" task :copy_config_files do rails_config_files.each do |filename| run "cp #{shared_path}/config/#{filename} #{release_path}/config/#{filename}" end end task :restart do sudo "mongrel_rails cluster::restart -C #{mongrel_config}" end end # ============================================================================= # Custom Tasks. Use at your own risk. # ============================================================================= desc "Stream log for the environment specified with :rails_env" task :stream_log, :roles => :app do stream "tail -f #{shared_path}/log/#{rails_env}.log" end desc "Analyze Rails Log instantaneously" task :pl_analyze, :roles => :app do run "pl_analyze #{shared_path}/log/#{rails_env}.log" do |ch, st, data| print data end end desc "Run rails_stat" task :rails_stat, :roles => :app do stream "rails_stat #{shared_path}/log/#{rails_env}.log" end desc "Top" task :top do stream "top -b -n1" end desc "Delete repository cache" task :delete_repository_cache do run "rm -rf #{shared_path}/#{repository_cache}" end