«

Nov 16

Using Drush on Pantheon sites

Problem: How to use Drush on Pantheon

I am currently working on a couple of test sites on Pantheon with installations of Open Atrium. To develop my site I will need to create a sub-theme of the OA default theme. See here and here.

The best way to do this would be with Drush but at first sight how to do this seems impossible or very complex.

Using Drush on Windows looks like a nightmare, so my first thought was to clone the site using Git to a VirtualBox running Ubuntu. However, after running some tests it became clear that this wouldn’t work because the site database wasn’t available to the clone. Drush wouldn’t work so this was a non-starter.

After further reading on Pantheon I came across Drush Aliases. Simply download the aliases, put them into your Drush directory (on any system) and use them to send Drush commands directly into your site. You need to make sure your site is in SFTP mode to allow for changes to be written to the site.

Aliases are in the format:

@pantheon.sitename.siteversion

(version = dev/test/live)

Example command:

drush @pantheon.mysite.dev en module_name -y

(to download and enable a module on the dev site)

So I’m still using my VirtualBox but only so I can run Drush in a Linux environment which is easy to install. I don’t need the clone repo because the Drush commands are sent directly to the Pantheon site. Changes are seen straightaway in your browser (either back in Windows world or in a browser on the VM) and you just switch back to Git mode to commit them.

Say Boom!

 

Further tips:

the .drush folder is a hidden folder. In the file browser press CTRL-H to show hidden files/folders. In the terminal type ls -a to show hidden files/folders in the current directory. So

cd .drush

is what you need.