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 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 Slide

  3. flywaydb.org

    View Slide

  4. boxfuse.com

    View Slide

  5. Let’s start with a small story

    View Slide

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

    View Slide

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

    View Slide

  8. View Slide

  9. Edison Screw

    View Slide

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

    View Slide

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

    View Slide

  12. back to IT infrastructure …

    View Slide

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

    View Slide

  14. How did this evolve ?

    View Slide

  15. sometime in the 20th century …

    View Slide

  16. View Slide

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

    View Slide

  18. View Slide

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

    View Slide

  20. +
    =
    ON
    PREM
    +
    Our
    responsibility

    View Slide

  21. + +
    Our
    responsibility
    Their
    responsibility
    =
    COLO

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  27. Let’s talk about software

    View Slide

  28. 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 Slide

  29. Build Test

    View Slide

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

    View Slide

  31. OS Kernel
    Libraries
    Language
    App Server
    App

    View Slide

  32. OS Kernel
    Libraries
    Language
    App Server
    App

    View Slide

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

    View Slide

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

    View Slide

  35. missing software

    View Slide

  36. wrong name

    View Slide

  37. bad version

    View Slide

  38. incorrect permissions

    View Slide

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

    View Slide

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

    View Slide

  41. View Slide

  42. OS Kernel
    Libraries
    Language
    App Server
    App
    Build Test

    View Slide

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

    View Slide

  44. 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 Slide

  45. 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 Slide

  46. 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 Slide

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

    View Slide

  48. 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 Slide

  49. 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 Slide

  50. fast forward to 2015 …

    View Slide

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

    View Slide

  52. "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 Slide

  53. Control Plane Data Plane

    View Slide

  54. • 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 Slide

  55. it is time to rethink the faster horse

    View Slide

  56. App
    OS Kernel
    Libraries
    Language
    App Server
    Build Test

    View Slide

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

    View Slide

  58. App
    OS Kernel
    Libraries
    Language
    App Server
    Build Test

    View Slide

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

    View Slide

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

    View Slide

  61. Machine
    Image
    Machine
    Image
    Machine
    Image
    Updates

    View Slide

  62. but there is one big problem left …

    View Slide

  63. Machine
    Image Network Cable

    View Slide

  64. Machine
    Image Network Cable
    Multiple
    GB

    View Slide

  65. 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 Slide

  66. what is really adding business value ???

    View Slide

  67. Machine
    Image Network Cable

    View Slide

  68. 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 Slide

  69. OS Kernel
    Libraries
    App
    App Server
    Language
    Bootable
    App

    View Slide

  70. Multiple
    GB 40 – 80
    MB

    View Slide

  71. Network Cable
    Bootable
    App

    View Slide

  72. who is this for ???

    View Slide

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

    View Slide

  74. demo

    View Slide

  75. What are the implications ???

    View Slide

  76. Focus shift
    Individual instances become disposable
    Instance Service

    View Slide

  77. Treat servers like cattle instead of pets

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  81. 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 Slide

  82. • 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 Slide

  83. what about the database ???

    View Slide

  84. Bootable
    App
    what about the database ???

    View Slide

  85. 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 Slide

  86. 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 Slide

  87. 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 Slide

  88. what about rolling out new versions ???

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  92. what about containers ???

    View Slide

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

    View Slide

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

    View Slide

  95. 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 Slide

  96. 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 Slide

  97. summary

    View Slide

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

    View Slide

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

    View Slide

  100. boxfuse.com

    View Slide

  101. Thanks !
    AXEL FONTAINE
    @axelfontaine
    boxfuse.com

    View Slide