SlideShare a Scribd company logo
ONE COMMIT
ONE RELEASE
CONTINUOUSLY DELIVERING A PROJECT
Javier López @loalf
Senior Platform Engineer @Rightster!
formerly Software Architect @TimeOut
Certified Symfony Developer
Zend Certified PHP
Co-organizer @desymfony
DISCLAIMER
AGENDA
CONTINUOUS DELIVERY IN A NUTSHELL
BUILDING THE PIPELINE
BEFORE AND AFTER
1
2
3
CONTINUOUS DELIVERY …
… IN A NUTSHELL
1
COMMIT BUILD TEST DEPLOY
When and how a change in your code is
going to trigger the pipeline
COMMIT BUILD TEST DEPLOY
Checks the integerity of your code.
Produces an artifact.
COMMIT BUILD TEST DEPLOY
Checks the integerity of your project.
!
After this step you should be 100% confident that
you could deploy your artifact.
COMMIT BUILD TEST DEPLOY
Does what it says in the tin. Triggering this
step should be “a click away”.
Manual
COMMIT BUILD TEST DEPLOY
Does what it says in the tin. Triggering this
step should be “a click away”.
Manual
THE BOOK
THE PIPELINE
BUILDING
2
TOOLS!
OF THE TRADE
One commit, one release. Continuously delivering a Symfony project.
One commit, one release. Continuously delivering a Symfony project.
One commit, one release. Continuously delivering a Symfony project.
One commit, one release. Continuously delivering a Symfony project.
One commit, one release. Continuously delivering a Symfony project.
BUILDING!
THE PIPELINE
COMMIT BUILD TEST DEPLOY
master
6ebb017
COMMIT BUILD TEST DEPLOY
master
featureA
6ebb017
COMMIT BUILD TEST DEPLOY
master
featureA
6ebb017
PULL REQUEST
COMMIT BUILD TEST DEPLOY
master
featureA
6ebb017 9046c48
COMMIT BUILD TEST DEPLOY
master
featureA
6ebb017 9046c48
BUILD TEST DEPLOY
COMMIT BUILD TEST DEPLOY
1. Checkout out master branch
COMMIT BUILD TEST DEPLOY
1. Checkout out master branch
2. Generate parameters.ini for each environment
COMMIT BUILD TEST DEPLOY
1. Checkout out master branch
2. Generate parameters.ini for each environment
3. Fetch PHP dependencies
COMMIT BUILD TEST DEPLOY
1. Checkout out master branch
2. Generate parameters.ini for each environment
3. Fetch PHP dependencies
COMMIT BUILD TEST DEPLOY
—optimizer-­‐autoload  —prefer-­‐dist
1. Checkout out master branch
2. Generate parameters.ini for each environment
3. Fetch PHP dependencies
COMMIT BUILD TEST DEPLOY
1. Checkout out master branch
2. Generate parameters.ini for each environment
3. Fetch PHP dependencies
4. Run PHPUnit tests
COMMIT BUILD TEST DEPLOY
1. Checkout out master branch
2. Generate parameters.ini for each environment
3. Fetch PHP dependencies
4. Run PHPUnit tests
5. Fetch JS dependencies
COMMIT BUILD TEST DEPLOY
1. Checkout out master branch
2. Generate parameters.ini for each environment
3. Fetch PHP dependencies
4. Run PHPUnit tests
5. Fetch JS dependencies
6. Generate assets (JS, CSS)
COMMIT BUILD TEST DEPLOY
1. Checkout out master branch
2. Generate parameters.ini for each environment
3. Fetch PHP dependencies
4. Run PHPUnit tests
5. Fetch JS dependencies
6. Generate assets (JS, CSS)
7. Generate artifact (zip file)
COMMIT BUILD TEST DEPLOY
1. Checkout out master branch
2. Generate parameters.ini for each environment
3. Fetch PHP dependencies
4. Run PHPUnit tests
5. Fetch JS dependencies
6. Generate assets (JS, CSS)
7. Generate artifact (zip file)
COMMIT BUILD TEST DEPLOY
discard unneeded files
1. Checkout out master branch
2. Generate parameters.ini for each environment
3. Fetch PHP dependencies
4. Run PHPUnit tests
5. Fetch JS dependencies
6. Generate assets (JS, CSS)
7. Generate artifact (zip file)
COMMIT BUILD TEST DEPLOY
1. Checkout out master branch
2. Generate parameters.ini for each environment
3. Fetch PHP dependencies
4. Run PHPUnit tests
5. Fetch JS dependencies
6. Generate assets (JS, CSS)
7. Generate artifact (zip file)
8. Upload artifact to S3
COMMIT BUILD TEST DEPLOY
1. Checkout out master branch
2. Generate parameters.ini for each environment
3. Fetch PHP dependencies
4. Run PHPUnit tests
5. Fetch JS dependencies
6. Generate assets (JS, CSS)
7. Generate artifact (zip file)
8. Upload artifact to S3
COMMIT BUILD TEST DEPLOYbuild.xml
<?xml  version="1.0"  encoding="UTF-­‐8"  ?>  
<project  name="Time  Out  Miyagi"  description="Time  Out  Website  V4"  default="build"    
!
    <!-­‐-­‐  Install  PHP  dependencies  (composer)  -­‐-­‐>  
    <target  name="build:php-­‐dependencies"  depends="build:params">  
        <echo  msg="Installing  PHP  dependencies  (composer  install)"  />  
        <exec  command="/opt/composer/composer.phar  install  -­‐-­‐optimize-­‐autoloader  -­‐-­‐prefer-­‐dist"    
                    logoutput="true"    
                    checkreturn=“true"  
        />  
    </target>  
!
    <!-­‐-­‐  Test  JS  &  Generate  JS/CSS  assets  (grunt)  -­‐-­‐>  
    <target  name="build:frontend-­‐dependencies">  
        <echo  msg="Test  JS  and  Generate  JS/CSS  assets  (grunt)"  />  
        <exec  command="npm  install"    
                    logoutput="true"  checkreturn="true"  dir="./web-­‐src"  />  
        <exec  command="xvfb-­‐run  grunt  -­‐-­‐env=dist"    
                    logoutput="true"  checkreturn="true"  dir="./web-­‐src"  />      
    </target>  
     
</project>
build.xml
COMMIT BUILD TEST DEPLOY
Split into two jobs in Jenkins
1. Test deployment script
2. Run automated tests
COMMIT BUILD TEST DEPLOY
TEST DEPLOYMENT SCRIPT
COMMIT BUILD TEST DEPLOY
TEST DEPLOYMENT SCRIPT
1. SSH to QA server
COMMIT BUILD TEST DEPLOY
TEST DEPLOYMENT SCRIPT
1. SSH to QA server
2. Fetch artifact from S3
COMMIT BUILD TEST DEPLOY
TEST DEPLOYMENT SCRIPT
1. SSH to QA server
2. Fetch artifact from S3
3. Unzip artifact
COMMIT BUILD TEST DEPLOY
TEST DEPLOYMENT SCRIPT
1. SSH to QA server
2. Fetch artifact from S3
3. Unzip artifact
4. Set right permissions
COMMIT BUILD TEST DEPLOY
TEST DEPLOYMENT SCRIPT
1. SSH to QA server
2. Fetch artifact from S3
3. Unzip artifact
4. Set right permissions
5. Update virtual host
COMMIT BUILD TEST DEPLOY
TEST DEPLOYMENT SCRIPT
1. SSH to QA server
2. Fetch artifact from S3
3. Unzip artifact
4. Set right permissions
5. Update virtual host
6. Reload PHP-FPM and nginx
-­‐-­‐-­‐  
-­‐  hosts:  qa:beta:prod  
    sudo:  true  
    vars:  
        amazon_bucket  :  "releases-­‐miyagi"  
        base_dir            :  "/var/www/v4.timeout.com"  
        project_dir      :  "{{  base_dir  }}/{{  git_hash  }}"  
        web_dir              :  "{{  project_dir  }}/web"  
    tasks:  
        -­‐  name:  Fetch  artefact  from  S3  
            s3:  bucket={{  amazon_bucket  }}  aws_access_key={{  amazon_key  }}  
aws_secret_key={{  amazon_secret  }}  object={{  git_hash  }}.gzip  dest="{{  project_dir  
}}/{{artefact_zip}}"  mode="get"  
!
        -­‐  name:  Uncompress  zip  file  
            command:  chdir="{{  project_dir  }}"  tar  -­‐xf  {{  artefact_zip  }}  
!
        -­‐  name:  Apply  right  permissions  to  project  root  
            file:  dest="{{  project_dir  }}"  state=directory  mode=0755  group=nginx  
owner=nginx  recurse=true  
          
        -­‐  name:  Restart  PHP-­‐FPM    
            service:  name=php-­‐fpm  state=reloaded
deploy.yml
COMMIT BUILD TEST DEPLOY
RUN AUTOMATED TESTS
COMMIT BUILD TEST DEPLOY
RUN AUTOMATED TESTS
1. Checkout 9046c48
COMMIT BUILD TEST DEPLOY
RUN AUTOMATED TESTS
1. Checkout 9046c48
2. Fetch PHP dependencies
COMMIT BUILD TEST DEPLOY
RUN AUTOMATED TESTS
1. Checkout 9046c48
2. Fetch PHP dependencies
3. Run behat against QA box
COMMIT BUILD TEST DEPLOY
Split into two jobs in Jenkins
1. Run deployment script (production)
2. Run automated tests agains production
BUILD DEPLOY
AUTOMATED!
TESTS
6ebb017
6ebb017
QA
6ebb017
QA
DEPLOY
AUTOMATED!
TESTS
6ebb017
PROD
6ebb017
PROD
6ebb017
6ebb017.zip
BUILD DEPLOY
AUTOMATED!
TESTS
6ebb017
6ebb017
QA
6ebb017
QA
DEPLOY
AUTOMATED!
TESTS
6ebb017
STAGING
6ebb017
STAGING
DEPLOY
AUTOMATED!
TESTS
6ebb017
PROD
6ebb017
PROD
6ebb017
6ebb017.zip
SAFETY NET
PARAMETERS.INI!
DILEMMA
1. One parameters.ini per environment
2. Inject environment specific parameters on virtual host
http://symfony.com/doc/current/cookbook/configuration/external_parameters.html
TIME
BUILD DEPLOY
AUTOMATED!
TESTS
~3 mins ~30 secs ~5 mins
VISIBILITY
EVERYBODY IN THE TEAM SHOULD BE
AWARE OF THE STATUS OF THE PIPELINE
BUILD DEPLOY
AUTOMATED!
TESTS
9046c48
9046c48
QA
9046c48
QA
9046c48
BUILD DEPLOY
AUTOMATED!
TESTS
6ebb017
6ebb017
QA
6ebb017
QA
6ebb017
BUILD DEPLOY
AUTOMATED!
TESTS
b0b325
b0b325
QA
b0b325
QA
b0b325
BUILD DEPLOY
AUTOMATED!
TESTS
99e6d6
99e6d6
QA
99e6d6
QA
99e6d6
One commit, one release. Continuously delivering a Symfony project.
TRACEABILITY
EVERYBODY SHOULD KNOW WHAT VERSION
IS DEPLOYED IN WHICH ENVIRONMENT
curl  -­‐I  http://www.timeout.com/las-­‐vegas  
!
HTTP/1.1  200  OK  
Server:  nginx/1.4.7  
Vary:  Accept-­‐Encoding  
Cache-­‐Control:  no-­‐cache  
Content-­‐Type:  text/html;  charset=UTF-­‐8  
Date:  Fri,  19  Sep  2014  06:07:29  GMT  
Transfer-­‐Encoding:  chunked  
Access-­‐Control-­‐Allow-­‐Origin:  http://media.timeout.com  
Connection:  Keep-­‐Alive  
X-­‐TIMEOUT-­‐V:  d645127afb423e543d90ab5a7b8eae94f248b137  
X-­‐Powered-­‐By:  PHP/5.5.14
VERSION NUMBER
https://github.com/symfony/symfony/commits/a469c56
ROLLING!
BACK
YOU’LL NEED!
ALLIES
YOUR ALLIES
DEV TEAM
YOUR ALLIES
DEV TEAM
QA TEAM
YOUR ALLIES
DEV TEAM
QA TEAM
DEVOPS
YOUR ALLIES
DEV TEAM
QA TEAM
DEVOPS
PRODUCT
YOUR ALLIES
DEV TEAM
QA TEAM
DEVOPS
PRODUCT
THE BRASS
YOUR ALLIES
BEFORE AFTER&
3
ONE QA BOX PER FEATURE
SAME QA BOX FOR EVERYONE
BEFORE
AFTER
~ !WEEKS FROM DEVELOPMENT TO RELEASE
~ !DAYS FROM DEVELOPMENT TO RELEASE
BEFORE
AFTER
5 PEOPLE TO RELEASE TO PRODUCTION
1 PERSON TO RELEASE TO PRODUCTION
BEFORE
AFTER
~30 MINUTES TO RUN DEPLOYMENT SCRIPT
~30 SECONDS TO RUN DEPLOYMENT SCRIPT
BEFORE
AFTER
RELEASING WAS AN EVENT
RELEASING WAS A NO EVENT
BEFORE
AFTER
@loalf

More Related Content

PDF
Супер быстрая автоматизация тестирования на iOS
PDF
Gearman work queue in php
PDF
JCConf 2015 workshop 動手玩 Java 專案建置工具
PPTX
PHP & JavaScript & CSS Coding style
PDF
Automate Your Automation | DrupalCon Vienna
PDF
Namshi in 2014: let's rock!
PDF
Instrumentación de entrega continua con Gitlab
PDF
How to integrate front end tool via gruntjs
Супер быстрая автоматизация тестирования на iOS
Gearman work queue in php
JCConf 2015 workshop 動手玩 Java 專案建置工具
PHP & JavaScript & CSS Coding style
Automate Your Automation | DrupalCon Vienna
Namshi in 2014: let's rock!
Instrumentación de entrega continua con Gitlab
How to integrate front end tool via gruntjs

What's hot (20)

PDF
Testing Web Applications
PDF
London Hashicorp Meetup #8 - Testing Programmable Infrastructure By Matt Long
PDF
vJUG - The JavaFX Ecosystem
PDF
[CLIW] Web testing
PDF
Docker for (Java) Developers
PDF
淺談 Geb 網站自動化測試(JCConf 2014)
ODP
Vagrant move over, here is Docker
PPTX
Vagrant introduction for Developers
PDF
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
PDF
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
PDF
oVirt CI Package Managenent
PDF
Drone 1.0 Feature
PDF
JHipster Conf 2018 : Connect your JHipster apps to the world of APIs with Ope...
PDF
Antons Kranga Building Agile Infrastructures
PDF
Trust, but verify | Testing with Docker Containers
PDF
Drone CI/CD 自動化測試及部署
PDF
Automated acceptance test
PDF
(Declarative) Jenkins Pipelines
PDF
Jenkins Pipelines
PDF
淺談 Groovy 與 AWS 雲端應用開發整合
Testing Web Applications
London Hashicorp Meetup #8 - Testing Programmable Infrastructure By Matt Long
vJUG - The JavaFX Ecosystem
[CLIW] Web testing
Docker for (Java) Developers
淺談 Geb 網站自動化測試(JCConf 2014)
Vagrant move over, here is Docker
Vagrant introduction for Developers
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
oVirt CI Package Managenent
Drone 1.0 Feature
JHipster Conf 2018 : Connect your JHipster apps to the world of APIs with Ope...
Antons Kranga Building Agile Infrastructures
Trust, but verify | Testing with Docker Containers
Drone CI/CD 自動化測試及部署
Automated acceptance test
(Declarative) Jenkins Pipelines
Jenkins Pipelines
淺談 Groovy 與 AWS 雲端應用開發整合
Ad

Similar to One commit, one release. Continuously delivering a Symfony project. (20)

PDF
Continous Delivering a PHP application
PDF
Build & deploy PHP application (intro level)
PPTX
Symfony under control. Continuous Integration and Automated Deployments in Sy...
PPTX
Symfony Under Control by Maxim Romanovsky
PDF
Rock Solid Deployment of Web Applications
PDF
Deployment Tactics
PDF
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
PDF
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
PDF
Continuous Integration at Mollie
PDF
Deploying software at Scale
PDF
Makefiles in 2020 — Why they still matter
PDF
Evolution of deploy.sh
KEY
Full-Stack CakePHP Deployment
PPTX
Automated Deployment Pipeline using Jenkins, Puppet, Mcollective and AWS
PDF
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
PDF
Building and Deploying PHP Applications, PHPTour 2016
PDF
Continous delivery with Jenkins and Chef
PDF
Building and Deploying PHP apps with Phing
PPTX
Continuos Integration @Knetminer
PDF
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Continous Delivering a PHP application
Build & deploy PHP application (intro level)
Symfony under control. Continuous Integration and Automated Deployments in Sy...
Symfony Under Control by Maxim Romanovsky
Rock Solid Deployment of Web Applications
Deployment Tactics
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
Continuous Integration at Mollie
Deploying software at Scale
Makefiles in 2020 — Why they still matter
Evolution of deploy.sh
Full-Stack CakePHP Deployment
Automated Deployment Pipeline using Jenkins, Puppet, Mcollective and AWS
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
Building and Deploying PHP Applications, PHPTour 2016
Continous delivery with Jenkins and Chef
Building and Deploying PHP apps with Phing
Continuos Integration @Knetminer
Continuous Infrastructure: Modern Puppet for the Jenkins Project - PuppetConf...
Ad

More from Javier López (8)

PDF
PHP's FIG and PSRs
PDF
Slides changes symfony23
PDF
Novedades en Symfony 2.3
PDF
Shifting gears with Composer
PDF
Componentes, el arma secreta de Symfony2
PDF
Slides components en
KEY
Slides componentes
ODP
Symfony y Admin Generator
PHP's FIG and PSRs
Slides changes symfony23
Novedades en Symfony 2.3
Shifting gears with Composer
Componentes, el arma secreta de Symfony2
Slides components en
Slides componentes
Symfony y Admin Generator

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Empathic Computing: Creating Shared Understanding
PDF
Machine learning based COVID-19 study performance prediction
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Cloud computing and distributed systems.
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Approach and Philosophy of On baking technology
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Empathic Computing: Creating Shared Understanding
Machine learning based COVID-19 study performance prediction
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
20250228 LYD VKU AI Blended-Learning.pptx
Spectroscopy.pptx food analysis technology
NewMind AI Weekly Chronicles - August'25 Week I
Spectral efficient network and resource selection model in 5G networks
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Cloud computing and distributed systems.
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
“AI and Expert System Decision Support & Business Intelligence Systems”
Diabetes mellitus diagnosis method based random forest with bat algorithm
Approach and Philosophy of On baking technology
Reach Out and Touch Someone: Haptics and Empathic Computing
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx

One commit, one release. Continuously delivering a Symfony project.

  • 1. ONE COMMIT ONE RELEASE CONTINUOUSLY DELIVERING A PROJECT
  • 2. Javier López @loalf Senior Platform Engineer @Rightster! formerly Software Architect @TimeOut Certified Symfony Developer Zend Certified PHP Co-organizer @desymfony
  • 4. AGENDA CONTINUOUS DELIVERY IN A NUTSHELL BUILDING THE PIPELINE BEFORE AND AFTER 1 2 3
  • 5. CONTINUOUS DELIVERY … … IN A NUTSHELL 1
  • 6. COMMIT BUILD TEST DEPLOY When and how a change in your code is going to trigger the pipeline
  • 7. COMMIT BUILD TEST DEPLOY Checks the integerity of your code. Produces an artifact.
  • 8. COMMIT BUILD TEST DEPLOY Checks the integerity of your project. ! After this step you should be 100% confident that you could deploy your artifact.
  • 9. COMMIT BUILD TEST DEPLOY Does what it says in the tin. Triggering this step should be “a click away”. Manual
  • 10. COMMIT BUILD TEST DEPLOY Does what it says in the tin. Triggering this step should be “a click away”. Manual
  • 20. COMMIT BUILD TEST DEPLOY master 6ebb017
  • 21. COMMIT BUILD TEST DEPLOY master featureA 6ebb017
  • 22. COMMIT BUILD TEST DEPLOY master featureA 6ebb017 PULL REQUEST
  • 23. COMMIT BUILD TEST DEPLOY master featureA 6ebb017 9046c48
  • 24. COMMIT BUILD TEST DEPLOY master featureA 6ebb017 9046c48 BUILD TEST DEPLOY
  • 26. 1. Checkout out master branch COMMIT BUILD TEST DEPLOY
  • 27. 1. Checkout out master branch 2. Generate parameters.ini for each environment COMMIT BUILD TEST DEPLOY
  • 28. 1. Checkout out master branch 2. Generate parameters.ini for each environment 3. Fetch PHP dependencies COMMIT BUILD TEST DEPLOY
  • 29. 1. Checkout out master branch 2. Generate parameters.ini for each environment 3. Fetch PHP dependencies COMMIT BUILD TEST DEPLOY —optimizer-­‐autoload  —prefer-­‐dist
  • 30. 1. Checkout out master branch 2. Generate parameters.ini for each environment 3. Fetch PHP dependencies COMMIT BUILD TEST DEPLOY
  • 31. 1. Checkout out master branch 2. Generate parameters.ini for each environment 3. Fetch PHP dependencies 4. Run PHPUnit tests COMMIT BUILD TEST DEPLOY
  • 32. 1. Checkout out master branch 2. Generate parameters.ini for each environment 3. Fetch PHP dependencies 4. Run PHPUnit tests 5. Fetch JS dependencies COMMIT BUILD TEST DEPLOY
  • 33. 1. Checkout out master branch 2. Generate parameters.ini for each environment 3. Fetch PHP dependencies 4. Run PHPUnit tests 5. Fetch JS dependencies 6. Generate assets (JS, CSS) COMMIT BUILD TEST DEPLOY
  • 34. 1. Checkout out master branch 2. Generate parameters.ini for each environment 3. Fetch PHP dependencies 4. Run PHPUnit tests 5. Fetch JS dependencies 6. Generate assets (JS, CSS) 7. Generate artifact (zip file) COMMIT BUILD TEST DEPLOY
  • 35. 1. Checkout out master branch 2. Generate parameters.ini for each environment 3. Fetch PHP dependencies 4. Run PHPUnit tests 5. Fetch JS dependencies 6. Generate assets (JS, CSS) 7. Generate artifact (zip file) COMMIT BUILD TEST DEPLOY discard unneeded files
  • 36. 1. Checkout out master branch 2. Generate parameters.ini for each environment 3. Fetch PHP dependencies 4. Run PHPUnit tests 5. Fetch JS dependencies 6. Generate assets (JS, CSS) 7. Generate artifact (zip file) COMMIT BUILD TEST DEPLOY
  • 37. 1. Checkout out master branch 2. Generate parameters.ini for each environment 3. Fetch PHP dependencies 4. Run PHPUnit tests 5. Fetch JS dependencies 6. Generate assets (JS, CSS) 7. Generate artifact (zip file) 8. Upload artifact to S3 COMMIT BUILD TEST DEPLOY
  • 38. 1. Checkout out master branch 2. Generate parameters.ini for each environment 3. Fetch PHP dependencies 4. Run PHPUnit tests 5. Fetch JS dependencies 6. Generate assets (JS, CSS) 7. Generate artifact (zip file) 8. Upload artifact to S3 COMMIT BUILD TEST DEPLOYbuild.xml
  • 39. <?xml  version="1.0"  encoding="UTF-­‐8"  ?>   <project  name="Time  Out  Miyagi"  description="Time  Out  Website  V4"  default="build"     !    <!-­‐-­‐  Install  PHP  dependencies  (composer)  -­‐-­‐>      <target  name="build:php-­‐dependencies"  depends="build:params">          <echo  msg="Installing  PHP  dependencies  (composer  install)"  />          <exec  command="/opt/composer/composer.phar  install  -­‐-­‐optimize-­‐autoloader  -­‐-­‐prefer-­‐dist"                        logoutput="true"                        checkreturn=“true"          />      </target>   !    <!-­‐-­‐  Test  JS  &  Generate  JS/CSS  assets  (grunt)  -­‐-­‐>      <target  name="build:frontend-­‐dependencies">          <echo  msg="Test  JS  and  Generate  JS/CSS  assets  (grunt)"  />          <exec  command="npm  install"                        logoutput="true"  checkreturn="true"  dir="./web-­‐src"  />          <exec  command="xvfb-­‐run  grunt  -­‐-­‐env=dist"                        logoutput="true"  checkreturn="true"  dir="./web-­‐src"  />          </target>       </project> build.xml
  • 40. COMMIT BUILD TEST DEPLOY Split into two jobs in Jenkins 1. Test deployment script 2. Run automated tests
  • 41. COMMIT BUILD TEST DEPLOY TEST DEPLOYMENT SCRIPT
  • 42. COMMIT BUILD TEST DEPLOY TEST DEPLOYMENT SCRIPT 1. SSH to QA server
  • 43. COMMIT BUILD TEST DEPLOY TEST DEPLOYMENT SCRIPT 1. SSH to QA server 2. Fetch artifact from S3
  • 44. COMMIT BUILD TEST DEPLOY TEST DEPLOYMENT SCRIPT 1. SSH to QA server 2. Fetch artifact from S3 3. Unzip artifact
  • 45. COMMIT BUILD TEST DEPLOY TEST DEPLOYMENT SCRIPT 1. SSH to QA server 2. Fetch artifact from S3 3. Unzip artifact 4. Set right permissions
  • 46. COMMIT BUILD TEST DEPLOY TEST DEPLOYMENT SCRIPT 1. SSH to QA server 2. Fetch artifact from S3 3. Unzip artifact 4. Set right permissions 5. Update virtual host
  • 47. COMMIT BUILD TEST DEPLOY TEST DEPLOYMENT SCRIPT 1. SSH to QA server 2. Fetch artifact from S3 3. Unzip artifact 4. Set right permissions 5. Update virtual host 6. Reload PHP-FPM and nginx
  • 48. -­‐-­‐-­‐   -­‐  hosts:  qa:beta:prod      sudo:  true      vars:          amazon_bucket  :  "releases-­‐miyagi"          base_dir            :  "/var/www/v4.timeout.com"          project_dir      :  "{{  base_dir  }}/{{  git_hash  }}"          web_dir              :  "{{  project_dir  }}/web"      tasks:          -­‐  name:  Fetch  artefact  from  S3              s3:  bucket={{  amazon_bucket  }}  aws_access_key={{  amazon_key  }}   aws_secret_key={{  amazon_secret  }}  object={{  git_hash  }}.gzip  dest="{{  project_dir   }}/{{artefact_zip}}"  mode="get"   !        -­‐  name:  Uncompress  zip  file              command:  chdir="{{  project_dir  }}"  tar  -­‐xf  {{  artefact_zip  }}   !        -­‐  name:  Apply  right  permissions  to  project  root              file:  dest="{{  project_dir  }}"  state=directory  mode=0755  group=nginx   owner=nginx  recurse=true                    -­‐  name:  Restart  PHP-­‐FPM                service:  name=php-­‐fpm  state=reloaded deploy.yml
  • 49. COMMIT BUILD TEST DEPLOY RUN AUTOMATED TESTS
  • 50. COMMIT BUILD TEST DEPLOY RUN AUTOMATED TESTS 1. Checkout 9046c48
  • 51. COMMIT BUILD TEST DEPLOY RUN AUTOMATED TESTS 1. Checkout 9046c48 2. Fetch PHP dependencies
  • 52. COMMIT BUILD TEST DEPLOY RUN AUTOMATED TESTS 1. Checkout 9046c48 2. Fetch PHP dependencies 3. Run behat against QA box
  • 53. COMMIT BUILD TEST DEPLOY Split into two jobs in Jenkins 1. Run deployment script (production) 2. Run automated tests agains production
  • 57. 1. One parameters.ini per environment 2. Inject environment specific parameters on virtual host http://symfony.com/doc/current/cookbook/configuration/external_parameters.html
  • 58. TIME
  • 60. VISIBILITY EVERYBODY IN THE TEAM SHOULD BE AWARE OF THE STATUS OF THE PIPELINE
  • 61. BUILD DEPLOY AUTOMATED! TESTS 9046c48 9046c48 QA 9046c48 QA 9046c48 BUILD DEPLOY AUTOMATED! TESTS 6ebb017 6ebb017 QA 6ebb017 QA 6ebb017 BUILD DEPLOY AUTOMATED! TESTS b0b325 b0b325 QA b0b325 QA b0b325 BUILD DEPLOY AUTOMATED! TESTS 99e6d6 99e6d6 QA 99e6d6 QA 99e6d6
  • 63. TRACEABILITY EVERYBODY SHOULD KNOW WHAT VERSION IS DEPLOYED IN WHICH ENVIRONMENT
  • 64. curl  -­‐I  http://www.timeout.com/las-­‐vegas   ! HTTP/1.1  200  OK   Server:  nginx/1.4.7   Vary:  Accept-­‐Encoding   Cache-­‐Control:  no-­‐cache   Content-­‐Type:  text/html;  charset=UTF-­‐8   Date:  Fri,  19  Sep  2014  06:07:29  GMT   Transfer-­‐Encoding:  chunked   Access-­‐Control-­‐Allow-­‐Origin:  http://media.timeout.com   Connection:  Keep-­‐Alive   X-­‐TIMEOUT-­‐V:  d645127afb423e543d90ab5a7b8eae94f248b137   X-­‐Powered-­‐By:  PHP/5.5.14 VERSION NUMBER
  • 75. ONE QA BOX PER FEATURE SAME QA BOX FOR EVERYONE BEFORE AFTER
  • 76. ~ !WEEKS FROM DEVELOPMENT TO RELEASE ~ !DAYS FROM DEVELOPMENT TO RELEASE BEFORE AFTER
  • 77. 5 PEOPLE TO RELEASE TO PRODUCTION 1 PERSON TO RELEASE TO PRODUCTION BEFORE AFTER
  • 78. ~30 MINUTES TO RUN DEPLOYMENT SCRIPT ~30 SECONDS TO RUN DEPLOYMENT SCRIPT BEFORE AFTER
  • 79. RELEASING WAS AN EVENT RELEASING WAS A NO EVENT BEFORE AFTER