mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-07-24 07:16:26 +00:00
smoothing out update/rollback slides
This commit is contained in:
committed by
Jérôme Petazzoni
parent
f0b48935fa
commit
523ca55831
@@ -1,57 +1,23 @@
|
||||
# Rolling updates
|
||||
|
||||
- Let's change a scaled service: `hasher`
|
||||
- Let's force an update on worker to watch it update
|
||||
|
||||
.exercise[
|
||||
|
||||
- Update the `sleep` delay in the code to 0.2:
|
||||
- First lets scale hasher to 5 replicas:
|
||||
```bash
|
||||
sed -i "s/sleep 0.1/sleep 0.2/" dockercoins/hasher/hasher.rb
|
||||
docker service scale dockercoins_worker=5
|
||||
```
|
||||
|
||||
- Build, ship, and run our changes:
|
||||
- Force a rolling update (replace containers) without a change:
|
||||
```bash
|
||||
export TAG=v0.4
|
||||
docker-compose -f dockercoins.yml build
|
||||
docker-compose -f dockercoins.yml push
|
||||
docker service update dockercoins_hasher \
|
||||
--image=127.0.0.1:5000/hasher:$TAG
|
||||
docker service update --force dockercoins_worker
|
||||
```
|
||||
|
||||
]
|
||||
|
||||
---
|
||||
|
||||
## Viewing our update as it rolls out
|
||||
|
||||
.exercise[
|
||||
|
||||
- Check the status of the `dockercoins_worker` service:
|
||||
```bash
|
||||
watch docker service ps dockercoins_worker
|
||||
```
|
||||
|
||||
<!-- ```wait dockercoins_worker.1``` -->
|
||||
<!-- ```keys ^C``` -->
|
||||
|
||||
- Hide the tasks that are shutdown:
|
||||
```bash
|
||||
watch -n1 "docker service ps dockercoins_worker | grep -v Shutdown.*Shutdown"
|
||||
```
|
||||
|
||||
<!-- ```wait dockercoins_worker.1``` -->
|
||||
<!-- ```keys ^C``` -->
|
||||
|
||||
]
|
||||
|
||||
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 by one.
|
||||
|
||||
---
|
||||
|
||||
## Changing the upgrade policy
|
||||
|
||||
- We can set upgrade parallelism (how many instances to update at the same time)
|
||||
|
||||
Reference in New Issue
Block a user