Files
mtusi2026lab3/evidence/criteria/4-03-resources.md
T
2026-10-10 21:32:33 +03:00

244 lines
6.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 4: лимиты, изоляция, секреты и масштабирование
## Что проверяется
Проверяются фактические CPU/RAM, отсутствие host-портов API/БД/Redis, private networks, отсутствие persistent mounts у API; .env игнорируется Git, container_name не задан.
Статус выполнения проверок: **PASS**. Для исследования PASS означает успешную проверку данных и правил анализа; решение гипотезы указано отдельно и может быть неопределённым.
Запуск: `lab3-report-04`. Команды выполнены из корня проекта в WSL; время и версии указаны в manifest.
## Команды и фактический вывод
### resources
Проверка приложения.
```sh
python3 scripts/check_resources.py
```
Начало UTC: `2026-10-10T16:21:18.746302+00:00`; конец UTC: `2026-10-10T16:21:20.429529+00:00`; exit code: **0**.
Вывод команды:
```text
[
{
"service": "db",
"instance": "edfcf3091ee4",
"cpu_limit": 1.0,
"memory_mib": 512,
"networks": [
"highload-lab3_data"
],
"public_ports": {}
},
{
"service": "redis",
"instance": "9878e4b8eced",
"cpu_limit": 0.25,
"memory_mib": 128,
"networks": [
"highload-lab3_data"
],
"public_ports": {}
},
{
"service": "migrate",
"instance": "d48adc3211d7",
"cpu_limit": 0.5,
"memory_mib": 128,
"networks": [
"highload-lab3_data"
],
"public_ports": {}
},
{
"service": "api",
"instance": "04f3baa4775a",
"cpu_limit": 0.5,
"memory_mib": 128,
"networks": [
"highload-lab3_data",
"highload-lab3_proxy"
],
"public_ports": {}
},
{
"service": "api",
"instance": "4864ca4d784f",
"cpu_limit": 0.5,
"memory_mib": 128,
"networks": [
"highload-lab3_data",
"highload-lab3_proxy"
],
"public_ports": {}
},
{
"service": "haproxy",
"instance": "1931592c46c7",
"cpu_limit": 0.5,
"memory_mib": 128,
"networks": [
"highload-lab3_edge",
"highload-lab3_proxy"
],
"public_ports": {
"8080/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8080"
}
],
"8404/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "8404"
}
]
}
},
{
"service": "frontend",
"instance": "ceb091ff4cee",
"cpu_limit": 0.5,
"memory_mib": 512,
"networks": [
"highload-lab3_edge"
],
"public_ports": {
"5173/tcp": [
{
"HostIp": "127.0.0.1",
"HostPort": "5173"
}
]
}
}
]
PASS: effective CPU/RAM limits, two API replicas, private storage/API, isolated frontend
```
Полный сохранённый вывод: [evidence/criteria/runs/lab3-report-04/resources.txt](runs/lab3-report-04/resources.txt).
- [evidence/criteria/runs/lab3-report-04/resources.json](runs/lab3-report-04/resources.json)
### inventory
Проверка приложения.
```sh
python3 scripts/generate_evidence.py --inspect
```
Начало UTC: `2026-10-10T16:21:17.236315+00:00`; конец UTC: `2026-10-10T16:21:18.715399+00:00`; exit code: **0**.
Фрагмент вывода; полный журнал доступен по ссылке ниже.
```text
{
"containers": [
{
"service": "api",
"instance": "04f3baa4775a",
"state": "running",
"exit_code": 0,
"health": "healthy",
"cpu": 500000000,
"memory": 134217728,
"ports": {},
"networks": {
"highload-lab3_data": {
"address": "172.25.0.5"
},
"highload-lab3_proxy": {
"address": "172.24.0.3"
}
},
"image": "sha256:363f45fa05716cae10a22502ffcf239d6caa1071b83ffff36f38293bfc23c01b",
"started": "2026-10-10T16:14:19.585285959Z",
"container_id": "04f3baa4775a9bbbdddef6946e6afd668350a2122344523620da4c9ab01b7d98",
"gomaxprocs": "1"
},
{
"service": "api",
"instance": "4864ca4d784f",
"state": "running",
"exit_code": 0,
"health": "healthy",
"cpu": 500000000,
"memory": 134217728,
"ports": {},
"networks": {
"highload-lab3_data": {
"address": "172.25.0.4"
},
"highload-lab3_proxy": {
"address": "172.24.0.2"
}
},
"image": "sha256:363f45fa05716cae10a22502ffcf239d6caa1071b83ffff36f38293bfc23c01b",
"started": "2026-10-10T16:15:26.924492269Z",
"container_id": "4864ca4d784f90c711346dfa3e290dfeb54e65f53dd2aa0019cf224976513cc1",
"gomaxprocs": "1"
},
{
"service": "db",
"instance": "edfcf3091ee4",
"state": "running",
"exit_code": 0,
"health": "healthy",
"cpu": 1000000000,
"memory": 536870912,
"ports": {},
"networks": {
"highload-lab3_data": {
"address": "172.25.0.3"
}
},
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
"started": "2026-10-10T16:14:14.990276912Z",
"container_id": "edfcf3091ee410c68a4d6845fee0aaed1477744abba90d7b6de8dffbfe51f05c"
},
{
"service": "frontend",
"instance": "ceb091ff4cee",
"state": "running",
"exit_code": 0,
"health": "healthy",
... [пропущенные строки — в полном журнале] ...
"path": "/health/ready",
"status": 200,
"instance": "4864ca4d784f"
}
],
"migration_version_dirty": "3|f",
"git_ignored": [
".env",
".memory/"
],
"hook_scope": {
"restart.sh": {
"sha256": "0bdb05ec336f4e175ab2a76f172fcab06512003f70962adcd3e4c64567da1c43"
},
"stop-one.sh": {
"sha256": "6eda7ff0eaaf521a2510e3b4ea2675ec7cd44851aeedf7300ca099ade9fa46f8"
}
}
}
PASS: actual containers and HAProxy addresses agree; migration 3 clean; storage/API private; secrets ignored
```
Полный сохранённый вывод: [evidence/criteria/runs/lab3-report-04/inventory.txt](runs/lab3-report-04/inventory.txt).
## Реализация и дополнительные доказательства
- [compose.yml](../../compose.yml)
- [scripts/check_resources.py](../../scripts/check_resources.py)
- [scripts/init_env.py](../../scripts/init_env.py)
- [.gitignore](../../.gitignore)
- [evidence/criteria/runs/lab3-report-04/manifest.json](runs/lab3-report-04/manifest.json)