Drush for drupal updates
BEFORE READING THIS MAKE SURE YOU’RE HOSTING PROVIDER GIVES YOU SHELL ACCESS. Otherwise, this is useless information.
I have a bunch of drupal websites that I have to update today. Obviously I’ve been pretty lax on updating their code. It’s a pretty common problem for most drupal developers to fall behind in updating the code, because it’s a really boring task, and the updates come in almost daily. It’s also not an emergency if you leave a site be, and rarely update it. I learned how to do it manually, but it is a pain to download all the updates and manually add them. I wanted a way to do this automatically… then I found this:
This gave me some hint that there was a solution called drush. A module that is not a module. oooOOOooo… Like a secret spell of sorts that had a mystical command that would do the job auto-magically. A command is more difficult than a button to click, but for the time saved I wouldn’t mind a command. It takes a really long time to do these updates, and it’s a management nightmare for me because I have dozens of websites to maintain.
The drush module page was of very little help, as was the readme.txt file. However, at least I know that it does more than update. The only thing that I could discern was that this wizardry would get me access to a tool that I could type “drush pm-update” and my troubles would be solved.
Then I found this link: http://ignoredbydinosaurs.com/2010/07/installing-drush-media-temple-grid-server. Ah directions are cool!
I knew I could slide over to the Linux box and make this work after pounding my head against the screen for a while. However, I think that putty would work better. Putty is a sweet little tool for accessing ssh back ends in a command line. However, it’s only for windows, and a pretty advanced tool. It’s a little old looking, and doesn’t require an install, but it’s a pretty awesome little tool for those who can use it.
Great guns, I was inside my server using commands like “cd” to navigate around the directories. Awesome! Now I really needed to install this thing on a test site so that I know it works correctly. So I navigated to one of my sandbox websites. One that I keep on the production server just for funny purposes like this… new tools. Note that, every time I have to test a new tool out on a site live, or development server It’s best practices to have the all the code and modules be up to date.
The problem is that I host multiple websites on the server, so some of the instructions in the first link were a bit off for me. Then I found this, and watched it: http://civicactions.com/blog/2009/jun/10/drush_20_released_screencast_1_installing_drush_and_getting_started
For a host that has multiple sites, it gets a little more involved. Installing drush system-wide is a bit more difficult and involves adding a symbolic link that turns it into a command able to analyze any “folder” that may contain a drupal install. Another way of saying this is that – it is installed system-wide. Yet another way of saying this, is that all I have to do is navigate to any drupal install by typing “cd *folder*” and then type the magic command “drush pm-update”. Obviously installing it on the test website was a bit of a bad move.
I couldn’t be more happy. Now all those guys that chide me for using drupal (most of them use wordpress) will have one less complaint. I have a simple way to update all of the websites without going through the long arduous task of downloading and uploading… simply to update.
Next time I have to do a system wide update I’m going to figure out how to get it down to a single command… maybe a bash or something. The ultimate would be figuring out how to get it to run at regular intervals, or alongside cron. Well, I’ve got to think about that for a while… However, I don’t have time for now. It’s good.
1. Download drush module
2. READ DOCUMENTATION
2. READ Readme.txt – just read up man!
3. Install drush (system-wide OR single-website)… use you’re ftp client maybe, or whatever tool you normally use to install modules.
4. Download putty.exe
5. Set up a putty profile for logging into your production server
6. use putty to get access to server command line.
7. use command line to update *scary for most*