Transcript
Page 1: Managing Drupal on Windows with Drush

Managing Drupal on Windows with

DrushAlessandro Pilotti@alexpilotti

MVP ASP.NET / IISWindows Azure Insider

MCSD, MCAD, MCSE, MCDBA, MCTRed Hat Certified Engineer

Page 2: Managing Drupal on Windows with Drush

DrushDrush is a command line shell and scripting

interface for Drupal

Very useful for Deployment and Management

Windows installer availablehttp://drush.ws/drush_windows_installerTargets Drush 5

Page 3: Managing Drupal on Windows with Drush

Drush RequirementsThe installer handles all the requirements

PHPDrush is written in PHP

GnuWin32Required *nix tools not available on Windows

cwRsync For site / database synchronization with Linux hosts

WinRMFor remote management of Windows hosts

Page 4: Managing Drupal on Windows with Drush

Drush commands http://drush.ws/help/5

Examples (just a small subset)! core-status,status site-install,si pm-download, dl pm-enable, en clear-cache, cc watchdog-show, ws self-update updatedb core-rsync, rsync sql-sync

Modules can provide additional commands E.g. apachesolr

Page 5: Managing Drupal on Windows with Drush

Drush aliasesLocal single site:

Just “cd” in the site’s directory and issue Drush commands

Multiple local sites or remote sites Create an alias file:

%USERPROFILE%\.drush\aliases.drushrc.php Aliases con be generated manually or with:

“cd” in the site’s directorydrush sa @selfdrush sa –with-db @self

Includes also db details

Example: drush @remote status

Page 6: Managing Drupal on Windows with Drush

Drush aliases example

Page 7: Managing Drupal on Windows with Drush

Windows Remote Management

Windows does not provide an SSH server

WinRM needs to be configured on the server sc config "WinRM" start= auto net start WinRM winrm quickconfig Uses HTTP or HTTPS

The latter requires a trusted non self signed certificate

WinRS (Windows Remote Shell) is the client Easiest configuration:

WinRM set winrm/config/client @{TrustedHosts="*"}* can be replaced with a list of trusted servers

Page 8: Managing Drupal on Windows with Drush

Windows Remote Management

Check it with e.g.:winrs –r:remoteserver cmd

Credentials In aliases.drushrc:

remote-userwinrs-password

As an alternative (better security):cmdkey /add:remoteserver /user:username

/passNot necessary in a domain or with pass-through

AuthN when using the same user

Page 9: Managing Drupal on Windows with Drush

Linux remote management via SSH

SSH can be used w/o providing a remote server password

On the client (Windows) start a Drush Command Prompt set HOME=%USERPROFILE% ssh-keygen Copy %USERPROFILE%\.ssh\id_rsa.pub to the

server (Linux)

On the server cat id_rsa.pub >> ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys


Recommended