diff --git a/slides/swarm/healthchecks.md b/slides/swarm/healthchecks.md index 948645a6..37ab491b 100644 --- a/slides/swarm/healthchecks.md +++ b/slides/swarm/healthchecks.md @@ -1,6 +1,6 @@ name: healthchecks -# Health checks +# Health checks and auto-rollbacks (New in Docker Engine 1.12) @@ -61,7 +61,7 @@ name: healthchecks --- -## Automated rollbacks +## Enabling health checks and auto-rollbacks Here is a comprehensive example using the CLI: @@ -109,7 +109,9 @@ We will use the following Compose file (`stacks/dockercoins+healthcheck.yml`): --- -## Enabling auto-rollback +## Enabling auto-rollback in dockercoins + +We need to update our services with a healthcheck. .exercise[ @@ -118,7 +120,7 @@ We will use the following Compose file (`stacks/dockercoins+healthcheck.yml`): cd ~/container.training/stacks ``` -- Deploy the updated stack: +- Deploy the updated stack with healthchecks built-in: ```bash docker stack deploy --compose-file dockercoins+healthcheck.yml dockercoins ``` @@ -129,33 +131,13 @@ This will also scale the `hasher` service to 7 instances. --- -## Visualizing a rolling update - -First, let's make an "innocent" change and deploy it. - -.exercise[ - -- Update the `sleep` delay in the code: - ```bash - sed -i "s/sleep 0.1/sleep 0.2/" dockercoins/hasher/hasher.rb - ``` - -- Build, ship, and run the new image: - ```bash - export TAG=v0.5 - docker-compose -f dockercoins+healthcheck.yml build - docker-compose -f dockercoins+healthcheck.yml push - docker service update dockercoins_hasher \ - --image=127.0.0.1:5000/hasher:$TAG - ``` - -] - ---- - ## Visualizing an automated rollback -And now, a breaking change that will cause the health check to fail: +Here's a good example of why healthchecks are necessary. + +This breaking change will prevent the app from listening on the correct port. + +The container still runs fine, it just won't accept connections on port 80. .exercise[ @@ -166,7 +148,7 @@ And now, a breaking change that will cause the health check to fail: - Build, ship, and run the new image: ```bash - export TAG=v0.6 + export TAG=v0.5 docker-compose -f dockercoins+healthcheck.yml build docker-compose -f dockercoins+healthcheck.yml push docker service update dockercoins_hasher \ diff --git a/slides/swarm/rollingupdates.md b/slides/swarm/rollingupdates.md index 0420ac9c..77b735ae 100644 --- a/slides/swarm/rollingupdates.md +++ b/slides/swarm/rollingupdates.md @@ -1,19 +1,21 @@ # Rolling updates -- Let's change a scaled service: `worker` +- Let's change a scaled service: `hasher` .exercise[ -- Edit `worker/worker.py` - -- Locate the `sleep` instruction and change the delay +- Update the `sleep` delay in the code to 0.2: + ```bash + sed -i "s/sleep 0.1/sleep 0.2/" dockercoins/hasher/hasher.rb + ``` - Build, ship, and run our changes: ```bash export TAG=v0.4 docker-compose -f dockercoins.yml build docker-compose -f dockercoins.yml push - docker stack deploy -c dockercoins.yml dockercoins + docker service update dockercoins_hasher \ + --image=127.0.0.1:5000/hasher:$TAG ``` ] @@ -46,7 +48,7 @@ If you had stopped the workers earlier, this will automatically restart them. By default, SwarmKit does a rolling upgrade, one instance at a time. -We should therefore see the workers being updated one my one. +We should therefore see the workers being updated one by one. --- diff --git a/slides/swarm/compose2swarm.md b/slides/swarm/stacks.md similarity index 99% rename from slides/swarm/compose2swarm.md rename to slides/swarm/stacks.md index a4ff0b6b..28f59d72 100644 --- a/slides/swarm/compose2swarm.md +++ b/slides/swarm/stacks.md @@ -1,6 +1,6 @@ class: btp-manual -## Integration with Compose +## Integrtaion with Compose - We saw how to manually build, tag, and push images to a registry @@ -22,7 +22,7 @@ class: btp-manual --- -# Integration with Compose +# Swarm Stacks - Compose is great for local development diff --git a/slides/swarm/updatingservices.md b/slides/swarm/updatingservices.md index a1dca6e2..7d51d9e2 100644 --- a/slides/swarm/updatingservices.md +++ b/slides/swarm/updatingservices.md @@ -55,26 +55,11 @@ .exercise[ -- Edit the file `webui/files/index.html`: +- Update the size of text on our webui: ```bash - vi dockercoins/webui/files/index.html + sed -i "s/15px/50px/" dockercoins/webui/files/index.html ``` - - -- Locate the `font-size` CSS attribute and increase it (at least double it) - - - -- Save and exit - ] ---