41 lines
2.0 KiB
Plaintext
41 lines
2.0 KiB
Plaintext
Lab 3 local Compose evidence, 2026-10-02, macOS/Colima arm64.
|
|
All public requests used HAProxy at http://127.0.0.1:8083; API and PostgreSQL
|
|
had no published host ports. The local .env and secrets are ignored by Git.
|
|
|
|
docker compose --env-file .env config --quiet -> PASS
|
|
docker compose --env-file .env up -d --build --wait --scale api=2 ->
|
|
api-1 healthy, api-2 healthy, postgres healthy, migrate exited 0, lb running.
|
|
make check -> PASS
|
|
make test BASE_URL=http://127.0.0.1:8083 -> PASS: lab3 public API scenario.
|
|
12 GET /health/live through LB observed two X-Instance-Id values.
|
|
|
|
Isolated PostgreSQL integration run before Compose:
|
|
python -m unittest discover -s student-tests -v -> 7 tests, OK.
|
|
Concurrent same-key requests returned identical Message; SQL count was 1.
|
|
|
|
make test-failover ACTION_SCRIPT=scripts/stop-one.sh BASE_URL=http://127.0.0.1:8083
|
|
API-1 stop: observed_instances_before=2, successful_writes=112,
|
|
failed_attempts=1, first_recovery_seconds=2.935, PASS.
|
|
docker compose ps -a: api-1 Exited (0), api-2 healthy, lb/postgres running.
|
|
Restored api-1 using docker compose up -d --wait --scale api=2.
|
|
A repeat selected api-1 again; it was not counted as the second-replica proof.
|
|
Restored api-1, sent one GET to advance round-robin, and repeated:
|
|
API-2 stop: observed_instances_before=2, successful_writes=110,
|
|
failed_attempts=1, first_recovery_seconds=3.985, PASS.
|
|
docker compose ps -a: api-2 Exited (0), api-1 healthy, lb/postgres running.
|
|
Restored api-2; both replicas healthy.
|
|
|
|
Persistence hook proof, times UTC; named postgres_data volume preserved:
|
|
before:
|
|
api-1 2026-10-02T08:46:12.886332892Z
|
|
api-2 2026-10-02T08:48:59.563753865Z
|
|
lb 2026-10-02T08:42:41.675055235Z
|
|
postgres 2026-10-02T08:42:32.879514014Z
|
|
make test-persistence ACTION_SCRIPT=scripts/restart.sh
|
|
-> PASS: confirmed data and existing session survived.
|
|
after:
|
|
api-1 2026-10-02T08:49:48.469504932Z
|
|
api-2 2026-10-02T08:49:48.407940425Z
|
|
lb 2026-10-02T08:49:54.047109297Z
|
|
postgres 2026-10-02T08:49:45.282318374Z
|