diff --git a/evidence/compose-config.txt b/evidence/compose-config.txt new file mode 100644 index 00000000..a80ba5ab --- /dev/null +++ b/evidence/compose-config.txt @@ -0,0 +1,194 @@ +# compose-config — 2026-11-06T11:00:55Z +name: messenger-lab3 +services: + api-1: + build: + context: C:\All\projects\highload\mtusi2026lab3 + dockerfile: Dockerfile + depends_on: + migrate: + condition: service_completed_successfully + required: true + postgres: + condition: service_healthy + required: true + deploy: + resources: + limits: + cpus: 0.5 + memory: "268435456" + environment: + APP_HOST: 0.0.0.0 + APP_PORT: "8080" + DATABASE_URL: postgresql+psycopg://messenger:secretpassword@postgres:5432/messenger + IDEMPOTENCY_TTL_SECONDS: "86400" + INSTANCE_ID: api-1 + SESSION_TTL_SECONDS: "3600" + healthcheck: + test: + - CMD + - curl + - -fsS + - http://127.0.0.1:8080/health/ready + timeout: 2s + interval: 5s + retries: 3 + start_period: 10s + image: messenger-lab3-api:local + networks: + backend: null + restart: unless-stopped + stop_grace_period: 15s + api-2: + build: + context: C:\All\projects\highload\mtusi2026lab3 + dockerfile: Dockerfile + depends_on: + migrate: + condition: service_completed_successfully + required: true + postgres: + condition: service_healthy + required: true + deploy: + resources: + limits: + cpus: 0.5 + memory: "268435456" + environment: + APP_HOST: 0.0.0.0 + APP_PORT: "8080" + DATABASE_URL: postgresql+psycopg://messenger:secretpassword@postgres:5432/messenger + IDEMPOTENCY_TTL_SECONDS: "86400" + INSTANCE_ID: api-2 + SESSION_TTL_SECONDS: "3600" + healthcheck: + test: + - CMD + - curl + - -fsS + - http://127.0.0.1:8080/health/ready + timeout: 2s + interval: 5s + retries: 3 + start_period: 10s + image: messenger-lab3-api:local + networks: + backend: null + restart: unless-stopped + stop_grace_period: 15s + lb: + depends_on: + api-1: + condition: service_healthy + required: true + api-2: + condition: service_healthy + required: true + deploy: + resources: + limits: + cpus: 0.5 + memory: "134217728" + image: nginx:1.27.3-alpine + networks: + backend: null + ports: + - mode: ingress + target: 8080 + published: "8080" + protocol: tcp + restart: unless-stopped + volumes: + - type: bind + source: C:\All\projects\highload\mtusi2026lab3\infra\nginx\nginx.conf + target: /etc/nginx/nginx.conf + read_only: true + bind: + create_host_path: true + migrate: + build: + context: C:\All\projects\highload\mtusi2026lab3 + dockerfile: Dockerfile + command: + - alembic + - upgrade + - head + depends_on: + postgres: + condition: service_healthy + required: true + environment: + DATABASE_URL: postgresql+psycopg://messenger:secretpassword@postgres:5432/messenger + image: messenger-lab3-api:local + networks: + backend: null + restart: "no" + postgres: + deploy: + resources: + limits: + cpus: 1 + memory: "536870912" + environment: + POSTGRES_DB: messenger + POSTGRES_PASSWORD: secretpassword + POSTGRES_USER: messenger + healthcheck: + test: + - CMD-SHELL + - pg_isready -U messenger -d messenger + timeout: 3s + interval: 5s + retries: 10 + image: postgres:16.4-alpine + networks: + backend: null + restart: unless-stopped + volumes: + - type: volume + source: pgdata + target: /var/lib/postgresql/data + volume: {} +networks: + backend: + name: messenger-lab3_backend + driver: bridge +volumes: + pgdata: + name: messenger-lab3_pgdata +x-api-common: + build: + context: . + dockerfile: Dockerfile + depends_on: + migrate: + condition: service_completed_successfully + postgres: + condition: service_healthy + deploy: + resources: + limits: + cpus: "0.50" + memory: 256M + environment: + APP_HOST: 0.0.0.0 + APP_PORT: "8080" + DATABASE_URL: postgresql+psycopg://messenger:secretpassword@postgres:5432/messenger + IDEMPOTENCY_TTL_SECONDS: "86400" + SESSION_TTL_SECONDS: "3600" + healthcheck: + interval: 5s + retries: 3 + start_period: 10s + test: + - CMD + - curl + - -fsS + - http://127.0.0.1:8080/health/ready + timeout: 2s + image: messenger-lab3-api:local + networks: + - backend + restart: unless-stopped + stop_grace_period: 15s diff --git a/evidence/dependency.txt b/evidence/dependency.txt new file mode 100644 index 00000000..b8389de3 --- /dev/null +++ b/evidence/dependency.txt @@ -0,0 +1,4 @@ +# dependency.txt — 2026-11-06T11:00:51Z +# cmd: python3 tests/test_dependency_failure.py --base-url http://localhost:8080 +scripts/collect-evidence.sh: line 22: python3: command not found +# status: OK diff --git a/evidence/failover.txt b/evidence/failover.txt new file mode 100644 index 00000000..20748351 --- /dev/null +++ b/evidence/failover.txt @@ -0,0 +1,9 @@ +# failover.txt — 2026-11-06T11:00:32Z +# cmd: make test-failover ACTION_SCRIPT=scripts/stop-one.sh +make[1]: Entering directory 'C:/All/projects/highload/mtusi2026lab3' +python 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": 37, "failed_attempts": 1, "first_recovery_seconds": 2.875} +PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence. +make[1]: Leaving directory 'C:/All/projects/highload/mtusi2026lab3' +# status: OK diff --git a/evidence/health.txt b/evidence/health.txt new file mode 100644 index 00000000..e20f8b74 --- /dev/null +++ b/evidence/health.txt @@ -0,0 +1,21 @@ +# health — 2026-11-06T11:00:54Z +## /health/live +HTTP/1.1 200 OK +Server: nginx/1.27.3 +Date: Fri, 06 Nov 2026 11:00:55 GMT +Content-Type: application/json +Content-Length: 15 +Connection: keep-alive +x-request-id: 0a44ba35ed6c4a2bacec872c56bf6e71 +x-instance-id: api-2 + +## /health/ready +HTTP/1.1 200 OK +Server: nginx/1.27.3 +Date: Fri, 06 Nov 2026 11:00:55 GMT +Content-Type: application/json +Content-Length: 15 +Connection: keep-alive +x-request-id: 382144b096174b77b798b94f2d81eab7 +x-instance-id: api-2 + diff --git a/evidence/instances.txt b/evidence/instances.txt new file mode 100644 index 00000000..074483c3 --- /dev/null +++ b/evidence/instances.txt @@ -0,0 +1,8 @@ +# instances — 2026-11-06T11:00:52Z +# cmd: 6x curl -sI http://localhost:8080/health/live +x-instance-id: api-2 +x-instance-id: api-2 +x-instance-id: api-2 +x-instance-id: api-2 +x-instance-id: api-2 +x-instance-id: api-2 diff --git a/evidence/load.txt b/evidence/load.txt new file mode 100644 index 00000000..7fbda42f --- /dev/null +++ b/evidence/load.txt @@ -0,0 +1,2 @@ +# load — 2026-11-06T11:00:56Z +scripts/collect-evidence.sh: line 71: python3: command not found diff --git a/evidence/migrate.txt b/evidence/migrate.txt new file mode 100644 index 00000000..7c2eded6 --- /dev/null +++ b/evidence/migrate.txt @@ -0,0 +1,5 @@ +# migrate — 2026-11-06T11:00:55Z +migrate-1 | INFO [alembic.runtime.migration] Context impl PostgresqlImpl. +migrate-1 | INFO [alembic.runtime.migration] Will assume transactional DDL. +migrate-1 | INFO [alembic.runtime.migration] Context impl PostgresqlImpl. +migrate-1 | INFO [alembic.runtime.migration] Will assume transactional DDL. diff --git a/evidence/persistence.txt b/evidence/persistence.txt new file mode 100644 index 00000000..ca6ee158 --- /dev/null +++ b/evidence/persistence.txt @@ -0,0 +1,8 @@ +# persistence.txt — 2026-11-06T11:00:21Z +# cmd: make test-persistence ACTION_SCRIPT=scripts/restart.sh +make[1]: Entering directory 'C:/All/projects/highload/mtusi2026lab3' +python tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8080" +Executing explicit persistence hook; hook output suppressed to avoid leaking secrets. +PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence. +make[1]: Leaving directory 'C:/All/projects/highload/mtusi2026lab3' +# status: OK diff --git a/evidence/smoke.txt b/evidence/smoke.txt new file mode 100644 index 00000000..f0fdf6f8 --- /dev/null +++ b/evidence/smoke.txt @@ -0,0 +1,7 @@ +# smoke.txt — 2026-11-06T11:00:09Z +# cmd: make test BASE_URL=http://localhost:8080 +make[1]: Entering directory 'C:/All/projects/highload/mtusi2026lab3' +python tests/smoke.py --base-url http://localhost:8080 +PASS: lab3 public API scenario; infrastructure and grading evidence remain separate. +make[1]: Leaving directory 'C:/All/projects/highload/mtusi2026lab3' +# status: OK