7

For a couple of weeks now I have been watching various screencasts and envying those who can operate Drush on their sites, esp. when enabling/disabling of the modules, or clearing cache. The time savings seem to be immense.

However, as a more of a front-end developer, rather than a qualified, fluent console operator, I find myself completely lost as per the usage of Drush with remote sites. Most of the googled readings treat about local sites, they specify paths to local installations, or they assume that a site was created using site-install command. While I am interested in adding Drush to an existing remote site. How do I add Drush into play with that remote site?

Now that I'm trying to get the big picture of using Drush, I think I may have missed some principal knowledge about the environment and tools needed, which I haven't found anywhere.

  1. Apart from having command line Drush installed on my desktop, do I have to install Drush module on my remote site? Or is Drupal core Drush-controllable out-of-the-box (if it is, what is the purpose of Drush module available at drupal.org/project/drush)
  2. Do I have to configure SSH for communicating the server?
  3. Do I need to provide db credentials anywhere (where)?
  4. Do I need to define FTP credentials anywhere (where)?
  5. aliases.drushrc.php: does it live only on my desktop, or should I define anything similar on the remote ftp?

My setup involves staging and production sites, the former also stored on a remote ftp server with its own domain. I would like both to be controllable via Drush. Is that feasible?

It'd be great if someone could shed some light on me.

2 Answers 2

6

You have a lot of questions there, but I'll try to give you the best overview of how to do this easily.

First, note that though Drush is listed as a module on Drupal.org, it is not technically a module as you don't "enable" or "disable" it like other modules.

  1. Yes, Drush must be installed on the remote site. When you do so, make sure to install the same version that you have installed locally. It may still work if you're using different versions, but it can also cause strange bugs that are difficult to troubleshoot so always try to keep the same version.

  2. It's certainly easier if you have SSH set up for some of the Drush commands. Your web host should be able to help you with getting SSH keys set up for your local machine.

  3. Yes, you will need to provide DB credentials. This can be done by following the example in drush/examples/example.aliases.drushrc.php in the drush folder.

  4. No, I don't think so.

  5. You do not need to set up the alias on your desktop unless you are going to be logging in to your remote server and using aliases there.

Basically, if you have SSH working and have installed Drush on the remote server as well as your local machine, then, once you set up an alias, you can type something like drush @myremote status and it should work.

1
  • Thanks a lot! Your answers explain a lot. I was confused even more by a representative of my hosting comany, who told me that Drush is meant for controlling locally installed sites only. Commented Apr 20, 2012 at 9:51
2

I created a write-up on how you can use drush with remote sites if you have FTP and database access to them, but not SSH access. It's a bit of setup, but if you can't live without drush, or work with lots of sites, it's worth it.

My writeup, if your local computer is Linux: http://eworldproblems.mbaynton.com/2014/07/drush-remote/

The same principle, if your local computer is Windows: http://classically.me/blogs/drush-synchronization-ftp

1
  • Really like this from your post 'Remote drush with only FTP and database access', quote: "There didn't seem to be much accurate information about how to do it already, with top Google hits saying things like 'you need ssh and drush installed both locally and on the server', 'you can’t', and there was really nobody suggesting anything (..). I stubbornly refused to believe them and came up with a method (..)"
    – sobi3ch
    Commented Jan 31, 2015 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.