Forked from andreav/drupal7_pack_unpack_site_by_drush_and_bash
Created
February 15, 2013 01:11
-
-
Save gmclelland/4957896 to your computer and use it in GitHub Desktop.
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
refs: http://drupal.org/node/642116 | |
refs: http://drupalovereasy.com/drupal-7/tutorials/installing-using-drush-make-git-profiles | |
refs: http://realize.be/exporting-more-configuration-drush-ctools-export-bonus | |
PACK: | |
# Starting from an up&running drupal site | |
#======================================== | |
cd <drupal_repo_root> | |
# 1. pack core, modules, libraries | |
#================================= | |
drush generate-makefile sites/all/mysite.make | |
git add sites/all/mysite.make | |
git commit -m "Added mysite makefile" | |
# 2. pack enabled/disabled modules | |
#================================= | |
drush pm-list --status=enabled --type=module --pipe > sites/all/mysite.enmod | |
drush pm-list --status=disabled --type=module --pipe > sites/all/mysite.dismod | |
git add sites/all/mysite.enmod sites/all/mysite.dismod | |
git commit -m "Added mysite enabled/disabled modules" | |
# 3.1 pack configuration - save it to code. If necessary, first download drush_ctex_bonus | |
#======================================================================================== | |
drush dl drush_ctex_bonus --dev --destination=sites/all/drush | |
drush cache-clear drush | |
drush help cbum #to check if installation was succesful | |
git add sites/all/drush | |
git commit -m "Added drush_ctex_bonus" | |
# 3.2 export configuration to code | |
#================================= | |
drush ctex mysite_config | |
git add sites/all/modules/ctools_export/mysite_config | |
git commit -m "Added mysite configuration to code" | |
# 4a. pack files | |
# remember to set "Private file system path" to sites/default/files/private | |
# under admin/config/media/file-system | |
# 4b. simply keep them under git (and jump this) | |
#============================================================================= | |
drush dl backup_migrate backup_migrate_files | |
drush en -y backup_migrate backup_migrate_files | |
drush bam-backup files | |
drush bam-backup files_private | |
# 5. pack nodes | |
# otionally export nodes to code | |
#=============================================== | |
drush dl uuid node_export --dev | |
drush en -y uuid node_export | |
drush node-export-export -y --file=sites/all/mysite.nodes --type about,frontpage | |
git add sites/all/mysite.nodes | |
git commit -m "Added some nodes to code" | |
# 6. push everithing to you central repo (if necessary) | |
#===================================================== | |
git push origin | |
UNPACK: | |
# 1. clone my central repo | |
#========================= | |
git clone <http://.../my_drupal_skel> mysite | |
cd mysite | |
# 2. download latest core, modules and libraries | |
# you can jump this step if all you need is | |
# stored into your repo | |
#=============================================== | |
drush make -y --prepare-install sites/all/mysite.make . | |
# 3. setup procedure | |
# create db and initialize site | |
# remeber to change at least $DBSUPASS ! | |
#========================================== | |
DBNAME=msite-db | |
DBUSER=admin | |
DBPASS=admin | |
DBSUUSER=root | |
DBSUPASS=itpass | |
ACCOUNTNAME=admin | |
ACCOUNTPASS=admin | |
SITENAME=mysite.mysite | |
SITEMAIL=admin@mysite.mysite | |
drush si standard -y --db-url=mysql://$DBUSER:$DBPASS@localhost/$DBNAME --db-su=$DBSUUSER --db-su-pw="$DBSUPASS" --account-name=$ACCOUNTNAME --account-pass=$ACCOUNTPASS --site-name=$SITENAME --site-mail=$SITEMAIL | |
# 4. enable modules | |
# maybe this could be done also using a custom profile | |
#======================================================== | |
drush dis -y $( cat sites/all/mysite.dismod ) | |
drush en -y $( cat sites/all/mysite.enmod ) | |
# 5. restore configuration from code to db | |
#========================================= | |
drush cbum mysite_config | |
# 6. restore files | |
#================= | |
drush bam-restore files files sites/default/files/private/backup_migrate/manual/mybackup.date.tar.gz | |
drush bam-restore files_private files_private sites/default/files/private/backup_migrate/manual/mybackup.date.tar.gz | |
# 7. restore nodes | |
#=============================================== | |
drush node-export-import --file=sites/all/mysite.nodes | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment