You are here

Settings on Docksal development environment

Submitted by Alan Mels on Thu, 02/07/2019 - 15:35

For Drush 8:

cat ~/.drush/my.aliases.drushrc.php

  1. /**
  2.  * @file yoursite.aliases.drushrc.php
  3.  * Site aliases for [your site domain]
  4.  * Place this file at ~/.drush/ (~/ means your home path)
  5.  *
  6.  * Usage:
  7.  * To copy the development database to your local site:
  8.  * $ drush sql-sync @yoursite.dev @yoursite.local
  9.  * To copy your local database to the development site:
  10.  * $ drush sql-sync @yoursite.local @yoursite.dev --structure-tables-key=common --no-ordered-dump --sanitize=0 --no-cache
  11.  * To copy the production database to your local site:
  12.  * $ drush sql-sync @yoursite.prod @yoursite.local
  13.  * To copy all files in development site to your local site:
  14.  * $ drush rsync @yoursite.dev:%files @yoursite.local:%files
  15.  * Clear the cache in production:
  16.  * $ drush @yoursite.prod clear-cache all
  17.  *
  18.  * You can copy the site alias configuration of an existing site into a file
  19.  * with the following commands:
  20.  * $ cd /path/to/settings.php/of/the/site/
  21.  * $ drush site-alias @self --full --with-optional >> ~/.drush/mysite.aliases.drushrc.php
  22.  * Then edit that file to wrap the code in < ? php ? > tags.
  23.  */
  24.  
  25. /**
  26.  * Local alias
  27.  * Set the root and site_path values to point to your local site
  28.  */
  29.  
  30. $aliases['dev'] = array (
  31. 'root' => '/var/www/docroot',
  32. 'uri' => 'my.docksal',
  33. 'path-aliases' =>
  34. '%drush' => '/usr/local/bin',
  35. '%site' => 'sites/default/',
  36. ),
  37. );
  38.  
  39. $aliases['prod'] = array (
  40. 'uri' => 'my.altagrade.com',
  41. 'root' => '/home/altacom/domains/my.altagrade.com/public_html',
  42. 'remote-user' => 'altacom',
  43. 'remote-host' => '66.160.206.201',
  44. 'ssh-options' => '-p 19753', // To change the default port on remote server
  45. 'path-aliases' => array(
  46. '%dump-dir' => '/tmp',
  47. ),
  48. 'source-command-specific' => array (
  49. 'sql-sync' => array (
  50. 'no-cache' => TRUE,
  51. 'structure-tables-key' => 'common',
  52. ),
  53. ),
  54. // No need to modify the following settings
  55. 'command-specific' => array (
  56. 'sql-sync' => array (
  57. 'sanitize' => TRUE,
  58. 'no-ordered-dump' => TRUE,
  59. 'structure-tables' => array(
  60. // You can add more tables which contain data to be ignored by the database dump
  61. 'common' => array('cache', 'cache_filter', 'cache_menu', 'cache_page', 'history', 'sessions', 'watchdog'),
  62. ),
  63. ),
  64. ),
  65. );

To convert Drush 8 style alias file to Drush 9:

  1. mv /home/docker/.drush/my.aliases.drushrc.php /var/www/drush/sites
  2. cd /var/www/drush/sites
  3. drush site:alias-convert
  4. rm -rf my.site.yml
  5. rm -rf my.aliases.drushrc.php

Check the status of production site:

  1. cd /var/www
  2. drush @prod status

0) cat /home/docker/.bash_aliases

function pull_db() {
  cd /var/www/docroot
  drush -y sql-sync @prod @dev
  drush -y dis varnish memcache_admin && drush -y dis masquerade memcache commerce_stripe emaillog nicemessages
  drush -y dis masquerade_views memcache_admin
  drush -y en search_krumo
  drush vset error_level 2
  yes | drush -y en drush_extras
  drush -y en devel permissions_variable commerce_payment_example
  drush -y block-configure --module=devel --delta=switch_user --region=footer_firstcolumn --weight=0
  drush -y dis memcache
  drush -y dis varnish memcache_admin && drush -y dis masquerade memcache commerce_stripe emaillog nicemessages
  drush -y rules-disable commerce_payment_commerce_stripe
  drush -y en mojave
  drush uli 1
}
 
 
alias pull_private='drush -y rsync @prod:%private @dev:%private'
alias pull_theme='drush -y rsync @prod:%theme @dev:%theme'
alias pull_custom='drush -y rsync @prod:%custom @dev:%custom'
alias pull_files='drush -y rsync @prod:%files @dev:%files'
alias pull_all='drush rsync --exclude-conf @prod @dev'
alias push_theme='drush -y rsync @dev:%theme @prod:%theme'
alias push_custom='drush -y rsync @dev:%custom @prod:%custom'
 
alias custom='cd /var/www/docroot/sites/all/modules/custom'
alias theme='cd /var/www/docroot/sites/all/themes/altagrade'