70 lines
4.8 KiB
Plaintext
70 lines
4.8 KiB
Plaintext
$ make instances
|
||
./scripts/instances.sh
|
||
CONTAINER STATE INSTANCE PID REVISION
|
||
messenger-lab3-api-1 running/healthy b0b074af6d9c 18674 dev
|
||
messenger-lab3-api-2 running/healthy 389b271f592b 95685 dev
|
||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
|
||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||
{"observed_instances_before": 2, "successful_writes": 128, "failed_attempts": 0, "first_recovery_seconds": 1.616}
|
||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||
$ make instances
|
||
./scripts/instances.sh
|
||
CONTAINER STATE INSTANCE PID REVISION
|
||
messenger-lab3-api-1 exited/unhealthy - 0 dev
|
||
messenger-lab3-api-2 running/healthy 389b271f592b 95685 dev
|
||
$ docker inspect -f "{{.Name}} status={{.State.Status}} exit={{.State.ExitCode}} finished={{.State.FinishedAt}}" $(docker compose ps -aq api)
|
||
/messenger-lab3-api-1 status=exited exit=0 finished=2026-10-19T17:02:10.511955087Z
|
||
/messenger-lab3-api-2 status=running exit=0 finished=0001-01-01T00:00:00Z
|
||
$ make restore
|
||
./scripts/restore.sh
|
||
Container messenger-lab3-api-2 Running
|
||
Container messenger-lab3-api-1 Starting
|
||
Container messenger-lab3-api-1 Started
|
||
Container messenger-lab3-api-1 Waiting
|
||
Container messenger-lab3-api-2 Waiting
|
||
Container messenger-lab3-api-1 Healthy
|
||
Container messenger-lab3-api-2 Healthy
|
||
$ make instances
|
||
./scripts/instances.sh
|
||
CONTAINER STATE INSTANCE PID REVISION
|
||
messenger-lab3-api-1 running/healthy e06c3c21d163 21196 dev
|
||
messenger-lab3-api-2 running/healthy 389b271f592b 95685 dev
|
||
$ curl -s -o /dev/null -w "shift round-robin: %{http_code}\n" http://localhost:8080/health/live
|
||
shift round-robin: 200
|
||
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
|
||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
|
||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||
{"observed_instances_before": 2, "successful_writes": 129, "failed_attempts": 0, "first_recovery_seconds": 1.618}
|
||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||
$ make instances
|
||
./scripts/instances.sh
|
||
CONTAINER STATE INSTANCE PID REVISION
|
||
messenger-lab3-api-1 running/healthy e06c3c21d163 21196 dev
|
||
messenger-lab3-api-2 exited/unhealthy - 0 dev
|
||
$ docker inspect -f "{{.Name}} status={{.State.Status}} exit={{.State.ExitCode}} finished={{.State.FinishedAt}}" $(docker compose ps -aq api)
|
||
/messenger-lab3-api-1 status=running exit=0 finished=2026-10-19T17:02:10.511955087Z
|
||
/messenger-lab3-api-2 status=exited exit=0 finished=2026-10-19T17:02:43.134886046Z
|
||
$ docker compose logs api-2 2>/dev/null | grep -E "SIGTERM|Application stopped|Finished server process" || docker compose logs api | grep -E "SIGTERM|Application stopped" | tail -2
|
||
api-1 | 2026-10-19 17:02:09.336 | INFO | __main__:shutdown:91 - SIGTERM: drain 1.0 с, instance=b0b074af6d9c: порт закрыт, keep-alive соединения закрываются после ответа
|
||
api-1 | 2026-10-19 17:02:10.443 | INFO | __main__:lifespan:54 - Application stopped, instance=b0b074af6d9c, connections closed
|
||
$ make restore
|
||
./scripts/restore.sh
|
||
Container messenger-lab3-api-1 Running
|
||
Container messenger-lab3-api-2 Starting
|
||
Container messenger-lab3-api-2 Started
|
||
Container messenger-lab3-api-1 Waiting
|
||
Container messenger-lab3-api-2 Waiting
|
||
Container messenger-lab3-api-1 Healthy
|
||
Container messenger-lab3-api-2 Healthy
|
||
$ make instances
|
||
./scripts/instances.sh
|
||
CONTAINER STATE INSTANCE PID REVISION
|
||
messenger-lab3-api-1 running/healthy e06c3c21d163 21196 dev
|
||
messenger-lab3-api-2 running/healthy 774df521af21 22387 dev
|
||
$ docker logs messenger-lab3-api-2 2>&1 | grep -E "instance=389b271f592b|Finished server process"
|
||
2026-10-19 17:00:05.226 | INFO | __main__:lifespan:45 - Application started, env=lab, revision=dev, instance=389b271f592b, session ttl=3600 s
|
||
2026-10-19 17:02:41.948 | INFO | __main__:shutdown:91 - SIGTERM: drain 1.0 с, instance=389b271f592b: порт закрыт, keep-alive соединения закрываются после ответа
|
||
2026-10-19 17:02:43.068 | INFO | __main__:lifespan:54 - Application stopped, instance=389b271f592b, connections closed
|
||
INFO: Finished server process [1]
|