Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Deployer - Deployment tool for PHP

257 views

Published on

Deployer is a php tool that can be used to deploy Php applications. Presentation provided at phplx november in Lisbon.

Published in: Internet
  • Be the first to comment

  • Be the first to like this

Deployer - Deployment tool for PHP

  1. 1. DEPLOYER DEPLOYER.ORG - DEPLOYMENT TOOL FOR PHP HERNÂNI BORGES DE FREITAS PHPLX NOVEMBER 2017
  2. 2. ME -  Long time PHP user ~ early 2000 -  Drupal Expert / Former Acquia -  Freelance Architect and Developer -  Addicted to good hobbies – SerBenfiquista.com Hernani.pt / twitter: hernanibf
  3. 3. DEPLOYMENT 1.  Build release artifact 2.  Identify to which environment you want to deploy (dev, staging , prod). 3.  Ideally you save a backup of previous application state in that environment so you can rollback. 4.  Copy artifact to servers 5.  Execute upgrade procedures (clear cache, update database schemas, configure services, send notifications ). 6.  Application live “Software deployment is all of the activities that make a software system available for use.”
  4. 4. PROBLEMS •  Deployments/releases can take 10% of overall project time •  Downtime involved •  Not automatized? Human errors ready to happen •  Hard to rollback in failures •  Complexity increase with number of web nodes, environments and their difference
  5. 5. WHAT’S TYPICAL •  Copy code to servers •  (FTP, RSYNC, etc..) •  Deploy from source control •  Git pull, svn checkout •  Deploying using other tools / platforms •  Capistrano, Envoyer/Forge, platform tools..
  6. 6. PERFECT WORLD •  Code is controlled in a repository •  Code is deployed directly from a branch or tag. •  Deployment is done AUTOMATICALLY to any environment from a central location •  No human errors, easy to rollback, minimum deployment time and downtime.
  7. 7. MEET DEPLOYER -  PHP package that allows the configuration and execution of deployments (deployer.org). Started in 2013 by Anton Medvedev. -  All deployment configuration defined as a recipe in a single file (deploy.php) -  Define Git origin repository -  Define environments and their hosts -  Define deployer strategy -  Define tasks to be executed in different deployment stages -  Atomic deployment -  All tasks related with deployment in a single atomic step -  Maintains consistency across all servers -  Rollback possible
  8. 8. GOOD FRIENDSHIPS
  9. 9. INSTALLATION Or with composer
  10. 10. SIMPLE CONFIGURATION <?php namespace Deployer; require' recipe/drupal8.php' ; set(' repository' ,' git@bitbucket.org:yourorg/yourepo.git' ); host(' web1.example.com' ) ->stage(' production' ) ->set(' deploy_path' ,' /home/user/site_prod' ); host(' web2.example.com' ) ->stage(' production' ) ->set(' deploy_path' ,' /home/user/site_prod' ); host(' web3.example.com' ) ->stage(' development' ) ->set(' deploy_path' ,' /home/user/site_dev' ); Deploy.php
  11. 11. OTHER FEATURES -  Shared folders set('shared_dirs', [ 'docroot/sites/{{drupal_site}}/files', 'docroot/forum/attachments', 'docroot/forum/avatars', 'docroot/forum/avatars_custom', ]); -  Writable dirs set(' writable_dirs' , [ ' docroot/sites/{{drupal_site}}/files’]); -  Shared files
  12. 12. TYPICAL RECIPE task(' deploy' , [

×