Getting Started

Installation

There are two main ways to install Deployer: using the PHP archive (phar) or composer. The documentation provides extensive installation instructions. For simplicity we'll install the phar.

$ curl -LO https://deployer.org/deployer.phar
$ mv deployer.phar /usr/local/bin/dep
$ chmod +x /usr/local/bin/dep

Flow

The flow is the order in which tasks are executed. The common flow follows the order of:

<?php
task('deploy', [
    'deploy:prepare',
    'deploy:lock',
    'deploy:release',
    'deploy:update_code',
    'deploy:shared',
    'deploy:writable',
    'deploy:vendors',
    'deploy:clear_paths',
    'deploy:symlink',
    'deploy:unlock',
    'cleanup',
    'success'
]);

In short each stage is an atomic deployment task where typically if one fails the build will not be deployed.

  • deploy:prepare - ensures directory structure for deployment exists (ie. releases folder)
  • deploy:lock - so that there can only be one concurrent deployment
  • deploy:release - creates a new release folder
  • deploy:update-code - pulls code from your Git repository
  • deploy:shared - pesists files between releases (ie. user uploaded files)
  • deploy:writable - sets file permissions (modes: chown, chgrp, chmod or acl)
  • deploy:vendors - install composer dependencies
  • deploy:clear-paths
  • deploy:symlink - swaps the 'current' deployment for this release
  • deploy:unlock - removes lock file and you can trigger another release
  • cleanup - can remove old unwanted releases
  • success - display a success message

A Sulu example deployer configuration was posted in an issue by Alexander Schranz which for reference I have Gisted below.

References:

* Deployer Documentation