Skip to content

Instantly share code, notes, and snippets.

@andreav
Last active December 11, 2015 04:29

Revisions

  1. andreav revised this gist Jan 16, 2013. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions drupal7_pack_unpack_site_by_drush_and_bash
    Original file line number Diff line number Diff line change
    @@ -102,4 +102,9 @@ UNPACK:
    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



  2. andreav revised this gist Jan 16, 2013. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions drupal7_pack_unpack_site_by_drush_and_bash
    Original file line number Diff line number Diff line change
    @@ -36,18 +36,18 @@ PACK:
    git add sites/all/modules/ctools_export/mysite_config
    git commit -m "Added mysite configuration to code"

    # 4. pack files
    # remember to set "Private file system path" to sites/default/files/private
    # under admin/config/media/file-system
    # 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

    # 5a. pack nodes
    # otionally export nodes to code
    # 5b. simply keep them under git (and jump this)
    # 5. pack nodes
    # otionally export nodes to code
    #===============================================
    drush dl uuid node_export --dev
    drush en -y uuid node_export
  3. andreav revised this gist Jan 16, 2013. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions drupal7_pack_unpack_site_by_drush_and_bash
    Original file line number Diff line number Diff line change
    @@ -45,9 +45,10 @@ PACK:
    drush bam-backup files
    drush bam-backup files_private

    # 5. pack nodes
    # otionally export nodes to code
    #==================================
    # 5a. pack nodes
    # otionally export nodes to code
    # 5b. simply keep them under git (and jump this)
    #===============================================
    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
  4. andreav revised this gist Jan 16, 2013. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion drupal7_pack_unpack_site_by_drush_and_bash
    Original file line number Diff line number Diff line change
    @@ -94,4 +94,11 @@ UNPACK:

    # 5. restore configuration from code to db
    #=========================================
    drush cbum mysite_config
    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


  5. andreav revised this gist Jan 16, 2013. 1 changed file with 11 additions and 2 deletions.
    13 changes: 11 additions & 2 deletions drupal7_pack_unpack_site_by_drush_and_bash
    Original file line number Diff line number Diff line change
    @@ -36,7 +36,16 @@ PACK:
    git add sites/all/modules/ctools_export/mysite_config
    git commit -m "Added mysite configuration to code"

    # 4. pack nodes
    # 4. pack files
    # remember to set "Private file system path" to sites/default/files/private
    # under admin/config/media/file-system
    #=============================================================================
    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
    @@ -45,7 +54,7 @@ PACK:
    git add sites/all/mysite.nodes
    git commit -m "Added some nodes to code"

    # 5. push everithing to you central repo (if necessary)
    # 6. push everithing to you central repo (if necessary)
    #=====================================================
    git push origin

  6. andreav created this gist Jan 16, 2013.
    88 changes: 88 additions & 0 deletions drupal7_pack_unpack_site_by_drush_and_bash
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,88 @@
    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"

    # 4. 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"

    # 5. 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
    [email protected]
    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