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

Break the monolith with Docker

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →

Break the monolith with Docker

This is still a WIP presentation I gave at a local user group.

Avatar for Shaun Hubbard

Shaun Hubbard

February 19, 2016

Other Decks in Technology

Transcript

  1. @HUBBARD_SHAUN_W WHY SHOULD YOU LISTEN TO ME ▸ Shaun Hubbard

    ▸ Computer Scientist ▸ Polyglot ▸ Lead Developer, doing this sort of thing. ▸ POC: Twitter, I respond daily ▸ I like whales
  2. @HUBBARD_SHAUN_W 60 IN 2: AGENDA ▸ This is not a

    how to on Docker, its a why discussion ▸ Docker Background ▸ Development Production Parity ▸ Microservices
  3. @HUBBARD_SHAUN_W DOCKER IS A VIRTUALIZATION OF VIRTUALIZATION ▸ The thing

    some of us make containers with ▸ Whats a container? ▸ Runtime, Code, System Tools, System Libraries, Other Server Stuff, App ▸ Containers can be though of as virtualization’s of a VM ▸ Examples of VMs in action: EC2, DevBoxes, others…
  4. @HUBBARD_SHAUN_W TRADITIONAL VM VIRTUALIZATION ▸ Hardware ▸ ISA ▸ Host

    Operating System ▸ Apps - Hypervisor, Nginx, HAProxy ▸ Simulate ISA ▸ Guest Operating System ▸ Applications - Webapps
  5. @HUBBARD_SHAUN_W SIMPLICITY IS PERSPECTIVE ▸ Docker Runs based on the

    Open Container Initiative( OCI, which it was instrumental in creating) ▸ It makes use of core feature of Linux that were arguably cultivated in the OS land of BSD ▸ LXC - Linux Containers ▸ chroot ▸ CGroups ▸ Kernel Namespaces
  6. @HUBBARD_SHAUN_W MAKING USE OF LXC IS HARD ▸ cgroups -

    for limiting accounts and resource usage ▸ kernel namespaces - for partitioning processes ▸ chroot - changes the root directory ▸ UFS - union file system, a mountable file system that docker uses in order to facilitate replication
  7. @HUBBARD_SHAUN_W DOCKERFILE IS EASIER ▸ FROM node:0.12 ▸ # This

    is needed for node-canvas dependency on cairo. Annoyingly large... ▸ RUN apt-get update && apt-get install -yy --no-install-recommends \ ▸ libcairo2-dev libjpeg62-turbo-dev libpango1.0-dev libgif-dev \ ▸ build-essential g++ ▸ #Create non-root user ▸ RUN groupadd -r dnmonster && useradd -r -g dnmonster dnmonster ▸ #Following is effectively onbuild image. We can't use the official onbuild image ▸ #as it would run the above line everytime which is very tiresome ▸ RUN mkdir -p /usr/src/app ▸ WORKDIR /usr/src/app
  8. @HUBBARD_SHAUN_W DOCKER FILE SURFACE VIEW ▸ Everything sits on top

    of the linux kernel, this could for instance be “Alpine” ▸ Then we can add a base image “Ubuntu” to the image ▸ then apps like Apache and Emacs, Emacs is cool ▸ then with this image we can run a writable container
  9. @HUBBARD_SHAUN_W WHAT IS THE DEV PROD PARITY THING? ▸ Time

    Gap - Minutes vs Hours vs Days/Weeks/Months to deploy ▸ Personnel Gap - DevOps vs Ops ▸ Tools Gap - Development Tools vs Production Tools ▸ Docker address the tools gap. Have you ever had a situation, like this ▸ Develop on OS X and use WSGi with Nginx and SqlLite and a local Redis ▸ Production on Ubuntu Gunicorn with Apache and PostgreSQL and Memcached
  10. @HUBBARD_SHAUN_W DOCKER IMAGES ARE PORTABLE ▸ What does this mean?

    Its huge! ▸ The same image that I use on my local machine, I can use everywhere else! ▸ This allows dev prod parity!
  11. @HUBBARD_SHAUN_W USAGES FOR CONTAINERS THAT REDUCE PAINPOINTS ▸ Unit Test

    ▸ Integration Tests ▸ Development Testing ▸ Staging Environment ▸ Production Environment ▸ The logic here is “same” is good
  12. @HUBBARD_SHAUN_W WHAT IS THE MONOLITH ▸ Cant break what we

    don't know ▸ The monolith is basically all the things in one place ▸ This is impossible and unmaintainable for most enterprise pursuits with Full Stack developers ▸ So teams become aligned and functionality is point of decomposition
  13. @HUBBARD_SHAUN_W DISADVANTAGES OF THE MONOLITH ▸ The average team member

    doesn't know how the whole app works, or even their teams slice. ▸ One bad NPE and you app could be toast. Low resiliency ▸ Maintainability of legacy monoliths is more a corollary to developer retention in late life cycle then code quality. Band aids sticks glue are a way of life. ▸ Rewrites are unfathomable, because its all or nothing. Sunk cost fallacy.
  14. @HUBBARD_SHAUN_W MICROSERVICES ALTERNATIVE ▸ All legacy code is bad ▸

    Its easier to buy into tiny rebuilds and rewrites and modernatizations then super heroic massive bet the company on it efforts ▸ Divide and conquer is a fundamental principle of CS ▸ This should apply to apps too
  15. @HUBBARD_SHAUN_W HOW DOES DOCKER PLAY INTO THIS? ▸ PODA ▸

    Package Once Deploy Anywhere ▸ This is potentially the fulfillment of write once run anywhere ▸ A Node project Sails.JS could fit right in next to a Spring app and a Python app