The development server is capdev.library.cornell.edu (aka sf-lib-web-006.serverfarm.cornell.edu). Each developer maintains a site, [netid].capdev.library.cornell.edu, on capdev. Look in /libweb/sites/ for your site.
Prepare the site for deployment
...
What this does is clones the git repo to the target machine, moves all the site code to a timestamped directory there, updates a symbolic link pointing the document root at the new code, does the Drupal update.php procedure, reverts all features, enables all the modules enabled in the dev site, clears the cache, and a few other Drupal things. It makes a snapshot of the Drupal database before all this, but leaves the target database intact (except for the module updates), so the target site's new content is preserved.
Update Drupal modules
You can use several methods to update the modules. In Drupal, go to admin/modules/update and follow the instructions. On the command line do this:
| Code Block |
|---|
cd mysite
cd public
drush up
|
You can also update the version numbers in drupal_config/local.make, then
| Code Block |
|---|
cd mysite
cul_capistrano/do_make.sh
|
Update Drupal core & modules
The best way is to update the Drupal core version number in drupal_config/local.make then run the make file:
| Code Block |
|---|
cd mysite
cul_capistrano/do_make.sh
|
Apply patches
The best way is to update the drupal_config/local.make file with the patch info:
| Code Block |
|---|
projects[kaltura][version] = "2.0"
projects[kaltura][patch][] = "http://drupal.org/files/kaltura-1567302-dispaly.patch"
|
then run the make file:
| Code Block |
|---|
cd mysite
cul_capistrano/do_make.sh
|
Copy a remote database to the dev machine
| Code Block |
|---|
cd mysite
cap production drupal:db:grab
|
Install a database dump on remote machine
| Code Block |
|---|
cd mysite
ls backup/
README.txt staging-snapshot-20140114162844.sql
cap staging drupal:db:install -s file=backup/staging-snapshot-20140114162844.sql
|
Install a database dump on the dev machine
| Code Block |
|---|
cd mysite
ls backup/
db-features.test.library.cornell.edu staging-snapshot-2013-10-23-16-5-59.sql staging-snapshot-2013-10-28-11-44-8.sql
local-snapshot-2013-10-24-16-19-52.sql staging-snapshot-2013-10-24-11-32-41.sql staging-snapshot-2013-10-29-10-57-19.sql
production-snapshot-2013-10-30-12-35-22.sql staging-snapshot-2013-10-24-9-24-42.sql
staging-snapshot-2013-10-23-14-17-14.sql staging-snapshot-2013-10-25-13-17-23.sql
cul_capistrano/local_db_install.sh production-snapshot-2013-10-30-12-35-22.sql
|
Create a development branch
...
Prepare a new site on the dev machine
Make a git repo for the site on git.library.cornell.edu. Use the test site name, e.g. seadina.test.library.cornell.edu.
Run the script to create the initial site directory.
| Code Block |
|---|
cd my_cap_dev_area
setup_cap_dev_site.sh seadina_test_library_cornell_edu.git
|
Create the database, make a symbolic link from htdocs to the public directory (where Drupal is), install Drupal.
Then add everything to git, commit, and push.
Prepare a new site on a remote machine
| Code Block |
|---|
cd mysite
cap staging deploy:setup
cap staging drupal:site_setup_permissions
cap staging drupal:install -s db=databasename -s dbu=databaseuser -s dbpw=databasepassword \
-s d_user=Drupal_user#1 -s d_pw=Drupal_user#1_password -s d_email=Drupal_user#1_email
|
Update cul_capistrano
The cul_capistrano directory is a 'git subtree'. If the separate git repo cul_capistrano comes from has been updated you can update your copy:
| Code Block |
|---|
cd mysite git subtree pull --prefix cul_capistrano git@git.library.cornell.edu:cul_capistrano.git master --squash -m 'merge cul_capistrano updates' |
Undo a site deploy
| Code Block |
|---|
cd mysite
cap staging deploy:rollback
|
Note: this also restores the database to the state it was at before the previous deploy.
List all the capistrano commands
| Code Block |
|---|
cd mysite
cap -T
|
Enable passwordless login to remote machines
| Code Block |
|---|
drush dl drush_extras
drush pushkey victoria02.library.cornell.edu
drush pushkey victoria01.library.cornell.edu
drush pushkey victoria03.library.cornell.edu
|