Created
September 16, 2011 08:41
-
-
Save fangel/1221580 to your computer and use it in GitHub Desktop.
Capistrano Drupal Deploy deploy.rb skeleton
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set :stages, %w(production staging qa) | |
set :default_stage, "qa" | |
require 'capistrano/ext/multistage' | |
set :application, "version2" | |
set :user, "___DEPLOY_USER___" | |
set :group, "users" | |
set :scm, :git | |
set :repository, "[email protected]:___GITHUB_USER___/#{application}.git" | |
set :scm_username, "___GITHUB_USER___" | |
set :scm_passphrase, "___GITHUB_PASSWORD___" | |
set :deploy_to, "/var/www/#{application}" | |
set :deploy_via, :remote_cache | |
set :deploy_env, 'production' | |
default_run_options[:pty] = true | |
task :uname do | |
run "uname -a" | |
end | |
namespace :drupal do | |
desc <<-DESC | |
Symlinks the shared_path to be the files-directory in Drupal. Creates the settings-file from | |
the relevant stages settings. | |
DESC | |
task :symlink, :except => { :no_release => true } do | |
run "ln -sf #{latest_release}/sites/___MULTISITE___ #{latest_release}/drupal7/sites/default" | |
run "ln -sf #{shared_path} #{latest_release}/sites/___MULTISITE___/files" | |
run "ln -sf #{latest_release}/sites/___MULTISITE___/settings.#{stage}.php #{latest_release}/sites/___MULTISITE___/settings.php" | |
end | |
desc <<-DESC | |
Update the Drupal install to the latest db and code | |
DESC | |
task :update, :except => { :no_release => true } do | |
run "drush -r #{latest_release}/drupal7 updatedb -y" | |
fr | |
cc | |
end | |
desc <<-DESC | |
Shows the status of the Drupal installation | |
DESC | |
task :status do | |
run "drush -r #{latest_release}/drupal7 status" | |
end | |
desc <<-DESC | |
Revert all features | |
DESC | |
task :fr do | |
run "drush -r #{latest_release}/drupal7 fr-all -y" | |
end | |
desc <<-DESC | |
Clear all caches. | |
DESC | |
task :cc do | |
run "drush -r #{latest_release}/drupal7 cc all" | |
end | |
desc <<-DESC | |
Make the shared path (our files-dir) writable | |
DESC | |
task :setup, :except => { :no_release => true } do | |
run "chmod o+rw #{shared_path}" | |
end | |
namespace :web do | |
desc <<-DESC | |
Disables the website by setting it in maintenance-mode | |
DESC | |
task :disable, :roles => :web, :except => { :no_release => true } do | |
run "drush -r #{current_release}/drupal7 vset --always-set maintenance_mode 1" | |
run "drush -r #{current_release}/drupal7 cc all" | |
end | |
desc <<-DESC | |
Enables the website by disabling maintenance-mode | |
DESC | |
task :enable, :roles => :web, :except => { :no_release => true } do | |
run "drush -r #{latest_release}/drupal7 vset --always-set maintenance_mode 0" | |
run "drush -r #{latest_release}/drupal7 cc all" | |
end | |
end | |
end | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment