|
|
|
|
# TP Rolling Update
|
|
|
|
|
|
|
|
|
|
Maîtriser les mises à jour d'applications.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* Créer un service nommé `wit` basé sur l'image
|
|
|
|
|
`xian310/who-is-there:1`
|
|
|
|
|
|
|
|
|
|
- publier le port 8080 sur le port 8080 de l'hôte
|
|
|
|
|
|
|
|
|
|
- Augmenter le nombre de réplicas à `10`
|
|
|
|
|
|
|
|
|
|
* Vérifier que tout est OK
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- .slide: data-background="#2E2E2E" data-state="small-code" -->
|
|
|
|
|
Créer le service `wit`
|
|
|
|
|
```none
|
|
|
|
|
$ docker service create --name wit --publish 8080:8080 xian310/who-is-there:1
|
|
|
|
|
pm5wkigy4m5bbtby5kccgh62y
|
|
|
|
|
overall progress: 1 out of 1 tasks
|
|
|
|
|
1/1: running [==================================================>]
|
|
|
|
|
verify: Service converged
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Augmenter le nombre de réplicas à `10`
|
|
|
|
|
```none
|
|
|
|
|
$ docker service scale wit=10
|
|
|
|
|
wit scaled to 10
|
|
|
|
|
overall progress: 10 out of 10 tasks
|
|
|
|
|
1/10: running [==================================================>]
|
|
|
|
|
2/10: running [==================================================>]
|
|
|
|
|
3/10: running [==================================================>]
|
|
|
|
|
4/10: running [==================================================>]
|
|
|
|
|
5/10: running [==================================================>]
|
|
|
|
|
6/10: running [==================================================>]
|
|
|
|
|
7/10: running [==================================================>]
|
|
|
|
|
8/10: running [==================================================>]
|
|
|
|
|
9/10: running [==================================================>]
|
|
|
|
|
10/10: running [==================================================>]
|
|
|
|
|
verify: Service converged
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- .slide: data-background="#2E2E2E" data-state="small-code" -->
|
|
|
|
|
Vérifier que les 10 réplicas sont bien créés
|
|
|
|
|
|
|
|
|
|
```none
|
|
|
|
|
$ docker service ps wit
|
|
|
|
|
ID NAME IMAGE NODE DESIRED S. CURRENT STATE
|
|
|
|
|
wc8iu98rk5k5 wit.1 xian310/who-is-there:1 docker-1 Running Running 2 minutes ago
|
|
|
|
|
vhj8dqrn2auo wit.2 xian310/who-is-there:1 docker-1 Running Running about a minute ago
|
|
|
|
|
w2ccwu1p131e wit.3 xian310/who-is-there:1 docker-1 Running Running about a minute ago
|
|
|
|
|
9aels4fc44oi wit.4 xian310/who-is-there:1 docker-1 Running Running about a minute ago
|
|
|
|
|
x4hm8nnmpyj6 wit.5 xian310/who-is-there:1 docker-1 Running Running about a minute ago
|
|
|
|
|
uz4jew83vgdz wit.6 xian310/who-is-there:1 docker-1 Running Running about a minute ago
|
|
|
|
|
2oy1al8c93mu wit.7 xian310/who-is-there:1 docker-1 Running Running about a minute ago
|
|
|
|
|
in2pxcvg6lyi wit.8 xian310/who-is-there:1 docker-1 Running Running about a minute ago
|
|
|
|
|
7sbqqr9k5wdq wit.9 xian310/who-is-there:1 docker-1 Running Running about a minute ago
|
|
|
|
|
yvbljq6gb3ir wit.10 xian310/who-is-there:1 docker-1 Running Running about a minute ago
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* Dans un premier terminal, lancer un watch sur la commande `docker service ps wit`.
|
|
|
|
|
|
|
|
|
|
* Dans un second terminal, mettre à jour l'image sur laquelle le service est basé.
|
|
|
|
|
|
|
|
|
|
* Observer les changements en temps réel dans le premier terminal.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- .slide: data-background="#2E2E2E" data-state="small-code" -->
|
|
|
|
|
Mettre à jour l'image
|
|
|
|
|
```none
|
|
|
|
|
$ docker service update wit --image xian310/who-is-there:2
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<!-- .slide: data-background="#2E2E2E" data-state="small-code" -->
|
|
|
|
|
Après quelques secondes...
|
|
|
|
|
```none
|
|
|
|
|
$ watch docker service ps wit
|
|
|
|
|
|
|
|
|
|
ID NAME IMAGE NODE DESIRED S. CURRENT STATE
|
|
|
|
|
wc8iu98rk5k5 wit.1 xian310/who-is-there:1 docker-1 Running Running 6 minutes ago
|
|
|
|
|
vhj8dqrn2auo wit.2 xian310/who-is-there:1 docker-1 Running Running 4 minutes ago
|
|
|
|
|
w2ccwu1p131e wit.3 xian310/who-is-there:1 docker-1 Running Running 4 minutes ago
|
|
|
|
|
ppglvxmngnz2 wit.4 xian310/who-is-there:2 docker-1 Ready Ready less than a secon
|
|
|
|
|
9aels4fc44oi \_ wit.4 xian310/who-is-there:1 docker-1 Shutdown Running less than a sec
|
|
|
|
|
ttue4n87o1cu wit.5 xian310/who-is-there:2 docker-1 Running Running 5 seconds ago
|
|
|
|
|
x4hm8nnmpyj6 \_ wit.5 xian310/who-is-there:1 docker-1 Shutdown Shutdown 7 seconds ago
|
|
|
|
|
uz4jew83vgdz wit.6 xian310/who-is-there:1 docker-1 Running Running 4 minutes ago
|
|
|
|
|
2oy1al8c93mu wit.7 xian310/who-is-there:1 docker-1 Running Running 4 minutes ago
|
|
|
|
|
in2pxcvg6lyi wit.8 xian310/who-is-there:1 docker-1 Running Running 4 minutes ago
|
|
|
|
|
7sbqqr9k5wdq wit.9 xian310/who-is-there:1 docker-1 Running Running 4 minutes ago
|
|
|
|
|
1jcfqalsi6sc wit.10 xian310/who-is-there:2 docker-1 Running Running 1 second ago
|
|
|
|
|
yvbljq6gb3ir \_ wit.10 xian310/who-is-there:1 docker-1 Shutdown Shutdown 1 second ago
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- .slide: data-background="#2E2E2E" data-state="small-code" -->
|
|
|
|
|
Un peu plus tard...
|
|
|
|
|
```none
|
|
|
|
|
ID NAME IMAGE NODE DESIRED S. CURRENT STATE
|
|
|
|
|
oodma7llrqzn wit.1 xian310/who-is-there:2 docker-1 Running Running 28 seconds ago
|
|
|
|
|
wc8iu98rk5k5 \_ wit.1 xian310/who-is-there:1 docker-1 Shutdown Shutdown 29 seconds ago
|
|
|
|
|
jf6dw9uoyghb wit.2 xian310/who-is-there:2 docker-1 Running Running 46 seconds ago
|
|
|
|
|
vhj8dqrn2auo \_ wit.2 xian310/who-is-there:1 docker-1 Shutdown Shutdown 46 seconds ago
|
|
|
|
|
w4zk5sgd6t74 wit.3 xian310/who-is-there:2 docker-1 Running Running 41 seconds ago
|
|
|
|
|
w2ccwu1p131e \_ wit.3 xian310/who-is-there:1 docker-1 Shutdown Shutdown 42 seconds ago
|
|
|
|
|
ppglvxmngnz2 wit.4 xian310/who-is-there:2 docker-1 Running Running 59 seconds ago
|
|
|
|
|
9aels4fc44oi \_ wit.4 xian310/who-is-there:1 docker-1 Shutdown Shutdown 59 seconds ago
|
|
|
|
|
ttue4n87o1cu wit.5 xian310/who-is-there:2 docker-1 Running Running about a minute
|
|
|
|
|
x4hm8nnmpyj6 \_ wit.5 xian310/who-is-there:1 docker-1 Shutdown Shutdown about a minute
|
|
|
|
|
xl9j97q560vd wit.6 xian310/who-is-there:2 docker-1 Running Running 50 seconds ago
|
|
|
|
|
uz4jew83vgdz \_ wit.6 xian310/who-is-there:1 docker-1 Shutdown Shutdown 51 seconds ago
|
|
|
|
|
m471v74d0rog wit.7 xian310/who-is-there:2 docker-1 Running Running 37 seconds ago
|
|
|
|
|
2oy1al8c93mu \_ wit.7 xian310/who-is-there:1 docker-1 Shutdown Shutdown 38 seconds ago
|
|
|
|
|
ssiull3z1h68 wit.8 xian310/who-is-there:2 docker-1 Running Running 54 seconds ago
|
|
|
|
|
in2pxcvg6lyi \_ wit.8 xian310/who-is-there:1 docker-1 Shutdown Shutdown 55 seconds ago
|
|
|
|
|
zfbxw3yns3ec wit.9 xian310/who-is-there:2 docker-1 Running Running 33 seconds ago
|
|
|
|
|
7sbqqr9k5wdq \_ wit.9 xian310/who-is-there:1 docker-1 Shutdown Shutdown 34 seconds ago
|
|
|
|
|
1jcfqalsi6sc wit.10 xian310/who-is-there:2 docker-1 Running Running about a minute
|
|
|
|
|
yvbljq6gb3ir \_ wit.10 xian310/who-is-there:1 docker-1 Shutdown Shutdown about a minute
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* Effectuer un rollback pour revenir à la version précédente de l'application.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- .slide: data-background="#2E2E2E" data-state="small-code" -->
|
|
|
|
|
Retour à la version précédente
|
|
|
|
|
```none
|
|
|
|
|
$ docker service rollback wit
|
|
|
|
|
ou
|
|
|
|
|
$ docker service update wit --image xian310/who-is-there:1
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Un peu plus tard...
|
|
|
|
|
```none
|
|
|
|
|
$ docker service ps wit
|
|
|
|
|
ID NAME IMAGE NODE DESIRED S. CURRENT STATE
|
|
|
|
|
ud4218ok1y48 wit.1 xian310/who-is-there:1 docker-1 Running Running 50 seconds ago
|
|
|
|
|
oodma7llrqzn \_ wit.1 xian310/who-is-there:2 docker-1 Shutdown Shutdown 51 seconds ago
|
|
|
|
|
wc8iu98rk5k5 \_ wit.1 xian310/who-is-there:1 docker-1 Shutdown Shutdown 38 minutes ago
|
|
|
|
|
nk23q3nxe13g wit.2 xian310/who-is-there:1 docker-1 Running Running 24 seconds ago
|
|
|
|
|
jf6dw9uoyghb \_ wit.2 xian310/who-is-there:2 docker-1 Shutdown Shutdown 25 seconds ago
|
|
|
|
|
vhj8dqrn2auo \_ wit.2 xian310/who-is-there:1 docker-1 Shutdown Shutdown 38 minutes ago
|
|
|
|
|
3issn6des2o7 wit.3 xian310/who-is-there:1 docker-1 Running Running 41 seconds ago
|
|
|
|
|
w4zk5sgd6t74 \_ wit.3 xian310/who-is-there:2 docker-1 Shutdown Shutdown 42 seconds ago
|
|
|
|
|
w2ccwu1p131e \_ wit.3 xian310/who-is-there:1 docker-1 Shutdown Shutdown 38 minutes ago
|
|
|
|
|
...
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Un seul niveau de retour arrière est possible.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Les options `--update-parallelism` et `--update-delay` permettent d'influencer le déroulement des opérations.
|