Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Auto Trader: from Contininuous Integration to C...

Auto Trader: from Contininuous Integration to Continuous Delivery

Here is a talk I gave at DevOpsManc about our Continuous Delivery team at Auto Trader and their activities facilitating automated deployment, preparing for a move into a private cloud and encouraging a culture of Continuous Delivery.

Mark Crossfield

October 21, 2014
Tweet

More Decks by Mark Crossfield

Other Decks in Technology

Transcript

  1. Background This time last year Continuous Delivery Deployment Monitoring Self

    Contained Applications RPM Builders Yum Repo Indexing The Future CONTENTS
  2. In June 2013 we completed our PRINT TO DIGITAL TRANSITION

    We achieved continued growth of the business throughout.
  3. Over the last five years WE’VE INVESTED HEAVILY IN OUR

    PRODUCTS but not so much in our infrastructure
  4. Over the last year WE’VE KEPT THE LIGHTS ON whilst

    freeing up staff from manual deployments.
  5. http://www.thoughtworks.com/continuous-integration Continuous Integration Continuous Integration (CI) is a development practice

    that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early. ! By integrating regularly, you can detect errors quickly, and locate them more easily.
  6. TESTS RUN AGAINST AN INTEGRATION ENVIRONMENT Used a CentOS virtual

    machine to run the tests locally. We compromised:
  7. STILL ONE PER DAY Although many apps used to be

    none per day We’re more flexible over schedules
  8. SIMPLIFY APP SERVERS BY EMBEDDING THE CONTAINER That way the

    team owns their application container. The goal:
  9. TESTED WITH STUBBED OUT COMMANDS self shunt functions override commands

    to provide inversion of control Chose to write it in Bash
  10. BASH UNOFFICIAL STRICT MODE An easy way to make it

    safer: set -euo pipefail; IFS=$'\n\t'; http://redsymbol.net/articles/unofficial-bash-strict-mode/
  11. This is a spec file #  Generated  from  bundler-­‐1.6.5.gem  by

     gem2rpm  -­‐*-­‐  rpm-­‐spec  -­‐*-­‐   %global  gemname  bundler   ! %global  gemdir  %(ruby  -­‐rubygems  -­‐e  'puts  Gem::dir'  2>/dev/null)   %global  geminstdir  %{gemdir}/gems/%{gemname}-­‐%{version}   %global  rubyabi  1.8   ! Summary:  The  best  way  to  manage  your  application's  dependencies   Name:  rubygem-­‐%{gemname}   Version:  1.6.5   Release:  1%{?dist}   Group:  Development/Languages   License:  closed   URL:  http://bundler.io   Source0:  http://rubygems.org/gems/%{gemname}-­‐%{version}.gem   Requires:  ruby(abi)  =  %{rubyabi}   Requires:  ruby(rubygems)  >=  1.3.6
  12. This is how you call rpmbuild rpmbuild  -­‐v  -­‐V  -­‐-­‐buildroot

     "$TOP_DIR/BUILD"  -­‐-­‐define  "_topdir   $TOP_DIR"  -­‐-­‐define  "_tmppath  $TMP_PATH"  -­‐-­‐define  "_build_name_fmt   %%{NAME}-­‐%%{VERSION}-­‐%%{RELEASE}.%%{ARCH}.rpm"  -­‐-­‐define  "_rpmdir   $PROJECT_ROOT/$outputDir"  -­‐-­‐define  "source_dir  $PROJECT_ROOT"  -­‐-­‐ define  "in_version  $version"  src/some-­‐app-­‐name.spec
  13. SLOPPY RPM NAMING CONVENTIONS The version / release cannot contain

    a dash “-“, but this is not enforced. name-version-release.architecture.rpm
  14. YUM INDEXING In which Mark spends four fifths of the

    time packaging his script Act V:
  15. YUM SUFFERS A SHORT OUTAGE WHILE INDEXING Which is a

    problem when you are publishing more and more packages. The problem:
  16. WE TURNED OFF YUM’S CLIENT CACHE It’s eviction policy is

    simply time based, which prevented deployments. In addition:
  17. WE THOUGHT THIS WAS AWESOME Repositories decouple build environments from

    deployment. Go had recently introduced package polling
  18. No quick wins—everything takes longer than you’d expect Avoid Bash,

    use Shellcheck and Unofficial Bash Strict Mode Don’t deploy your apps with RPMs / don’t use rpmbuild Remember rpmbuild differs between Linux / UNIX flavours Tackling provisioning can make deployment go away Don’t model deployments with your CI tool JVM is good to you—portability is easily taken for granted CONCLUSIONS
  19. IT IS EASY TO SEE HOW TO IMPROVE WITH HINDSIGHT

    We can only see better options now because of the pain we’ve gone through.