Skip to content

Instantly share code, notes, and snippets.

@leehambley
Created June 8, 2009 12:25
Show Gist options
  • Save leehambley/125785 to your computer and use it in GitHub Desktop.
Save leehambley/125785 to your computer and use it in GitHub Desktop.
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
# Agent Forwarding & a real terminal
default_run_options[:pty] = true
set :ssh_options, { :forward_agent => false }
# Server IP
SERVER_ADDRESS = '192.168.3.***'
# Remote Dependencies
depend :remote, :gem, 'integrity', '=0.1.10'
depend :remote, :gem, 'builder', '=2.1.2'
depend :remote, :gem, 'do_sqlite3', '=0.9.12'
# Look it up by IP until we decide what to name the server!
role :web, SERVER_ADDRESS, :primary => true
# Couple of things....
set :application, 'ciserver'
set :local_repository, 'svn+ssh://**************/scm/ciserver/trunk'
set :repository, 'https://****************/repos/ciserver/trunk'
set :deploy_to, '/var/www/************/'
set :deploy_via, :copy
set :scm_username, '************'
set :scm_password, '************'
set :apache_logs, ['/var/log/apache2/error.log', '/var/log/apache2/access.log']
# set :user, Net::SSH::Config.for(SERVER_ADDRESS)[:user]
# Taken from the Capistrano 2.6.0 pre-release.
load 'config/deploy'
set :shared_path, "#{File.join(deploy_to, 'persistent')}"
set :shared_children, ['db', 'builds', 'log']
before 'deploy' do
run "#{sudo} chmod -R a+rwx #{deploy_to}"
end
after 'deploy:symlink' do
run <<-EOT
if [ ! -f #{File.join(shared_path, 'db', 'integrity.db')} ]; then cd #{deploy_to} && integrity migrate_db #{current_path}/config.yml; fi
EOT
end
after 'deploy', 'deploy:restart'
namespace :deploy do
task :restart do
run "touch #{File.join(current_path, 'tmp', 'restart.txt')}"
end
end
namespace :logs do
task :tail do
stream "#{sudo} tail -f #{File.join(shared_path, 'log', '*')} #{fetch(:apache_logs).join(' ')}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment