erCapistranoDrupal is a drupal deploy file for Capistrano. Includes site install, database migration; support subsites.
- Drupal 7
- Drupal 6
$ gem install erCapistranoDrupal
Open your application's Capfile
and make it begins like this:
require 'rubygems'
require 'erCapistranoDrupal'
load 'config/deploy'
Taking care to remove the original require 'deploy'
as this is where all the standard tasks are defined.
You should then be able to proceed as you would usually, you may want to familiarise yourself with the truncated list of tasks, you can get a full list with:
$ cap -T
- /htaccess-[dev|staging|production]
- /htaccess
- /robots-[dev|staging|production].txt
- /sites/[default]/settings.[dev|staging|production].php
- [shared_path]/sites/[default]/settings.php
- /migration/[default]/[yyyymmdd]/[hhiiss]_task.sql
- /migration/[default]/[yyyymmdd]/[hhiiss]_task.drush
# add user (2) to role (3)
insert into users_roles (uid, rid) values (2, 3);
# create new user 'everright'
user-create everright --mail=everright@example.com --password=123456
# enable token module
en token
- :dp_local_backup, '/backup'
- :dp_sites, 'sites'
- :dp_migration, 'migration'
- :dp_released_files, 'released_files'
- :dp_released_db, 'released_db'
- :dp_domains, ['default']
- :dp_default_domain, 'default'
- :dp_virtual_hosts, []
- :dp_shared_files, false
- :dp_shared_path, '/nfs'
- :drush, '/usr/bin/drush'
- :dp_version, 7
If you want to install the drupal when first deploy, then you need to change these variables.
- :dp_site_install, false
- :dp_site_db_url, nil
- :dp_site_profile, 'standard'
- :dp_site_name, 'Drupal 7 Demo'
- :dp_site_admin_user, 'admin'
- :dp_site_admin_pass, 'admin'
- :dp_maintainance_keys, {'default' => 'maintenance_mode'}
Support "Read Only Mode" module.
System will be auto set the maintainance key to "site_readonly" when "Read Only Mode" module enabled.
# application name
set :application, 'd7demo_deploy'
# remote server user
set :user, 'deploy'
set :use_sudo, false
# set multiple environments
set :stages, ['dev', 'staging', 'production']
set :default_stage, 'dev'
require 'capistrano/ext/multistage'
# set scm
set :scm, :git
set :repository, 'git@github.com:everright/d7demo.git'
set :branch, 'master'
set :deploy_via, :copy
set :copy_cache, true
set :copy_exclude, %w(.git .gitignore)
# define servers, must be set primary web.
server 'dev_server', :web, :primary => true
# deploy to
set :deploy_to, "/var/www/sites/dev.d7demo.local"
# site install info
set :dp_site_install, true
set :dp_site_db_url, "mysql://drupal_all:123456@dbserver/d7_demo_dev"
set :dp_site_profile, "standard"
set :dp_site_name, "D7 Demo"
set :dp_site_admin_user, "admin"
set :dp_site_admin_pass, "admin"
# define servers, must be set primary web.
server 'staging_server', :web, :primary => true
# deploy to
set :deploy_to, "/var/www/sites/staging.d7demo.local"
# site install info
set :site_install, true
set :site_db_url, "mysql://drupal_all:123456@dbserver/d7_demo_staging"
set :site_profile, "standard"
set :site_name, "D7 Demo"
set :site_admin_user, "admin"
set :site_admin_pass, "admin"
# define servers, must be set primary web.
server 'production_server1', :web, :primary => true
server 'production_server2', :web
server 'production_server3', :web, {
:user => 'other_deploy_user'
}
# deploy to
set :deploy_to, "/var/www/sites/www.d7demo.local"
# site install info
set :dp_site_install, true
set :dp_site_db_url, "mysql://drupal_all:123456@dbserver/d7_demo"
set :dp_site_profile, "standard"
set :dp_site_name, "D7 Demo"
set :dp_site_admin_user, "admin"
set :dp_site_admin_pass, "admin"
# If have multiple webservers, enable share files
set :dp_shared_files, true
- Add drupal 6 support
- Fix release files backup bug
- Fix database migration bug on migration was not exist
- Fix muiltiple servers deploy bug
- Fix rollback permissions bug
- First release