Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

* it does not work with a domain name here!

...

How to get yourself set up to use the scripts

  • do this on each machine (victoria01, victoria02, victoria03)
      cd ~
      git clone git@github.com:cul-it/drupal-site-moves.git
  

How to change the modules and themes

  • if the drush.make file is in git
    • it will likely be in github in cul-it in a repository named after the site
    • clone the repo to your local machine to do the updates, then check back in on the master branch
  • if the drush.make file is in subversion
    • find your make file under cul-drupal/[drupal_6 or drupal_7]/make/[your site name]/[your site name].make
  • add lines or modify the version of the module listed according to the drush make file format (use other sites for examples)
  • check in the changed version

...

  • go to victoria02 and cd /libweb/sites/[your site name]/make
  • sudo dr-make.sh @[your site name]
  • Panel

    Note: the alias argument @[your site name] is no longer necessary for dr-make.sh

  • a few sites on victoria02 use drush.make files stored in git
    • use ~/drupal-site-moves/dr-make-git.sh for these
    • main1.test.library.cornell.edu

How to update your theme/module code on the site

...

  • You need to have ssh keys set up so you can get to the other machine without a password prompt
  • one easy way to do this is set up the drush command 'pushkey'
    • read all about it: https://www.drupal.org/project/drush_extras
    • PUSHKEY
      
          drush pushkey user@host.domain.com
      
      	Creates an ssh public/private key pair in $HOME/.ssh, if
      	one does not already exist, and then pushes the public
      	key to the specified remote account.  The password for the
      	destination account must be entered once to push the
      	key over; after the key has been stored on the remote
      	system, subsequent ssh and remote drush commands may be
      	executed using the public/private key pair for authentication.
      
      	IN DRUSH EXTRAS because is is Linux / openssl-specific.
              
    • install it in your user's drush
      • log in to victoria02
      • drush dl drush_extras
    • use it

How to move from production to test

Panel

There is a script for this on victoria02: /usr/local/bin/update_test_from_production.sh

There is also one for moving from victoria03: /usr/local/bin/update_test_from_victoria03.sh

**************************************

Usage: sudo /usr/local/bin/update_test_from_production.sh <production domain> <test domain>

**************************************

once the ssh keys are set up, you can avoid lots of extra 

Enter passphrase for key '/home/user/.ssh/id_rsa'

prompts by using this command:

ssh-add

See this: http://blog.joncairns.com/2013/12/understanding-ssh-agent-and-ssh-add/


How to get the latest versions of the scripts

  • grab the new scripts from github
    • cd ~
    • git clone git@github.com:cul-it/drupal-site-moves.git
    • cd ~/drupal-site-moves
    • git pull

How to set permissions on a site

  • log in to the server where the site is via ssh
  • get the latest versions of the scripts
  • ~/drupal-site-moves/set_permissions.sh <site name>

How to move from production to test

  • Set permissions for the production site on the production machine
  • Set permissions on test site on the test machine
  • while logged in to the test machine:
    • ~/drupal-site-moves/pull_site_from_production.sh <production site name> <test site name>
  • you are prompted for your password
  • you are asked to confirm the site move
  • you are asked to inform the site users that you are working on the site on the test server
    • put up the 'Site Under Maintenance' block
  • script continues on without requiring any input from you
    • backs up the database
    • moves the site files to the target server
    • installs the backed up database on the target server
  • done
  • Log on to the production  Drupal site and configure the 'Site under maintenance' block
    • Under 'Page specific visibility settings' select 'Show on every page except the listed pages.'
  • Make a backup of the production site to the Manual Backups Directory (using Backup and Migrate module)
    • Drupal 6: http://$productiondomain/admin/content/backup_migrate/export
    • Drupal 7: http://$productiondomain/admin/config/system/backup_migrate
  • Log on to the test Drupal site
  • Put the test site into maintenance mode
    • Drupal 6: http://$testdomain/admin/settings/site-maintenance
    • Drupal 7: http://$testdomain/admin/config/development/maintenance
  • go to victoria02 and cd /libweb/sites/[your site name]/make
  • Determine what machine the production site is on
    • victoria03 - www.library.cornell.edu, beta.library.cornell.edu
      • sudo update_test_from_victoria03.sh [your production site domain] [your test site domain]
    • victoria02 - all the others
      • sudo update_test_from_production.sh [your production site domain] [your test site domain]
    • the script will ask you if you completed each of the steps above and give you all the real paths to the pages you need to use
    • the script moves the site with rsync
  • Log on to the test Drupal site
  • Restore the latest backup
    • Drupal 6: http://$testdomain/admin/content/backup_migrate/destination/list/files/manual
    • Drupal 7: http://$testdomain/admin/config/system/backup_migrate/destination/list/files/manual
    • click 'restore' next to the latest version of the file (hint: sort by file name!)
  • take the test site out of maintenance mode

How to move from test to production

...

  • Set permissions for the test site on the test machine
  • Set permissions on production site on the production machine
  • while logged in to the production machine:
    • ~/drupal-site-moves/pull_site

There is a script for this on victoria01: /usr/local/bin/update_production_from_test.sh

There is also one on victoria03 to update production there: /usr/local/bin/update_victoria03_from_test.sh

**************************************

...

    • _from_test.sh <test

...

**************************************

    •  site name> <production site name>
  • you are prompted for your password

  • you are asked to confirm the site move
  • you are asked to confirm again
    • you can take down the 'Site Under Maintenance' block while the site is still on the test server
  • script continues on without requiring any input from you
    • backs up the database
    • moves the site files to the target server
    • installs the backed up database on the target server
  • done

 

...

  • victoria03 - www.library.cornell.edu, beta.library.cornell.edu
    • ssh to the production machine victoria03 and cd /libweb/sites/[your site name]/make 
    • sudo update_victoria03_from_test.sh [your test domain] [your production domain]
  • victoria01 - all the others
    • ssh to the production machine victoria01 and cd /libweb/sites/[your site name]/make 
    • sudo update_production_from_test.sh [your test domain] [your production domain]

...