You are here

brush aliases for a backdrop website

Submitted by Alan Mels on Thu, 09/23/2021 - 23:46

Outside of the container run:

ddev auth ssh

then ddev ssh and:

Use sudo nano ~/.brush/homie.aliases.brushrc.php and paste:

  1. <?php
  2. $aliases['dev'] = array (
  3. 'root' => '/var/www/html/docroot',
  4. 'uri' => 'homie.ddev.site',
  5. 'path-aliases' =>
  6. '%brush' => '/home/alan/bin/brush/brush',
  7. '%modules' => 'modules',
  8. '%themes' => 'themes',
  9. '%files' => 'files',
  10. ),
  11. );
  12.  
  13. $aliases['prod'] = array (
  14. 'uri' => 'my.homiebees.com',
  15. 'root' => '/home/homiebees/domains/my.homiebees.com/public_html',
  16. 'remote-user' => 'homiebees',
  17. 'remote-host' => '216.218.133.21',
  18. 'ssh-options' => '-p 19753', // To change the default port on remote server
  19. 'path-aliases' => array(
  20. '%dump-dir' => '/tmp',
  21. '%modules' => 'modules',
  22. '%themes' => 'themes',
  23. '%files' => 'files',
  24. ),
  25. );

0) nano ~/.bash_aliases

function pull-db() {
  cd /var/www/docroot
  brush -y sql-sync @prod @dev
  brush en devel -y
  brush en search_krumo -y
  brush uli 1
}
 
alias pull-theme='brush -y rsync @prod:%themes @dev:%themes'
alias pull-modules='brush -y rsync @prod:%modules @dev:%modules'
alias pull-files='brush -y rsync @prod:%files @dev:%files'
alias pull-all='brush -y rsync --exclude-conf @prod @dev'
alias push-theme='brush -y rsync @dev:%themes @prod:%themes'
alias push-modules='brush -y rsync @dev:%modules @prod:%modules'
 
alias eba='nano ~/.bash_aliases'
alias lba='source ~/.bash_aliases'
alias ?='history'  # DISPLAYS HISTORY
alias x='exit'
alias yum='yum -y'
alias recall="history |grep $1"
 
tardir () {
tar cvzf ${1}.tgz ${1}
}
 
# Extract compressed file
extract () {
  if [ -f $1 ] && [ -r $1 ] ; then
    case $1 in
      (*.tar.bz|*.tbz)  tar -xjf $1;;
      (*.tar.bz2|*.tbz2)  tar xjf $1;;
      (*.tar.gz|*.tgz)    tar xzf $1;;
      (*.bz2)             bunzip2 $1;;
      (*.rar)             rar x $1;;
      (*.gz)              gunzip $1;;
      (*.tar)             tar xf $1;;
      (*.zip)             unzip $1;;
      (*.Z)               uncompress $1;;
      (*.7z)              7z x $1;;
      (*.deb)             sudo dpkg -i $1;;
      (*.rpm)             sudo alien -dik $1;;
      (*)                 echo "extract: unsupported format $1" ;;
  esac
    rm -rf $1
    ls -l
  else
    echo "extract: file not found or unreadable: $1"
  fi
}
 
# Find a file with a pattern in file name
function fn() { find . -type f -iname '*'$1'*' -ls ; }
# Find a file with a pattern in the content of the file
function fs() { grep -Ril "$1" .; }

1) For Support portal

mkdir ~/.brush/
nano ~/.brush/homie.aliases.brushrc.php
 
<?php
$aliases['dev'] = array (
  'root' => '/var/www/html/docroot',
  'uri' => 'support.ddev.site',
  'path-aliases' =>
    array (
      '%brush' => '/usr/local/bin/brush',
      '%modules' => 'modules',
      '%themes' => 'themes',
      '%files' => 'files',
    ),
);
$aliases['prod'] = array (
  'uri' => 'support.altagrade.com',
  'root' => '/home/altacom/domains/support.altagrade.com/public_html',
  'remote-user' => 'altacom',
  'remote-host' => '216.218.133.21',
  'ssh-options'  => '-p 19753',  // To change the default port on remote server
  'path-aliases' => array(
    '%dump-dir' => '/tmp',
    '%modules' => 'modules',
    '%themes' => 'themes',
    '%files' => 'files',
  ),
  'source-command-specific' => array (
    'sql-sync' => array (
      'no-cache' => TRUE,
      'structure-tables-key' => 'common',
    ),
  ),
  // No need to modify the following settings
  'command-specific' => array (
    'sql-sync' => array (
      'sanitize' => TRUE,
      'no-ordered-dump' => TRUE,
      'structure-tables' => array(
        // You can add more tables which contain data to be ignored by the database dump
        'common' => array('cache', 'cache_filter', 'cache_menu', 'cache_page', 'history', 'sessions', 'watchdog'),
      ),
    ),
  ),
);