Thursday 4: Mark Sonnabaum and Moshe Weitzman, "Drush Deploy"

Deploys your code; Does some other stuff; e.g: Capistrano Fabric Vlad the Deployer.

Capistrano = awesome; some RoR assumptions (override some of their tasks)

Doesn't deploy content, install packages, manage configs; but some overlap

 

Why use? Near instant, no downtime. Rollback, Version control != deployment tool.

Drush deploy is heavily influenced by Capistrano

But... we need SOMETHING in the community; most people aren't using any of the big three from a show of hands

 

PHP 5.3 only; git only. 

Uses site alias groups: a drush feature (scripted command aliases). Also Drush options (deploy.drushrc.php)

 

How it works: directory of config (including releases). Releases, shared (sites/files etc. applied to every release)

 

Aliases:

$aliases[foo] = array(...);

$aliases[bar] = array(...);

drush -v deploy-setup @alias-file-name

 

Strategies - check for dependencies

 

Tracks releases: deploy-rollback rolls back to previous one

 

Tasks to run after actions e.g. something to roll back after a symlink. They prevent deploy-rollback from working.

deploy-cleanup gets rid of unused releases

 

Challenges = patches they sent upstream; site aliases as arguments; example in core is drush sql-sync; Concurrent remote command execution.

 

Options file. Examples of a ['after'] task:  function foo($d) { $d->run('command-on-remote-server-here'); }

A /* @run_once */ comment makes it only run on one server in load-balanced environment

function bar($d) { $d->drush('drush-command-on-remote-server-here'); }

 

Strategies: use namespaces; object overriding