Drupal Best Practice: SSH, Backup, Development

SSH

  • ssh (secure shell)
  • üblicherweise openssh
  • ersetzt telnet, rsh
  • asymetrische verschlüsselung: private and public keys

entfernt einloggen

ssh user@server

entfernten befehl ausführen

ssh user@server "ls -la"

entfernten befehl ausführen und lokal filtern

ssh user@server "ls -la" | grep txt

dynamischer socks proxy

ssh -D1080 user@server

entfernten port ranholen

ssh -L 3306:localhost:3306 user@server

lokalen port auf remote freigeben

ssh -R 3306:localhost:3306 user@server

Backup

Simpel: tar (tape archive)

tar cvfz archiv.tgz verzeichnis/

mit erklärendem zeitstempel

tar cvfz archiv-$(date +"%Y%m%d-%H%M%S").tgz verzeichnis/

remote verzeichnis lokal backupen per ssh

ssh user@server "tar cvfz - verzeichnis/" | cat > archiv-$(date +"%Y-%m-%d-%H-%M-%S").tgz

intelligent: nur deltas übertragen

rsync -avuz -e ssh user@server:/var/www/drupal /var/backup

bandbreitenschonend

rsync -avuz -e ssh --bwlimit=50 user@server:/var/www/drupal /var/backup
  • tools, die hardlinks benutzen: dirvish, rbackup

Drupal-Modul: Drush

Website: Drush

  • lehnt sich an debian apt-get an
Usage: drush.php [options] <command> <command> ...

Options:
  -r <path>, --root=<path>      Drupal root directory to use (default: current directory)
  -l <uri> , --uri=<uri>        URI of the drupal site to use (only needed in multisite environments)
  -v, --verbose                 Display all available output
  -y, --yes                     Assume 'yes' as answer to all prompts
  -s, --simulate                Simulate all relevant actions (don't actually change the system)
  -c, --config                  Specify a config file to use. See example.drushrc.php

Commands:
  help                  View help. Run "drush help [command]" to view command-specific help.
  pm install            Install one or more modules
  pm refresh            Refresh update status information
  pm update             Update your modules
  sql url               Print database connection details.
  sql version server    Print database server version number.
  sql version client    Print database client library version number.
  sql dump              Exports the Drupal DB as SQL using mysqldump or pg_dump.
  sql query             Execute a query against the site database.
  sql load              Copy source database to target database.
  cache clear           Clear all caches
  cron                  Run cron
  watchdog show         Show the most recent watchdog log messages
  watchdog delete       Delete all messages of a certain type
  sync                  Rsync the Drupal tree to any [destination] using ssh

alias

alias drush='php /var/www/drupal/modules/drush/drush.php'

drushrc.php

// use cvs checkouts when installing modules
// an example of a command specific argument being set in drushrc.php
$options['handler'] = 'wget';
serge@fsck:/var/www/drupal$ drush pm refresh
Refreshing update status information ...
Done.
serge@fsck:/var/www/drupal$ drush pm update
Update information last refreshed: Wed, 06/11/2008 - 10:29

Update status information on all installed and enabled Drupal modules:
  name                                  installed version       candidate version       status
  ----                                  -----------------       -----------------       ------
  Content Construction Kit (CCK)        5.x-1.6-1               5.x-1.7                 Update available
  German Stemmer                        5.x-1.0                 5.x-1.0                 OK
  Drupal                                5.7                     5.7                     OK
  Drush                                 5.x-1.0                 5.x-1.3                 Update available
  Link                                  5.x-2.1                 5.x-2.2                 Update available
  Node Auto Term [NAT]                  5.x-2.1                 5.x-2.1                 OK
  Panels                                5.x-2.0-beta2           5.x-2.0-beta5           Update available
  Panels Taxonomy                       5.x-0.5                 5.x-0.5                 OK
  Similar By Terms                      5.x-1.x-dev             5.x-1.x-dev             OK
  taxonomy_context                      5.x-1.x-dev             unknown                 ignored: No filedate available
  Taxonomy Force All                    5.x-1.1                 5.x-1.1                 OK
  Taxonomy Manager                      5.x-1.0                 5.x-1.0                 OK
  Views                                 5.x-1.6                 5.x-1.6                 OK
  Voting API                            5.x-1.5                 5.x-1.6                 Update available

Updates are available for the following projects:
Content Construction Kit (CCK) [cck], Drush [drush], Link [link], Panels [panels], Voting API [votingapi]

Note: Updated modules can potentially break your site. It's not recommended to update production sites without prior testing.
Note: A backup of your package will be stored to backups directory if no .svn directory is found.
Note: If you have made any modifications to any file that belongs to one of these projects, you will have to migrate those modifications after updating.
Do you really want to continue? (y/n):

Drupal Modul: Database Administration

Website: Database Administration

- works with both MySQL and PostgreSQL
- ability to execute sql scripts and see the resulting output (ie, create/alter/update tables)
- overview listing of all tables and total row counts for each
- ability to backup one or more tables from active database
- ability to view table data
- ability to describe table
- ability to empty (delete) all data from one or more tables at a time
- ability to drop one or more tables at a time
- ability to edit a specific row (using simple form)
- ability to delete a specific row
- in MySQL, ability to check and repair one or more tables at a time
- two permissions: 'dba view database' and 'dba administer database' 

Drupal Modul: Demonstration site (Sandbox)

projekte/drupal/sysadmin/best_practice.txt · Zuletzt geändert: 2008/09/07 12:27 von hinnerk
CC Attribution-Noncommercial-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0