background preloader

Drush | Drupal

Facebook Twitter

OPC IT - Canberra IT, Hardware, Software and Drupal Web Services. A good software engineer will tell you that you really should use some kind of version control when developing your software, and good Drupal developers will tell you that Drush is fantastic for downloading module updates and general maintenance of your Drupal install.

OPC IT - Canberra IT, Hardware, Software and Drupal Web Services

But how do you make your Drush and Version Control play nicely together? This article looks at using Drush together with Git to manage updates to your production Drupal site. This builds on Simon Hobbs’ extremely helpful article on setting up Drush Aliases. It also assumes that you’ve set up Git on both your development and production servers1, and have set up SSH keys2 to make life easier. Introduction Two of the most valuable lessons I ever learned as a web developer, I picked up at a Web Directions South workshop. Only ever make updates to your production sever through your version control tool; and Always have a single line command make this happen. Backing up the database Backing up the code And for Drupal 7:

Drush aliases primer for Live->Dev syncing. This article demonstrates Drush aliases and the configuration you need to pull the database and files from one Drupal site to another with the following commands: # Syncronize sites/emspace.com.au/files from production to dev. drush rsync @prod:%files @dev:%files # Syncronize database (minus 'custom' tables) from production to dev drush sql-sync --structure-tables-key=custom --no-cache @prod @dev Background I spoke with Moshe at Drupalcon SF about some new tricks in Drush.

Drush aliases primer for Live->Dev syncing

I realised that my bespoke deployment scripts would soon be obsolete. Along with Moshe et all, I want to specifically thank Greg Anderson. Set-up You need two working Drupal sites for this example - preferably on the same server (to begin with). My setup, in case it helps: I have /usr/bin/php soft-linked to the MAMP php 5.2 executable. Set up your aliases For these examples you only need one configuration file on your local machine. Open the terminal, or bash window. <? Using drush to synchronize and deploy sites. Important: This document reflects drush-3.0-beta2 and later versions.

Using drush to synchronize and deploy sites

Editor's Note At the time of this writing, the most recent drush tag is drush-3.0-beta1, which contains a different implementation of the site alias feature. Please note that Drush has moved to Github. Drush has introduced the concept of 'site aliases', which are small arrays containing connection details relevant to individual site instances.

These are used to note information about your local dev site and a remote staging site (for example). With this info, drush can help you move content between these locations! After installing drush, have a look at:drush help site-aliasdrush help rsyncdrush help sql-sync to get started. You will first want to make a note of your local site alias information. About the local setup drush site-alias --full demosite.drupal6.local This tells us: $aliases['demosite.drupal6.local'] = array ( 'uri' => 'demosite.drupal6.local', 'root' => '/var/www/drupal6',); Pretty simple so far. <? <? Drupal. How to install Drush server-wide in less than one minute. Drush: An Expert's Technique. Chances are you know that drush is a command line utility for Drupal that allows site administrators to interface with the site directly from the command line shell.

Drush: An Expert's Technique

It contains simple commands such as drush st , which simply print the status report to the terminal, to the more powerful drush updb, equivalent to visiting the update.php script in your web browser. An Advanced Perspective I will assume, since you’re reading this article, that you have some knowledge of the power of this utility and know that, while drush on the surface, can enhance a developer workflow greatly; it also has the benefits of being complex and flexible.

Just a couple of the concepts which make drush very powerful are: Two-Factor Authentication with Drush Because of Drush’s ability to set configuration parameters with its remote aliases, drush can be configured to tunnel its requests through a two-factor model such as a bastion host. Tunneling through a Bastion Host Using Drush as Part of a Daily Linux Workflow. Using Drush Aliases. "Drush is Awesome!

Using Drush Aliases

" You have probably read that on every single blog that has ever mentioned Drush. That is because it is! I've been using Drush for the past year and a half and it has simplified my Drupal life immensely. In the back of my mind, I knew it could do more. I had been putting off learning Drush aliases for some stupid reason. Aliases are commonly used to define short names for local or remote Drupal installations; however, an alias is really nothing more than a collection of options.

Aliases are amazing because they unlock some of the coolest and most powerful features of Drush.