Managing Drupal on Windows with Drush

Preview:

DESCRIPTION

When it comes to Drupal management and deployment, Drush is a must. This webcasts is about installing and configuring Drush on Windows, in order to manage local and remote Drupal sites on Windows and Linux.

Citation preview

Managing Drupal on Windows with

DrushAlessandro Pilotti@alexpilotti

MVP ASP.NET / IISWindows Azure Insider

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

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

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

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

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

Drush aliases example

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

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

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