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

Immutable Infrastructure: the new App Deployment

Immutable Infrastructure: the new App Deployment

Immutable Infrastructure: the new App Deployment

App deployment and server setup are complex, error-prone and time-consuming. They require OS installers, package managers, configuration recipes, install and deployment scripts, server tuning, hardening and more. But... Is this really necessary? Are we trapped in a mindset of doing things this way just because that's how they've always done?

What if we could start over and radically simplify all this? What if, within seconds, and with a single command, we could wrap our application into the bare minimal machine required to run it? What if this machine could then be transported and run unchanged on our laptop and in the cloud? How do the various platforms and tools like AWS, Docker, Heroku and Boxfuse fit into this picture? What are their strengths and weaknesses? When should you use them?

This talk is for developers and architects wishing to radically improve and simplify how they deploy their applications. It takes Continuous Delivery to a level far beyond what you've seen today. Welcome to Immutable Infrastructure generation. This is the new black.

Axel Fontaine

May 25, 2015
Tweet

More Decks by Axel Fontaine

Other Decks in Technology

Transcript

  1. Immutable Infrastructure
    The New App Deployment
    AXEL FONTAINE
    @axelfontaine
    [email protected]

    View full-size slide

  2. About Axel Fontaine
    • Founder and CEO of Boxfuse
    • Over 15 years industry experience
    • Continuous Delivery expert
    • Regular speaker at tech conferences
    • JavaOne RockStar in 2014
    @axelfontaine

    View full-size slide

  3. flywaydb.org

    View full-size slide

  4. Let’s start with a small story

    View full-size slide

  5. http://commons.wikimedia.org/wiki/File:Gluehlampe_01_KMJ.jpg
    Incandescent Bulb
    60 W
    LED Bulb
    10 W

    View full-size slide

  6. Heater that gives off
    a little bit of light
    Light that gives off
    a little bit of heat

    View full-size slide

  7. Edison Screw

    View full-size slide

  8. Simple, stable,
    standards-compliant
    interface
    with a clear contract
    My
    responsibility
    The electricity company’s
    responsibility

    View full-size slide

  9. Simple, stable,
    standards-compliant
    interface
    with a clear contract
    Room
    For
    Innovation
    Undifferentiated
    Heavy Lifting

    View full-size slide

  10. back to IT infrastructure …

    View full-size slide

  11. POLL:
    what type of infrastructure are you running on?
    • On Premise
    • Colocation
    • Root Server
    • Cloud

    View full-size slide

  12. How did this evolve ?

    View full-size slide

  13. sometime in the 20th century …

    View full-size slide

  14. http://en.wikipedia.org/wiki/File:Tdkc60cassette.jpg

    View full-size slide

  15. +
    =
    ON
    PREM
    +
    Challenges
    • Power, Network, Cooling
    • Physical Security
    • Physical Space
    • Procurement, Vendor Management
    • Capacity Planning
    • Financing
    • OS + Patches
    • App + Updates

    View full-size slide

  16. +
    =
    ON
    PREM
    +
    Our
    responsibility

    View full-size slide

  17. + +
    Our
    responsibility
    Their
    responsibility
    =
    COLO

    View full-size slide

  18. +
    =
    COLO
    +
    Simple, stable,
    standards-compliant
    interface:
    (19” Rack, AC Power,
    Ethernet, …)

    View full-size slide

  19. Can change as
    long as it
    complies with
    the interface
    contract
    +
    =
    COLO
    + Undifferentiated
    Heavy Lifting
    Our
    responsibility

    View full-size slide

  20. =
    ROOT
    SERVER
    + Undifferentiated
    Heavy Lifting
    Our
    responsibility
    Can change as
    long as it
    complies with
    the interface
    contract

    View full-size slide

  21. =
    ROOT
    SERVER
    + Undifferentiated
    Heavy Lifting
    Simple, stable, standards-
    compliant interface
    Software <-> Hardware

    View full-size slide

  22. Room
    For
    Innovation
    + Undifferentiated
    Heavy Lifting
    Could this be our industry’s Edison Screw?
    Simple, stable, standards-
    compliant interface

    View full-size slide

  23. Let’s talk about software

    View full-size slide

  24. POLL:
    which level of automation are you at?
    • Build
    • Unit Tests
    • Continuous Integration
    • Acceptance Tests
    • Continuous Deployment (Code)
    • Continuous Deployment (Code + DB + Configuration)
    • Infrastructure

    View full-size slide

  25. • One immutable unit
    • Regenerated after every change
    • Promoted from Environment to Environment
    Classic Mistake: Build per Environment

    View full-size slide

  26. OS Kernel
    Libraries
    Language
    App Server
    App

    View full-size slide

  27. OS Kernel
    Libraries
    Language
    App Server
    App

    View full-size slide

  28. why aren’t we doing the same
    for the layers this is running on ???

    View full-size slide

  29. what could possibly go wrong
    in these other layers ???

    View full-size slide

  30. missing software

    View full-size slide

  31. incorrect permissions

    View full-size slide

  32. http://www.flickr.com/photos/travelinlibrarian/2409633653/sizes/l/
    critical resource in use

    View full-size slide

  33. what aren’t we holding our servers to the
    same standards as our applications ???

    View full-size slide

  34. OS Kernel
    Libraries
    Language
    App Server
    App
    Build Test

    View full-size slide

  35. OS Kernel
    Libraries
    Language
    App Server
    App
    Build Test
    App

    View full-size slide

  36. OS Kernel
    Libraries
    Language
    App Server
    App
    OS Kernel
    Libraries
    Language
    App Server
    App
    OS Kernel
    Libraries
    Language
    App Server
    App
    Multiple instances in multiple Environments

    View full-size slide

  37. OS Kernel
    Libraries
    Language
    App Server
    App
    Multiple instances in multiple Environments
    • All instances should be as similar as possible
    (any difference is a potential source of errors)
    • That also includes your local Dev environment!
    • Must be able to reliably provision new ones
    (and recreate existing ones from scratch)

    View full-size slide

  38. OS Kernel
    Libraries
    Language
    App Server
    App
    OS Kernel
    Libraries
    Language
    App Server
    App
    OS Kernel
    Libraries
    Language
    App Server
    App
    Updates Updates
    Updates
    Sysadmin

    View full-size slide

  39. If I had asked my
    customers what they
    wanted they would have
    said a faster horse.
    Henry Ford

    View full-size slide

  40. OS Kernel
    Libraries
    Language
    App Server
    App
    OS Kernel
    Libraries
    Language
    App Server
    App
    OS Kernel
    Libraries
    Language
    App Server
    App
    Updates Updates
    Updates
    Sysadmin

    View full-size slide

  41. OS Kernel
    Libraries
    Language
    App Server
    App
    OS Kernel
    Libraries
    Language
    App Server
    App
    OS Kernel
    Libraries
    Language
    App Server
    App
    Updates Updates
    Updates
    Automated
    Sysadmin

    View full-size slide

  42. fast forward to 2015 …

    View full-size slide

  43. Every day, AWS adds
    enough server capacity
    to power the whole $5B
    enterprise Amazon.com
    was in 2003.
    Weekends included.

    View full-size slide

  44. "Advanced Test Reactor" by Argonne National Laboratory -
    originally posted to Flickr as Advanced Test Reactor core,
    Idaho National LaboratoryUploaded using F2ComButton.
    Licensed under CC BY-SA 2.0 via Wikimedia Commons -
    http://commons.wikimedia.org/wiki/File:Advanced_Test_Reac
    tor.jpg#mediaviewer/File:Advanced_Test_Reactor.jpg
    "RIAN archive 341194 Kursk Nuclear Power Plant" by RIA
    Novosti archive, image #341194 / Sergey Pyatakov / CC-BY-SA
    3.0. Licensed under CC BY-SA 3.0 via Wikimedia Commons -
    http://commons.wikimedia.org/wiki/File:RIAN_archive_341194_
    Kursk_Nuclear_Power_Plant.jpg#mediaviewer/File:RIAN_archi
    ve_341194_Kursk_Nuclear_Power_Plant.jpg
    Control Plane Data Plane

    View full-size slide

  45. Control Plane Data Plane

    View full-size slide

  46. • Shift to a world of abundance
    (no more resource scarcity)
    • Clean Control Plane/Data Plane split
    with API-based provisioning
    • Cost-based Architectures
    with the ability to turn infrastructure off
    Benefits of the cloud

    View full-size slide

  47. it is time to rethink the faster horse

    View full-size slide

  48. App
    OS Kernel
    Libraries
    Language
    App Server
    Build Test

    View full-size slide

  49. App
    OS Kernel
    Libraries
    Language
    App Server
    Build Test
    Undifferentiated
    Heavy lifting

    View full-size slide

  50. App
    OS Kernel
    Libraries
    Language
    App Server
    Build Test

    View full-size slide

  51. App
    Machine
    Image
    OS Kernel
    Libraries
    Language
    App Server
    Build Test
    Machine
    Image

    View full-size slide

  52. OS Kernel
    Libraries
    Language
    App Server
    App
    OS Kernel
    Libraries
    Language
    App Server
    App
    OS Kernel
    Libraries
    Language
    App Server
    App
    Updates

    View full-size slide

  53. Machine
    Image
    Machine
    Image
    Machine
    Image
    Updates

    View full-size slide

  54. but there is one big problem left …

    View full-size slide

  55. Machine
    Image Network Cable

    View full-size slide

  56. Machine
    Image Network Cable
    Multiple
    GB

    View full-size slide

  57. Running servers in
    production should be like
    going backpacking. You
    take the bare minimum
    with you. Anything else
    is going to hurt.
    A Wise Man

    View full-size slide

  58. what is really adding business value ???

    View full-size slide

  59. Machine
    Image Network Cable

    View full-size slide

  60. Editors
    Daemons OS Kernel
    Libraries
    Utilities
    Drivers
    App
    App Server
    Package Mgr
    Compilers
    SSH
    Firewall
    Compatibility
    Man Pages
    Language
    Log Files
    Users
    Shells
    Network Cable

    View full-size slide

  61. OS Kernel
    Libraries
    App
    App Server
    Language
    Bootable
    App

    View full-size slide

  62. Multiple
    GB 40 – 80
    MB

    View full-size slide

  63. Network Cable
    Bootable
    App

    View full-size slide

  64. who is this for ???

    View full-size slide

  65. OS Kernel
    Libraries
    Language
    App Server
    App
    12-factor app

    View full-size slide

  66. What are the implications ???

    View full-size slide

  67. Focus shift
    Individual instances become disposable
    Instance Service

    View full-size slide

  68. Treat servers like cattle instead of pets

    View full-size slide

  69. high uptime is a liability
    The longer an instance is up,
    the harder it becomes to recreate exactly
    (and it will fail eventually!)

    View full-size slide

  70. How to solve service discovery ?
    Use a stable entry point with an internal registry
    Bootable
    App
    Bootable
    App
    Bootable
    App
    ? Elastic
    Load
    Balancer

    View full-size slide

  71. What about security ?
    When was the last time your toaster got hacked?

    View full-size slide

  72. What about security ?
    • Smallest possible attack surface
    • Vastly reduced implications due to low
    uptime and transient nature of instances
    • Very difficult to exploit other systems
    because essential tooling is missing

    View full-size slide

  73. • Bake as much configuration as
    possible for all environments
    directly in the Bootable App
    • Use environment detection
    and auto-configuration
    • Pass remaining configuration
    at startup and expose it as
    environment variables
    what about configuration ???

    View full-size slide

  74. what about the database ???

    View full-size slide

  75. Bootable
    App
    what about the database ???

    View full-size slide

  76. what about the database ???
    • Keep all persistent state, including the
    database, out of the instance
    • Many good hosted solutions available
    like Amazon RDS or Google Cloud SQL
    • Use a database migration tool like
    Flyway to update on application startup

    View full-size slide

  77. Bootable
    App
    what about the logs ???
    Ship logs to a central log server
    where they can be
    • aggregated
    • stored and backuped
    • indexed
    • searched through a nice web UI
    Many good hosted solutions
    • Loggly
    • Logentries
    • Papertrail
    • …

    View full-size slide

  78. what about sessions ???
    Bootable
    App
    Keep session in an encrypted and signed cookie
    • avoids session timeouts
    • avoids server clustering & session replication
    • avoids sticky sessions & server affinity

    View full-size slide

  79. what about rolling out new versions ???

    View full-size slide

  80. Load
    Balancer
    App
    v1
    App
    v1 Logs
    Availability Zone 1
    Availability Zone 2

    View full-size slide

  81. Load
    Balancer
    App
    v2
    App
    v1
    App
    v2
    App
    v1 Logs
    Availability Zone 1
    Availability Zone 2

    View full-size slide

  82. Load
    Balancer
    App
    v2
    App
    v2
    Logs
    Availability Zone 1
    Availability Zone 2

    View full-size slide

  83. what about containers ???

    View full-size slide

  84. understanding modern CPUs
    Both Intel and AMD have
    hardware support for virtualization
    • isolation
    • performance

    View full-size slide

  85. Bootable App
    Hardware
    Hypervisor
    Bootable App
    Hardware
    OS+Container
    Runtime
    On Prem
    On Prem

    View full-size slide

  86. Bootable App
    Hardware
    Hypervisor
    Bootable App
    Hardware
    Hypervisor
    OS+Container
    Runtime
    Bootable App
    Hardware
    OS+Container
    Runtime
    On Prem
    On Prem /
    Cloud
    Cloud
    Only makes sense if
    you cannot afford
    $9.60/month
    granularity

    View full-size slide

  87. Bootable App
    Hardware
    Hypervisor
    Bootable App
    Hardware
    Hypervisor
    OS+Container
    Runtime
    Bootable App
    Hardware
    OS+Container
    Runtime
    On Prem
    On Prem /
    Cloud
    Cloud
    Only makes sense if
    you cannot afford
    1.3 cents /hour
    granularity

    View full-size slide

  88. • One immutable unit
    • Regenerated after every change
    • Promoted from Environment to Environment
    Classic Mistake: Build per Environment

    View full-size slide

  89. Bootable
    App
    • One immutable unit
    • Regenerated after every change
    • Promoted from Environment to Environment
    Classic Mistake: Build per Environment

    View full-size slide

  90. Thanks !
    AXEL FONTAINE
    @axelfontaine
    boxfuse.com

    View full-size slide