mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-07-18 04:19:43 +00:00
Last update after dry run
This commit is contained in:
@@ -5,6 +5,8 @@ exclude:
|
||||
- snap
|
||||
- auto-btp
|
||||
- benchmarking
|
||||
- elk-manual
|
||||
- prom-manual
|
||||
|
||||
chapters:
|
||||
- |
|
||||
@@ -60,7 +62,7 @@ chapters:
|
||||
## "From zero to hero"
|
||||
|
||||
--
|
||||
|
||||
|
||||
- It rhymes, but it's a pretty bad title, to be honest
|
||||
|
||||
--
|
||||
@@ -148,6 +150,7 @@ chapters:
|
||||
- swarmtools.md
|
||||
- security.md
|
||||
- secrets.md
|
||||
- encryptionatrest.md
|
||||
- leastprivilege.md
|
||||
- apiscope.md
|
||||
- - logging.md
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
class: encryption-at-rest
|
||||
|
||||
## Encryption at rest
|
||||
|
||||
- Swarm data is always encrypted
|
||||
@@ -20,8 +18,6 @@ class: encryption-at-rest
|
||||
|
||||
---
|
||||
|
||||
class: encryption-at-rest
|
||||
|
||||
## Locking a Swarm cluster
|
||||
|
||||
- This is achieved through the `docker swarm update` command
|
||||
@@ -39,8 +35,6 @@ This will display the unlock key. Copy-paste it somewhere safe.
|
||||
|
||||
---
|
||||
|
||||
class: encryption-at-rest
|
||||
|
||||
## Locked state
|
||||
|
||||
- If we restart a manager, it will now be locked
|
||||
@@ -59,8 +53,6 @@ that you [provisioned yourself](https://github.com/jpetazzo/orchestration-worksh
|
||||
|
||||
---
|
||||
|
||||
class: encryption-at-rest
|
||||
|
||||
## Checking that our node is locked
|
||||
|
||||
- Manager commands (requiring access to crypted data) will fail
|
||||
@@ -82,8 +74,6 @@ class: encryption-at-rest
|
||||
|
||||
---
|
||||
|
||||
class: encryption-at-rest
|
||||
|
||||
## Checking the state of the node programmatically
|
||||
|
||||
- The state of the node shows up in the output of `docker info`
|
||||
@@ -104,8 +94,6 @@ class: encryption-at-rest
|
||||
|
||||
---
|
||||
|
||||
class: encryption-at-rest
|
||||
|
||||
## Unlocking a node
|
||||
|
||||
- You will need the secret token that we obtained when enabling auto-lock earlier
|
||||
@@ -128,8 +116,6 @@ class: encryption-at-rest
|
||||
|
||||
---
|
||||
|
||||
class: encryption-at-rest
|
||||
|
||||
## Managing the secret key
|
||||
|
||||
- If the key is compromised, you can change it and re-encrypt with a new key:
|
||||
@@ -149,8 +135,6 @@ Note: if somebody steals both your disks and your key, .strike[you're doomed! Do
|
||||
|
||||
---
|
||||
|
||||
class: encryption-at-rest
|
||||
|
||||
## Unlocking the cluster permanently
|
||||
|
||||
- If you want to remove the secret key, disable auto-lock
|
||||
|
||||
@@ -123,7 +123,7 @@ class: extra-details
|
||||
|
||||
- Scale the service to ensure 2 copies per node:
|
||||
```bash
|
||||
docker service update <serviceID> --replicas 10
|
||||
docker service update <serviceID> --replicas 10 --detach=true
|
||||
```
|
||||
|
||||
- Check that we have two containers on the current node:
|
||||
|
||||
@@ -88,7 +88,7 @@ docker service update \
|
||||
|
||||
## Implementing auto-rollback in practice
|
||||
|
||||
We will use the following Compose file (`stacks/dockercoins+healthchecks.yml`):
|
||||
We will use the following Compose file (`stacks/dockercoins+healthcheck.yml`):
|
||||
|
||||
```yaml
|
||||
...
|
||||
@@ -119,7 +119,7 @@ We will use the following Compose file (`stacks/dockercoins+healthchecks.yml`):
|
||||
|
||||
- Deploy the updated stack:
|
||||
```bash
|
||||
docker deploy dockercoins --compose-file dockercoins+healthchecks.yml
|
||||
docker stack deploy dockercoins --compose-file dockercoins+healthcheck.yml
|
||||
```
|
||||
|
||||
]
|
||||
@@ -141,9 +141,9 @@ First, let's make an "innocent" change and deploy it.
|
||||
|
||||
- Build, ship, and run the new image:
|
||||
```bash
|
||||
export TAG=v0.3
|
||||
docker-compose -f dockercoins+healthchecks.yml build
|
||||
docker-compose -f dockercoins+healthchecks.yml push
|
||||
export TAG=v0.5
|
||||
docker-compose -f dockercoins+healthcheck.yml build
|
||||
docker-compose -f dockercoins+healthcheck.yml push
|
||||
docker service update dockercoins_hasher \
|
||||
--detach=false --image=127.0.0.1:5000/hasher:$TAG
|
||||
```
|
||||
@@ -165,9 +165,9 @@ And now, a breaking change that will cause the health check to fail:
|
||||
|
||||
- Build, ship, and run the new image:
|
||||
```bash
|
||||
export TAG=v0.4
|
||||
docker-compose -f dockercoins+healthchecks.yml build
|
||||
docker-compose -f dockercoins+healthchecks.yml push
|
||||
export TAG=v0.6
|
||||
docker-compose -f dockercoins+healthcheck.yml build
|
||||
docker-compose -f dockercoins+healthcheck.yml push
|
||||
docker service update dockercoins_hasher \
|
||||
--detach=false --image=127.0.0.1:5000/hasher:$TAG
|
||||
```
|
||||
|
||||
@@ -171,14 +171,14 @@ class: manual-btp
|
||||
docker service create --name registry --publish 5000:5000 registry:2
|
||||
```
|
||||
|
||||
- Try the following command, until it returns `{"repositories":[]}`:
|
||||
- Now try the following command; it should return `{"repositories":[]}`:
|
||||
```bash
|
||||
curl 127.0.0.1:5000/v2/_catalog
|
||||
```
|
||||
|
||||
]
|
||||
|
||||
(Retry a few times, it might take 10-20 seconds for the container to be started. Patience.)
|
||||
(If that doesn't work, wait a few seconds and try again.)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -149,20 +149,10 @@ wait
|
||||
|
||||
---
|
||||
|
||||
class: in-person
|
||||
|
||||
## If doing or re-doing the workshop on your own ...
|
||||
|
||||
---
|
||||
|
||||
class: self-paced
|
||||
|
||||
## How to get your own Docker nodes?
|
||||
|
||||
- Use [Play-With-Docker](http://www.play-with-docker.com/)!
|
||||
|
||||
--
|
||||
|
||||
- Main differences:
|
||||
|
||||
- you don't need to SSH to the machines
|
||||
|
||||
@@ -145,6 +145,7 @@ class: secrets
|
||||
]
|
||||
|
||||
Wait for the service to be fully updated with e.g. `watch docker service ps dummyservice`.
|
||||
<br/>(With Docker Engine 17.10 and later, the CLI will wait for you!)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -14,33 +14,11 @@
|
||||
|
||||
---
|
||||
|
||||
class: extra-details
|
||||
|
||||
## But first...
|
||||
|
||||
- Restart the workers
|
||||
|
||||
.exercise[
|
||||
|
||||
- Just scale back to 10 replicas:
|
||||
```bash
|
||||
docker service update dockercoins_worker --replicas 10
|
||||
```
|
||||
|
||||
- Check that they're running:
|
||||
```bash
|
||||
docker service ps dockercoins_worker
|
||||
```
|
||||
|
||||
]
|
||||
|
||||
---
|
||||
|
||||
## Updating a single service the hard way
|
||||
|
||||
- To update a single service, we could do the following:
|
||||
```bash
|
||||
REGISTRY=localhost:5000 TAG=v0.2
|
||||
REGISTRY=localhost:5000 TAG=v0.3
|
||||
IMAGE=$REGISTRY/dockercoins_webui:$TAG
|
||||
docker build -t $IMAGE webui/
|
||||
docker push $IMAGE
|
||||
@@ -55,9 +33,9 @@ class: extra-details
|
||||
|
||||
## Updating services the easy way
|
||||
|
||||
- With the Compose inbtegration, all we have to do is:
|
||||
- With the Compose integration, all we have to do is:
|
||||
```bash
|
||||
export TAG=v0.2
|
||||
export TAG=v0.3
|
||||
docker-compose -f composefile.yml build
|
||||
docker-compose -f composefile.yml push
|
||||
docker stack deploy -c composefile.yml nameofstack
|
||||
@@ -85,7 +63,7 @@ class: extra-details
|
||||
|
||||
- Build, ship, and run:
|
||||
```bash
|
||||
export TAG=v0.2
|
||||
export TAG=v0.3
|
||||
docker-compose -f dockercoins.yml build
|
||||
docker-compose -f dockercoins.yml push
|
||||
docker stack deploy -c dockercoins.yml dockercoins
|
||||
@@ -107,22 +85,6 @@ class: extra-details
|
||||
|
||||
---
|
||||
|
||||
## Making changes
|
||||
|
||||
.exercise[
|
||||
|
||||
- Edit `~/orchestration-workshop/dockercoins/worker/worker.py`
|
||||
|
||||
- Locate the line that has a `sleep` instruction
|
||||
|
||||
- Increase the `sleep` from `0.1` to `1.0`
|
||||
|
||||
- Save your changes and exit
|
||||
|
||||
]
|
||||
|
||||
---
|
||||
|
||||
## Rolling updates
|
||||
|
||||
- Let's change a scaled service: `worker`
|
||||
@@ -135,7 +97,7 @@ class: extra-details
|
||||
|
||||
- Build, ship, and run our changes:
|
||||
```bash
|
||||
export TAG=v0.3
|
||||
export TAG=v0.4
|
||||
docker-compose -f dockercoins.yml build
|
||||
docker-compose -f dockercoins.yml push
|
||||
docker stack deploy -c dockercoins.yml dockercoins
|
||||
|
||||
Reference in New Issue
Block a user