Skip to content

Instantly share code, notes, and snippets.

@msonnabaum
Created April 7, 2011 22:17
Show Gist options
  • Save msonnabaum/908899 to your computer and use it in GitHub Desktop.
Save msonnabaum/908899 to your computer and use it in GitHub Desktop.
# Multistage support - see config/deploy/[STAGE].rb for specific configs
set :stages, %w(prod qa dev)
set :default_stage, "dev"
require 'capistrano/ext/multistage'
set :application, "blah"
set :user, "acquia"
set :scm, :git
ssh_options[:forward_agent] = true
#set :branch, "master"
set :repository, "git@github.com:blah/blah.git"
set :deploy_via, :remote_cache
set :deploy_to, "/home/#{user}/sites/#{application}"
set :scm_verbose, true
after "deploy:symlink", "drupal:symlink_shared"
# setting use_sudo to false means you can use
# cap cleanup ok without needing to be a sudoer
set :use_sudo, false
namespace :deploy do
# adjusted finalize_update, removed non rails stuff
task :finalize_update, :except => { :no_release => true } do
run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
end
task :restart do
# nothing to do here since we're on mod-php
end
end
namespace :drupal do
desc "Symlink settings and files to shared directory. This allows the settings.php and and sites/default/files directory to be correctly linked to the shared directory on a new deployment."
task :symlink_shared, :roles => :web do
run "ln -nfs #{shared_path}/local_settings.php #{latest_release}/docroot/sites/default/local_settings.php"
run "ln -nfs /mnt/drupal_files #{latest_release}/docroot/sites/all/files"
end
end
namespace :drush do
desc "Run Drupal database updates"
task :updatedb, :roles => :web, :on_error => :continue do
run "drush -r #{latest_release}/docroot updatedb -y", :once => true
end
desc "Clear cache"
task :cache_clear, :roles => :web, :on_error => :continue do
run "drush -r #{latest_release}/docroot cc all", :once => true
end
desc "Revert all features"
task :features_revert_all, :roles => :web, :on_error => :continue do
run "drush -r #{latest_release}/docroot fra -y", :once => true
end
end
namespace :varnish do
desc "Clear varnish cache"
task :cache_clear, :roles => :cache, :on_error => :continue do
run "echo \"purge req.url ~ .*\" | socat - TCP4:localhost:6082"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment