forked from mtusi2026/mtusi2026lab3
113 lines
6.6 KiB
Plaintext
113 lines
6.6 KiB
Plaintext
|
|
=== 1. Start the whole stack from a clean clone ===
|
|
config --quiet: OK
|
|
|
|
Image mtusi2026lab3-api1 Built
|
|
Image mtusi2026lab3-api2 Built
|
|
Container mtusi2026lab3-db-1 Running
|
|
Container mtusi2026lab3-api2-1 Recreated
|
|
Container mtusi2026lab3-api1-1 Recreated
|
|
Container mtusi2026lab3-lb-1 Running
|
|
Container mtusi2026lab3-db-1 Healthy
|
|
Container mtusi2026lab3-db-1 Healthy
|
|
Container mtusi2026lab3-api1-1 Started
|
|
Container mtusi2026lab3-api2-1 Started
|
|
Container mtusi2026lab3-api2-1 Healthy
|
|
Container mtusi2026lab3-api1-1 Healthy
|
|
|
|
=== 2. Containers (one public LB, two API replicas, one DB) ===
|
|
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
|
mtusi2026lab3-api1-1 mtusi2026lab3-api1 "python -m app" api1 7 seconds ago Up 5 seconds (healthy) 8080/tcp
|
|
mtusi2026lab3-api2-1 mtusi2026lab3-api2 "python -m app" api2 7 seconds ago Up 5 seconds (healthy) 8080/tcp
|
|
mtusi2026lab3-db-1 postgres:16-alpine "docker-entrypoint.sтАж" db 6 minutes ago Up 47 seconds (healthy) 5432/tcp
|
|
mtusi2026lab3-lb-1 nginx:1.27-alpine "/docker-entrypoint.тАж" lb 6 minutes ago Up 4 minutes 0.0.0.0:8080->8080/tcp, [::]:8080->8080/tcp
|
|
|
|
=== 3. X-Instance-Id seen by one client through the LB (same token profile) ===
|
|
x-instance-id: api1
|
|
x-instance-id: api1
|
|
x-instance-id: api2
|
|
x-instance-id: api1
|
|
x-instance-id: api2
|
|
x-instance-id: api1
|
|
x-instance-id: api2
|
|
x-instance-id: api1
|
|
|
|
=== 4. Public smoke ===
|
|
ready after 0 s
|
|
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
|
|
|
|
=== 5. Rows and idempotency ledger BEFORE restart ===
|
|
users | sessions | chats | messages | idem
|
|
-------+----------+-------+----------+------
|
|
36 | 31 | 12 | 205 | 205
|
|
(1 row)
|
|
|
|
name
|
|
--------------
|
|
001_init.sql
|
|
(1 row)
|
|
|
|
=== 6. Persistence hook (restart DB + both API replicas, volumes preserved) ===
|
|
cmd : Container mtusi2026lab3-api1-1 Restarting
|
|
C:\Users\Tankist\AppData\Local\Temp\opencode\capture_lab3.ps1:46 знак:3
|
|
+ cmd /c 'scripts\restart.cmd' 2>&1
|
|
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
+ CategoryInfo : NotSpecified: ( Container mtus...1-1 Restarting :String) [], RemoteException
|
|
+ FullyQualifiedErrorId : NativeCommandError
|
|
|
|
Container mtusi2026lab3-db-1 Restarting
|
|
Container mtusi2026lab3-api2-1 Restarting
|
|
Container mtusi2026lab3-db-1 Started
|
|
Container mtusi2026lab3-api2-1 Started
|
|
Container mtusi2026lab3-api1-1 Started
|
|
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
|
mtusi2026lab3-api1-1 mtusi2026lab3-api1 "python -m app" api1 10 seconds ago Up Less than a second (health: starting) 8080/tcp
|
|
mtusi2026lab3-api2-1 mtusi2026lab3-api2 "python -m app" api2 10 seconds ago Up Less than a second (health: starting) 8080/tcp
|
|
mtusi2026lab3-db-1 postgres:16-alpine "docker-entrypoint.sтАж" db 6 minutes ago Up Less than a second (health: starting) 5432/tcp
|
|
mtusi2026lab3-lb-1 nginx:1.27-alpine "/docker-entrypoint.тАж" lb 6 minutes ago Up 4 minutes 0.0.0.0:8080->8080/tcp, [::]:8080->8080/tcp
|
|
|
|
=== 7. Persistence test with the same token ===
|
|
ready after 6 s
|
|
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
|
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
|
ready after 0 s
|
|
|
|
=== 8. Failover hook (stop exactly one API replica, then restore it) ===
|
|
cmd : Container mtusi2026lab3-api1-1 Stopping
|
|
C:\Users\Tankist\AppData\Local\Temp\opencode\capture_lab3.ps1:57 знак:3
|
|
+ cmd /c 'set TARGET_INSTANCE_ID=api1&& scripts\stop-one.cmd' 2>&1
|
|
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
+ CategoryInfo : NotSpecified: ( Container mtus...pi1-1 Stopping :String) [], RemoteException
|
|
+ FullyQualifiedErrorId : NativeCommandError
|
|
|
|
Container mtusi2026lab3-api1-1 Stopped
|
|
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
|
mtusi2026lab3-api2-1 mtusi2026lab3-api2 "python -m app" api2 24 seconds ago Up 7 seconds (healthy) 8080/tcp
|
|
mtusi2026lab3-db-1 postgres:16-alpine "docker-entrypoint.sтАж" db 6 minutes ago Up 7 seconds (healthy) 5432/tcp
|
|
mtusi2026lab3-lb-1 nginx:1.27-alpine "/docker-entrypoint.тАж" lb 6 minutes ago Up 4 minutes 0.0.0.0:8080->8080/tcp, [::]:8080->8080/tcp
|
|
ready after 0 s
|
|
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
|
mtusi2026lab3-api1-1 mtusi2026lab3-api1 "python -m app" api1 33 seconds ago Up 8 seconds (healthy) 8080/tcp
|
|
mtusi2026lab3-api2-1 mtusi2026lab3-api2 "python -m app" api2 33 seconds ago Up 16 seconds (healthy) 8080/tcp
|
|
mtusi2026lab3-db-1 postgres:16-alpine "docker-entrypoint.sтАж" db 6 minutes ago Up 16 seconds (healthy) 5432/tcp
|
|
mtusi2026lab3-lb-1 nginx:1.27-alpine "/docker-entrypoint.тАж" lb 6 minutes ago Up 5 minutes 0.0.0.0:8080->8080/tcp, [::]:8080->8080/tcp
|
|
|
|
=== 9. Failover test through the LB ===
|
|
ready after 0 s
|
|
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
|
{"observed_instances_before": 2, "successful_writes": 106, "failed_attempts": 2, "first_recovery_seconds": 0.608}
|
|
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
|
ready after 0 s
|
|
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
|
mtusi2026lab3-api1-1 mtusi2026lab3-api1 "python -m app" api1 52 seconds ago Up Less than a second (health: starting) 8080/tcp
|
|
mtusi2026lab3-api2-1 mtusi2026lab3-api2 "python -m app" api2 52 seconds ago Up 34 seconds (healthy) 8080/tcp
|
|
mtusi2026lab3-db-1 postgres:16-alpine "docker-entrypoint.sтАж" db 7 minutes ago Up 34 seconds (healthy) 5432/tcp
|
|
mtusi2026lab3-lb-1 nginx:1.27-alpine "/docker-entrypoint.тАж" lb 7 minutes ago Up 5 minutes 0.0.0.0:8080->8080/tcp, [::]:8080->8080/tcp
|
|
|
|
=== 10. Own unit tests and offline check ===
|
|
----------------------------------------------------------------------
|
|
Ran 11 tests in 0.270s
|
|
|
|
OK
|
|
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|