Dockerizing a Node.js Application - Give a sysadmin a fish for the day

download Dockerizing a Node.js Application - Give a sysadmin a fish for the day

of 19

  • date post

    14-Aug-2015
  • Category

    Software

  • view

    191
  • download

    2

Embed Size (px)

Transcript of Dockerizing a Node.js Application - Give a sysadmin a fish for the day

  1. 1. Justin Lovell | www.justjuzzy.com | @juzzy_za Dockerizing a Node.js Application Give a sysadmin a fish for the day
  2. 2. Justin Lovell | www.justjuzzy.com | @juzzy_za JavaScript running as an Application Server? T-t-t-thats it. Im burning this building down!
  3. 3. Justin Lovell | www.justjuzzy.com | @juzzy_za Deployments and Infrastructure used to be simple
  4. 4. Justin Lovell | www.justjuzzy.com | @juzzy_za Embrace change, but dont screw it up Developers must continuously implement change (responsibly) System administrators need to keep systems operational Very opposing goals
  5. 5. Justin Lovell | www.justjuzzy.com | @juzzy_za Overwhelming for system administrators to learn to install, configure, and support
  6. 6. Justin Lovell | www.justjuzzy.com | @juzzy_za Shipping Software is everybodys Business
  7. 7. Justin Lovell | www.justjuzzy.com | @juzzy_za Shipping Containers Changed the World 16 day travel time 750 kilometers a day 12,000 kilometers total Contents untouched Docker Containers provides agility and promises of good software shipment
  8. 8. Justin Lovell | www.justjuzzy.com | @juzzy_za Operations Manage Infrastructure; not Software 192.168.0.1 192.168.0.1 192.168.0.1 192.168.0.1 192.168.0.1 192.168.0.1 192.168.0.1 Lorem Lorm Lorem Lorem Their goals: Big picture orientated Backups Disaster Recovery Networking Software is a Junction Point Black box treatment Treatment is universal The wish list Hardware appliances Virtual machine images
  9. 9. Justin Lovell | www.justjuzzy.com | @juzzy_za Developers Pack Software Containers Packaged by developers Simplified handling by operations No unintentional consequences
  10. 10. Justin Lovell | www.justjuzzy.com | @juzzy_za Virtual Machines vs. Containers Virtual Machines Application Software Bins Libs Guest OS Server Hardware Host OS Virtualized Hardware Application Software Bins Libs Guest OS Application Software Bins Libs Guest OS Application Software Bins Libs Server Hardware Host OS Docker Deamon Application Software Bins Libs Application Software Bins Libs Containers are isolated, but share OS kernel and, where appropriate, bins/libraries result is significantly faster deployment, much less overhead, easier migration, faster boot up times
  11. 11. Justin Lovell | www.justjuzzy.com | @juzzy_za Containers Should Contain One Application Place one app into one container Containers are tools on the shadow board The shadow should be instantly recognizable
  12. 12. Justin Lovell | www.justjuzzy.com | @juzzy_za Demo 1: Isolation $ docker search ubuntu $ docker pull ubuntu $ docker run -t -i ubuntu /bin/bash $ e.g. top ifconf $ exit $ docker ps --all Get Docker http://docs.docker.com/mac/started/ http://docs.docker.com/linux/started/ http://docs.docker.com/windows/started/ Browse Docker Hub https://registry.hub.docker.com/search?q=library Execute Docker Image Explore Container
  13. 13. Justin Lovell | www.justjuzzy.com | @juzzy_za Demo 2: Sysadmin Install $ docker pull ghost $ docker run -d -p 80:2368 ghost // todo: http://localhost/ghost $ docker ps $ docker stop Pull Ghost Host Ghost Visit Website View running containers Stop container
  14. 14. Justin Lovell | www.justjuzzy.com | @juzzy_za Demo 3: Developer Package $ git clone git@github.com:justin- lovell/jsinsa2015-docker.git $ cd jsinsa2015-docker/node-app $ vi Dockerfile $ docker build -t . $ docker images $ docker run -d -p 80:3000 $ docker run -d test $ docker stop $(docker ps -q) $ docker build -t . Clone sample app View Dockerfile Build Dockerfile View loaded images Start Docker Execute container variation Stop all running containers Rebuild image Observe cache
  15. 15. Justin Lovell | www.justjuzzy.com | @juzzy_za OPEN CONTAINER PROJECT Open Collaborative Client Orchestration Stack Not dominated by Commercial vendor Project Portable across Operating systems Hardware CPU Architectures Public clouds
  16. 16. Justin Lovell | www.justjuzzy.com | @juzzy_za Benefits for the System Administrator Capacity management orientated Easily manage infrastructure Accept changes more openly Lightweight deployments No developer jargon needed (e.g. npm) 192.168.0.1 192.168.0.1 192.168.0.1 192.168.0.1 192.168.0.1 192.168.0.1 192.168.0.1 Lorem Lorm Lorem Lorem
  17. 17. Justin Lovell | www.justjuzzy.com | @juzzy_za Reusability with pre-fabricated images Primed for easier package management Dependency management is a lot easier The containers fully document all libraries, runtimes, and frameworks required No more deployment documentation Containers has become the executable documentation Deployment documents will no longer become stale Benefits for the Developer Containers has become the executable documentation Deployment documents will no longer become stale
  18. 18. Justin Lovell | www.justjuzzy.com | @juzzy_za Learning Material http://www.amazon.com/The-Docker-Book- Containerization-virtualization- ebook/dp/B00LRROTI4 http://www.dockerbook.com/
  19. 19. Justin Lovell | www.justjuzzy.com | @juzzy_za Interesting Article http://www.zdnet.com/article/what-is-docker-and-why-is-it-so-darn-popular/ What is Docker and why is it so darn popular? Docker, a new container technology, is hotter than hot because it makes it possible to get far more apps running on the same old servers and it also makes it very easy to package and ship programs. Here's what you need to know about it.