Fetcher is a Drush extension that automates the process of provisioning a Drupal site on a local development environment or a server. This includes setting up the Drupal root, fetching the code (generally from a VCS), creating a database for the site and a user with the necessary privileges to manage it, updating permissions, creating symlinks, setting up server configuration files like Apache’s virtual hosts, and generating drush alias files for your convenience. In addition, fetcher supports post installation tasks that can be run after a site is setup.
Fetcher is highly pluggable, using PHP classes as plugins. Wherever possible functionality and business logic has been baked into handler classes that can be replaced simply by changing some configuration in your drushrc file (see the “Configuration” section below).
Fetcher is configured entirely using array keys. Fetcher provides a large and ever expanding set of configuration keys which are all placed inside the
fetcher key in the drushrc settings array. This prevents fetcher from polluting the global configuration namespace and also prevents fetcher’s developers from typing
fetcher_ before every variable. This
fetcher configuration element is used to override default settings for the build process.
Generally drush allows for several layers of overrides in configuration (settings specified in
/etc/drush/drushrc.php can be overridden by settings in
~/.drushrc.php). Fetcher has the same behavior but merges
fetcher elements so that you can do hierarchical overrides in the fetcher namespace rather than overriding the entire fetcher element as would be the default drush behavior.
- PHP 5.3: Fetcher will only run on PHP 5.3 and newer because it makes extensive use of closures and namespaces. There are no plans to back-port and users wishing to use Fetcher should upgrade.
Fetcher is primarily tested on recent versions of Ubuntu (10.04 and 12.04). Zivtech has published a Vagrant based development environment that ships with Fetcher and could be a good starting point for those looking to setup a new development environment for Drupal work.
Fetcher vs. other platforms
Fetcher vs. Provisoner and Aegir
If you are not familiar with Aegir it is a system for centrally managing multiple Drupal sites and environments from a central Drupal site. With that system you can deploy copies of a Drupal site from one environment to another, roll them back, duplicate them, etc. Aegir is powered by a separate drush extension called provisioner which is responsible for all of the actual provisioning duties. While, on the surface, this seems closely similar to much of what Drush Fetcher aims to do it is all built on the assumption that all of the environments where you need to deploy copies of your code are network addressable which is usually not the case for local development environments. Having a local copy of a Drupal site is almost always the most efficient way to work and Fetcher is aimed at making that simple. Further, provisioner is not built with flexibility in mind and the system is so sophisticated that adding the features and flexibility that was desired from fetcher could be difficult without breaking compatibility with the existing system.
Fetcher vs. Capistrano
Capistrano is an excellent tool but it is also written in Ruby and provides its DSL in ruby. To keep the learning curve smaller for new teams fetcher was written in PHP as a drush extension. This also eases our use of existing drush code that provides much of the underlying functionality.
With the services extension fetcher can give you a list of sites that you have listed in one central drupal site (or another source implementing the same REST interface) and then can create a local instance of that site for development (creating a working directory with public/private file folders, create a database, create a database user, manage permissions, create and enable an apache vhost, etc) and can then run arbitrary site specific steps once the local version has been provisioned (which may include running composer or drush make to put dependencies in place).
Fetcher Backups is a backup system based on fetcher, best used with fetcher services (see above). It is still in active development and not yet ready for production use. It takes an experimental approach using git for storage and synchronization in order to compress all backups while retaining the ability to do relatively efficient comparisons to detect changes.