﻿  $ docker compose --env-file .env build api
  $ docker compose --env-file .env run --rm migrate
  $ docker image inspect -f {{.Id}} mtusi-messenger:lab3
  $ docker compose --env-file .env ps -q api
  ok   - 2 replicas before update
  $ docker inspect -f {{.Image}} b5c5b15326cda7faec130cd40e44c64bc75fab16d4822d19c77e293d61e90556
  $ docker inspect -f {{.Image}} c2fc366c1f6bd4375d56f4cacc53ccc56acf6bc744c8450718cf448035bdb435
  $ docker compose --env-file .env ps -q api
  $ docker compose --env-file .env up -d --no-deps --no-recreate --scale api=3 api
  $ docker compose --env-file .env ps -q api
  ok   - one new replica started for b5c5b15326cd
  $ docker inspect -f {{.State.Health.Status}} dc76a00e8ff80eeb393286be367dc2e42aa1f2c55314739b12c77902a52a08a7
  $ docker inspect -f {{.State.Health.Status}} dc76a00e8ff80eeb393286be367dc2e42aa1f2c55314739b12c77902a52a08a7
  $ docker inspect -f {{.State.Health.Status}} dc76a00e8ff80eeb393286be367dc2e42aa1f2c55314739b12c77902a52a08a7
  $ docker inspect -f {{.State.Health.Status}} dc76a00e8ff80eeb393286be367dc2e42aa1f2c55314739b12c77902a52a08a7
  $ docker inspect -f {{.State.Health.Status}} dc76a00e8ff80eeb393286be367dc2e42aa1f2c55314739b12c77902a52a08a7
  $ docker inspect -f {{.State.Health.Status}} dc76a00e8ff80eeb393286be367dc2e42aa1f2c55314739b12c77902a52a08a7
  $ docker inspect -f {{.State.Health.Status}} dc76a00e8ff80eeb393286be367dc2e42aa1f2c55314739b12c77902a52a08a7
  $ docker stop -t 15 b5c5b15326cda7faec130cd40e44c64bc75fab16d4822d19c77e293d61e90556
  $ docker rm b5c5b15326cda7faec130cd40e44c64bc75fab16d4822d19c77e293d61e90556
  ok   - new replica dc76a00e8ff8 healthy and in LB before old b5c5b15326cd stops
  $ docker compose --env-file .env ps -q api
  $ docker compose --env-file .env up -d --no-deps --no-recreate --scale api=3 api
  $ docker compose --env-file .env ps -q api
  ok   - one new replica started for c2fc366c1f6b
  $ docker inspect -f {{.State.Health.Status}} 751a5997c6bc08109eb9a7b18c734172b958053acb542f3df1bec0674c4ad534
  $ docker inspect -f {{.State.Health.Status}} 751a5997c6bc08109eb9a7b18c734172b958053acb542f3df1bec0674c4ad534
  $ docker inspect -f {{.State.Health.Status}} 751a5997c6bc08109eb9a7b18c734172b958053acb542f3df1bec0674c4ad534
  $ docker inspect -f {{.State.Health.Status}} 751a5997c6bc08109eb9a7b18c734172b958053acb542f3df1bec0674c4ad534
  $ docker inspect -f {{.State.Health.Status}} 751a5997c6bc08109eb9a7b18c734172b958053acb542f3df1bec0674c4ad534
  $ docker inspect -f {{.State.Health.Status}} 751a5997c6bc08109eb9a7b18c734172b958053acb542f3df1bec0674c4ad534
  $ docker inspect -f {{.State.Health.Status}} 751a5997c6bc08109eb9a7b18c734172b958053acb542f3df1bec0674c4ad534
  $ docker stop -t 15 c2fc366c1f6bd4375d56f4cacc53ccc56acf6bc744c8450718cf448035bdb435
  $ docker rm c2fc366c1f6bd4375d56f4cacc53ccc56acf6bc744c8450718cf448035bdb435
  ok   - new replica 751a5997c6bc healthy and in LB before old c2fc366c1f6b stops
  $ docker compose --env-file .env ps -q api
  $ docker inspect -f {{.Image}} dc76a00e8ff80eeb393286be367dc2e42aa1f2c55314739b12c77902a52a08a7
  $ docker inspect -f {{.Image}} 751a5997c6bc08109eb9a7b18c734172b958053acb542f3df1bec0674c4ad534
{
  "replicas_before": [
    "b5c5b15326cd",
    "c2fc366c1f6b"
  ],
  "replicas_after": [
    "751a5997c6bc",
    "dc76a00e8ff8"
  ],
  "all_on_new_image": true,
  "steps": [
    {
      "old": "b5c5b15326cd",
      "new": "dc76a00e8ff8",
      "new_healthy": true,
      "new_served_by_lb": true,
      "old_stop_seconds": 1.29
    },
    {
      "old": "c2fc366c1f6b",
      "new": "751a5997c6bc",
      "new_healthy": true,
      "new_served_by_lb": true,
      "old_stop_seconds": 1.36
    }
  ],
  "update_duration_s": 18.6,
  "before_update": {
    "successful": 475,
    "errors": 0,
    "successful_rps": 158.2
  },
  "during_update": {
    "successful": 2634,
    "errors": 0,
    "successful_rps": 141.5
  },
  "after_update": {
    "successful": 507,
    "errors": 0,
    "successful_rps": 169.0
  },
  "max_gap_without_success_s": 0.469,
  "instances_serving_at_end": [
    "751a5997c6bc",
    "dc76a00e8ff8"
  ],
  "history_messages": 3620,
  "confirmed": 3620,
  "lost_or_changed": 0,
  "duplicate_texts": 0,
  "retries_with_same_key": 0
}
  ok   - replica count restored to 2
  ok   - all replicas run the new image
  ok   - old replicas no longer serve traffic
  ok   - no lost or duplicated writes

9 passed, 0 failed
