From 63b6db484306d8f5e74ba0d2a2143b1c24e18ea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Sat, 10 Jun 2017 21:40:05 +0200 Subject: [PATCH] First round of updates for devopscon --- docs/index.html | 217 +++++++++++++++++++++++++++--------------------- 1 file changed, 124 insertions(+), 93 deletions(-) diff --git a/docs/index.html b/docs/index.html index 570f5cd8..d8df5f7f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -107,9 +107,9 @@ Docker
Orchestration
Workshop class: title, in-person -.small[ +Deploying and scaling containerized Microservices with Docker and Swarm -Deploy and scale containers with Docker native, open source orchestration + --- @@ -134,11 +135,18 @@ class: in-person ## Intros + + +- Hello! I am + Jérôme ([@jpetazzo](https://twitter.com/jpetazzo)) 🇫🇷 🇺🇸 .small[🇩🇪] + -- class: in-person @@ -161,35 +169,29 @@ class: in-person ## Agenda - +- 09:30-11:00 part 1 +- 11:00-11:30 coffee break +- 11:30-13:00 part 2 +- 13:00-14:00 lunch break +- 14:00-15:30 part 3 +- 15:30-16:00 coffee break +- 16:00-17:30 part 4 +- 17:30-17:42 Q&A - - The tutorial will run from 9:00am to 12:20pm - This will be fast-paced, but DON'T PANIC! -- All the content is publicly available (slides, code samples, scripts) - - There will be a coffee break at 10:30am
(please remind me if I forget about it!) +--> + +- All the content is publicly available (slides, code samples, scripts) + - Feel free to interrupt for questions at any time - Live feedback, questions, help on [Gitter](chat) @@ -290,8 +292,6 @@ class: in-person - Creating our first Swarm -- Docker Machine - - Running our first Swarm service - Deploying a local registry @@ -316,7 +316,7 @@ class: in-person - Rolling updates -- (Secrets management and encryption at rest) +- Secrets management - [Centralized logging](#logging) @@ -598,9 +598,9 @@ You are welcome to use the method that you feel the most comfortable with. ## Brand new versions! -- Engine 17.05 +- Engine 17.06-rc - Compose 1.12 -- Machine 0.11 +- Machine 0.12 .exercise[ @@ -615,7 +615,7 @@ You are welcome to use the method that you feel the most comfortable with. --- -## Wait, what, 17.05 ?!? +## Wait, what, 17.06 ?!? -- @@ -636,7 +636,7 @@ You are welcome to use the method that you feel the most comfortable with. --- -class: extra-details +class: in-person, x-extra-details ## Docker CE vs Docker EE @@ -652,6 +652,10 @@ class: extra-details - available through Docker Mac, Docker Windows, and major Linux distros - perfect for individuals and small organizations +- Want more details? Check my talk tomorrow, 15:00, in Maritim A + + .small["Use the Source or join the Dark Side: The Differences between Docker Community and Enterprise Edition"] + --- class: extra-details @@ -779,12 +783,15 @@ class: pic - How DockerCoins works: - - `worker` asks to `rng` to give it random bytes - - `worker` feeds those random bytes into `hasher` - - each hash starting with `0` is a DockerCoin - - DockerCoins are stored in `redis` - - `redis` is also updated every second to track speed - - you can see the progress with the `webui` + - `worker` asks to `rng` to generate a few random bytes + + - `worker` feeds these random bytes into `hasher` + + - and repeat for ever! + + - every second, `worker` updates `redis` to indicate how many loops were done + + - `webui` queries `redis`, and computes and exposes "hashing speed" in your browser --- @@ -2148,7 +2155,7 @@ class: self-paced (New in Docker Engine 17.05) -If you are running Docker 17.05, you will see the following message: +If you are running Docker 17.05 or 17.06, you will see the following message: ``` Since --detach=false was not specified, tasks will be created in the background. @@ -4104,118 +4111,138 @@ However, when you run the second one, only `#` will show up. --- -# Rolling updates +# Updating services -- We want to release a new version of the worker +- We want to make changes to the web UI -- We will edit the code ... +- The process is as follows: -- ... build the new image ... + - edit code -- ... push it to the registry ... + - build new image -- ... update our service to use the new image + - ship new image + + - run new image --- -class: extra-details +## Updating a single service -## But first... +- To update a single service, we can do the following: -- Restart the workers - -.exercise[ - -- Just scale back to 10 replicas: ```bash - docker service update dockercoins_worker --replicas 10 + REGISTRY=localhost:5000 TAG=v0.2 + IMAGE=$REGISTRY/dockercoins_webui:$TAG + docker build -t $IMAGE webui/ + docker push $IMAGE + docker service update dockercoins_webui --image $IMAGE ``` -- Check that they're running: - ```bash - docker service ps dockercoins_worker - ``` +- We need to update the `TAG` variable at each iteration -] +- Updating the `TAG` variable is necessary to force the nodes to pull the new version + + (Otherwise, a node which already has image tag `v0.2` will not download the new version, + because it's not aware that this version has changed on the registry) --- -## Making changes +## Updating all the services that have changed -.exercise[ +- With the Compose integration, all we have to do is: -- Edit `~/orchestration-workshop/dockercoins/worker/worker.py` + ```bash + export TAG=v0.2 + docker-compose -f composefile.yml build + docker-compose -f composefile.yml push + docker stack deploy -c composefile.yml nameofstack + ``` -- Locate the line that has a `sleep` instruction +-- -- Increase the `sleep` from `0.1` to `1.0` +- That's exactly the commands that we used earlier to deploy the app -- Save your changes and exit - -] +- We don't need to learn new commands! --- -## Building and pushing the new image +## Updating the web UI + +- Let's make the numbers on the Y axis bigger! .exercise[ -- Go to the `stacks` directory: - ```bash - cd ~/orchestration-workshop/stacks - ``` +- Edit the file `webui/files/index.html` -- Build and ship the new image: +- Locate the `font-size` CSS attribute and increase it (at least double it) + +- Save and exit + +- Build, ship, and run: ```bash + export TAG=v0.2 docker-compose -f dockercoins.yml build docker-compose -f dockercoins.yml push + docker stack deploy -c dockercoins.yml dockercoins ``` ] -Note how the build and push were fast (because caching). - --- -## Watching the deployment process +## Viewing our changes -- We will need to open a new terminal for this +- Wait at least 10 seconds (for the new version to be deployed) -.exercise[ +- Then reload the web UI -- Look at our service status: - ```bash - watch -n1 "docker service ps dockercoins_worker | grep -v Shutdown.*Shutdown" - ``` - -] - -- `docker service ps worker` gives us all tasks -
(including the one whose current or desired state is `Shutdown`) - -- Then we filter out the tasks whose current **and** desired state is `Shutdown` - -- There is also a `--filter` option, but it doesn't allow (yet) to specify that filter +- The legend on the left should now be bigger! --- -## Updating to our new image +## Rolling updates -- Keep the `watch ...` command running! +- Let's change a scaled service: `worker` .exercise[ -- Update our application stack: +- Edit `worker/worker.py` + +- Locate the `sleep` instruction and change the delay + +- Build, ship, and run our changes: ```bash - docker stack deploy dockercoins -c dockercoins.yml + export TAG=v0.3 + docker-compose -f dockercoins.yml build + docker-compose -f dockercoins.yml push + docker stack deploy -c dockercoins.yml dockercoins ``` ] -If you had stopped the workers earlier, this will automatically restart them. +--- + +## Viewing our update as it rolls out + +.exercise[ + +- Check the status of the `dockercoins_worker` service: + ```bash + watch docker service ps dockercoins_worker + ``` + +- Don't display the tasks that are shutdown: + ```bash + watch "docker service ps dockercoins_worker | grep -v Shutdown.*Shutdown" + ``` + +] By default, SwarmKit does a rolling upgrade, one instance at a time. +We should therefore see the workers being updated one by one. + --- ## Changing the upgrade policy @@ -4254,6 +4281,8 @@ The current upgrade will continue at a faster pace. --- +class: extra-details + ## Rolling back - At any time (e.g. before the upgrade is complete), we can rollback: @@ -4275,6 +4304,8 @@ What happens with the web UI graph? --- +class: extra-details + ## The fine print with rollback - Rollback reverts to the previous service definition @@ -7518,8 +7549,8 @@ AJ ([@s0ulshake](https://twitter.com/s0ulshake)) — *For hire!* var slideshow = remark.create({ ratio: '16:9', highlightSpans: true, - excludedClasses: ["in-person", "elk-auto", "prom-auto"] - //excludedClasses: ["self-paced", "extra-details", "advertise-addr", "docker-machine", "netshoot", "sbt", "ipsec", "node-info", "swarmtools", "secrets", "encryption-at-rest", "elk-manual", "snap", "prom-manual"] + //excludedClasses: ["in-person", "elk-auto", "prom-auto"] + excludedClasses: ["self-paced", "extra-details", "advertise-addr", "docker-machine", "netshoot", "sbt", "encryption-at-rest", "elk-manual", "snap", "prom-manual"] });