KICK ASS DEV ENV'S Slides by Karl Roberts Twitter @MrK4rl
MOTIVATION
ANNOYING
WHAT TO DO? Allocate a Sprint for Setup. Write Setup Instructions.
OK BUT... You join a team A week later still not setup! Setup instructions Suck!
IT WORKS ON MY MACHINE!
(U && U-PC) || (U || U-PC) ==> S#1T!
MISSING STUFF Project Build Process always get more complex doco doesn't get updated
BOX IT UP
ENGINEERING IT is not Engineering
ENGINEERING So�ware != Engineering
ENGINEERING So�ware !== Engineering
ENGINEERING So�ware <> Engineering
ENGINEERING No professional body Don't need an IT qualification to work
YOW! 2015 Glen Vanderburg - The Future of So�ware Engineering website: http://vanderburg.org/ twitter: @glv talk: https://www.youtube.com/watch?v=Tg9D7UE4TyI
ENGINEERING What is Engineering? Design? Math? Science?
ENGINEERING IS to reliably and repeatedly build according to a desired tolerance, given certain contraints.
BUT WHAT ABOUT SOFTWARE ENGINEERING?
SOFTWARE ENGINEERING <==> CIVIL ENGINEERING
CIVIL ENGINEERING $ Building >> $ Design
SOFTWARE ENGINEERING <==> CIVIL ENGINEERING
SOFTWARE ENGINEERING <!==> CIVIL ENGINEERING
It is important to mitigate risk in the expensive parts Civil -> Build through planning and calculation So�ware -> Design through rapid iterative prototyping
So�ware engineering has an inverted cost model, compared to civil engineering
In so�ware engineering the build is the cheapest part of the process, in fact it should be as close to free as possible
Therefore rapid iterations and incremental improvements is the correct way to engineer so�ware
IDEAL ACTIVITY COST
SO WHAT? if dev is not the the most expensive part ... if (!dev != (free & immediate)) ... then you have broken So�ware Engineering! because instantaneous free prototyping is now not possible your dev-loops get too big and you get too expensive
PROTOTYPING
PROTOTYPING
PROTOTYPING
PROTOTYPING
BUT WHAT ABOUT... "within tolerance"
QUALITY ASSURANCE
Docker Vs Vagrant
WTF is Vagrant? the command line utility for managing the lifecycle of virtual machines. - HasiCorp
WTF is Vagrant? provides easy to configure, reproducible, and portable work environments.
WTF is Vagrant? To achieve its magic, Vagrant stands on the shoulders of giants. Machines are provisioned on top of VirtualBox, VMware, AWS, or any other provider.
WTF is Vagrant? industry-standard provisioning tools such as shell scripts, Chef, or Puppet, can be used to automatically install and configure so�ware on the machine.
WTF is Docker? allows you to package an application with all of its dependencies into a standardized unit for so�ware development.
WTF is Docker? containers wrap up a piece of so�ware in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries
WTF is Docker? Containers running on a single machine all share the same operating system kernel so they start instantly and make more efficient use of RAM. Images are constructed from layered filesystems so they can share common files
Meh? Vagrant boxes, Docker containers? Docker images, providers, provishioners?
vagrant v docker - stackoverflow
aside But why Docker? easy for Ops just provision a VM in the cloud ensure it has docker installed and thats it. streamlined production env no need to worry about libs and maintainance or different build scripts
easy for dev? java packaging was enough wasn't it? have you done a python ruby microservice deploy? more work saves me doing prod debug a�er deploy
WHAT DO I WANT? git checkout < uri > vagrant up ... dev ... isolation ability to use my editors and IDE's ability to ssh into the box if necessary multiple boxes db and webserver and app server
SWEET SPOT vagrant to launch and control Docker containers one ring to rule them all can run multiple boxes on different VM's and providers docker containers are lightweight doesn't bog down my dev box.
recommended:- Mario Loriedo's blog - setting up a dev environment using docker and vagrant Create Dockerfiles to defind the containers Create Vagrant files to orchestrate
GOTCHAS MacOS and Windows need to install docker machine boot2docker, now docker toolbox actually runs a thin linux VM to run docker in
Ubuntu aufs is deprecated doco says install linux-image-extra, but that adds loads of drivers solution modify /etc/default/docker to use DOCKER_OPTS="s overlay dns 8.8.8.8 dns 8.8.4.4"
Beware the caches both Docker and vagrant cache provisioning.. so Make changes at the end of the Docker file! or else it downloads everything all over again! RUN runs during container build, due to caching only runs once, not repeated the context is streamed to the daemon so use use a dockerignore file to shrink remove stuff that is not necessary for Vagrant destroy wont always destroy
image creation from scratch do you trust images on the Dockerhub? do you trust signed images? Best practice is don't do apt-get update upgrade build an image
ENTRYPOINT and CMD can only have one of each or both both define the command that is run when the container starts CMD can be overridden on the command line so is like a default run together it is like the commanline is concat of ENTRYPOINT ++ CMD obvious when CMD treated like the args to ENTRYPOINT If you want your container to keep running it must run a command that keeps running eg top
REFERENCES Mario Loriedo's blog - http://blog.zenika.com/2014/10/07/setting-up-a-development-environment-using-docker-and-vagrant/ Vagrant docs - https://www.vagrantup.com/docs/ docker whatis explanation - https://www.docker.com/what-docker docker documentation - https://docs.docker.com/ docker cheat sheet - https://github.com/wsargent/docker-cheat-sheet docker images and contianers docker remove untagged images fig http://www.fig.sh/ Data Opensource SFrames - https://dato.com/products/create/open_source.html Dato Graphlab Create - https://dato.com/products/create/ Karl's Demo1 Karl's Demo2
THANK YOU by Karl Roberts @MrK4rl / Talk at docs.aws.avocadoconsulting.com.au/techsync/2016/05/yowwest2016/
Recommend
More recommend