class: center, middle # Welcome to DevOps State College --- # Why DevOps State College? * Build a community and make connections * Exchange ideas * Learn * Promote DevOps culture * Fun * Not tied to one vendor/technology --- # What is DevOps? Grand unification of philosophy around how to manage Development (programmers, application analysts, application owners, project managers) and IT Operations (system admins, network admins, security, data center, storage, database admin) in a tightly-integrated way. DevOps is the belief that working together as a collaborative team will produce better results, and break down barriers and finger pointing. --- # Future Presentations --- # Job Opportunities * AppliedTrust * AppliedTrust is hiring in Philadelphia, Dallas and Boulder offices. * For more information, see https://www.appliedtrust.com/jobs/ or talk to me afterwards --- # Intro to docker What is docker? Docker is a tool for running containerized services. Containers are lighter weight than virtual machines, because they share the kernel of the host OS. Docker provides tools to interact with these containers. --- # Docker Commands * docker ps * docker run * docker rm * docker rmi * docker build * docker stop * docker start --- # Docker Machine Commands * docker-machine create * docker-machine rm * docker-machine env --- # Docker Compose Commmands * docker-compose up * docker-compose down --- # Docker Network Commands * docker network create * docker network connect * docker network disconnect * docker network inspect * docker network ls * docker network rm --- # Docker network overlay driver The docker network overlay driver allows a network to span multiple docker hosts. This can be used in a docker "swarm" to allow connectivity between containers. Note that volumes must use a network capable driver to allow migrating volumes in a swarm. --- # Setting up a sandbox My talk is using parallels for our docker hosts. Virtualbox can also be used or this can be used to control cloud instances in AWS and digital ocean as well. There are 3 components that we need for our swarm. The first is a key/value store. For this example we will use consul since our very own Daryl Wiest covered it a couple months ago. 2nd, we need a couple hosts to act as our swarm, and 3rd is out network overlay so our docker containers can communicate with each other. --- # Setting up consul docker-machine create -d parallels --parallels-boot2docker-url \ https://github.com/boot2docker/boot2docker/releases/download/v1.12.0-rc4/boot2docker.iso \ swarm-consul eval "$(docker-machine env swarm-consul)" docker run -d -p "8500:8500" -h "consul" progrium/consul -server -bootstrap --- # Setting up swarm master docker-machine create -d parallels --parallels-boot2docker-url \ https://github.com/boot2docker/boot2docker/releases/download/v1.12.0-rc4/boot2docker.iso \ --swarm --swarm-master --swarm-discovery="consul://$(docker-machine ip swarm-consul):8500" \ --engine-opt="cluster-store=consul://$(docker-machine ip swarm-consul):8500" \ --engine-opt="cluster-advertise=eth0:2376" swarm-node0 --- # Setting up additional swarm nodes docker-machine create -d parallels --parallels-boot2docker-url \ https://github.com/boot2docker/boot2docker/releases/download/v1.12.0-rc4/boot2docker.iso \ --swarm --swarm-discovery="consul://$(docker-machine ip swarm-consul):8500" \ --engine-opt="cluster-store=consul://$(docker-machine ip swarm-consul):8500" \ --engine-opt="cluster-advertise=eth0:2376" swarm-node1 --- # Setting up docker overlay network eval "$(docker-machine env swarm-node0)" docker network create --driver overlay --subnet=10.5.3.0/24 --ipv6 swarm-net --- # Taking a closer look eval "$(docker-machine env swarm-node0)" docker info docker inspect network swarm-net --- # Testing it all out eval "$(docker-machine env swarm-node0)" docker run -itd --name=web --network=swarm-net \ --env="constraint:node==swarm-node0" nginx docker run -it --rm --network=swarm-net --env="constraint:node==swarm-node1" \ busybox wget -O- http://web --- # Docker Compose and Networking You can now specify networks in compose files with the v2 format!!! * essentially, if you used compose with v1, that entire file goes under services tag now (with some caveats) see https://docs.docker.com/compose/compose-file Networks can be specified in compose files now: see https://docs.docker.com/compose/networking/ --- # From sandbox to production Disclaimer: The state of this sandbox setup is not recommended for production. Caveats: * Lack of full consul cluster * No proxy frontend for load balancing * storage driver supporting overlay networks not used (don't run a database) If you are looking at setting up docker swarm in production, please take my card before you leave! --- # Conclusion Swarm allows you to run multiple docker servers that containers can start up on in an HA fashion. To use swarm, a key-value store, such as consul or etcd needs used. The key value store should be HA as well, otherwise you have a single point of failure. `docker-machine` can provision hosts for you to use with a swarm. --- # Questions??? --- # Local Whiskey Please join us after we finish cleaning up for a round of drinks at Local Whiskey across the street!