LOT 1 - Optimizare script build -Instalare mono comanda
This commit is contained in:
parent
5380c3fc63
commit
42ff22bf85
127 changed files with 16163 additions and 532 deletions
|
|
@ -5,9 +5,12 @@ Toate endpoint-urile, parametrii, status codes, exemple curl.
|
|||
## Base URL
|
||||
|
||||
```
|
||||
http://localhost:8080
|
||||
http://localhost:8085
|
||||
```
|
||||
|
||||
> `8085` este portul publicat pe host. În interiorul containerului serviciul
|
||||
> ascultă pe `8080` (vezi `docker-compose.yml`: `127.0.0.1:${API_PORT:-8085}:8080`).
|
||||
|
||||
## Endpoints
|
||||
|
||||
### `POST /api/forensic-evidence`
|
||||
|
|
@ -113,13 +116,13 @@ Apoi polling pe `/api/status/{job_id}` și preluare cu `/api/result/{job_id}`.
|
|||
|
||||
**Sync, toate modulele**:
|
||||
```bash
|
||||
curl -X POST http://localhost:8080/api/forensic-evidence \
|
||||
curl -X POST http://localhost:8085/api/forensic-evidence \
|
||||
-F "video=@suspicious_video.mp4"
|
||||
```
|
||||
|
||||
**Sync, doar 2 module + fără base64 (mai rapid)**:
|
||||
```bash
|
||||
curl -X POST http://localhost:8080/api/forensic-evidence \
|
||||
curl -X POST http://localhost:8085/api/forensic-evidence \
|
||||
-F "video=@image.jpg" \
|
||||
-F "modules=m27,m28" \
|
||||
-F "encode_images=0"
|
||||
|
|
@ -128,18 +131,18 @@ curl -X POST http://localhost:8080/api/forensic-evidence \
|
|||
**Async, polling**:
|
||||
```bash
|
||||
# Submit
|
||||
JOB=$(curl -s -X POST http://localhost:8080/api/forensic-evidence \
|
||||
JOB=$(curl -s -X POST http://localhost:8085/api/forensic-evidence \
|
||||
-F "video=@long_video.mp4" -F "async_mode=1" \
|
||||
| python -c "import sys,json; print(json.load(sys.stdin)['job_id'])")
|
||||
|
||||
# Wait
|
||||
while [ "$(curl -s http://localhost:8080/api/status/$JOB \
|
||||
while [ "$(curl -s http://localhost:8085/api/status/$JOB \
|
||||
| python -c "import sys,json; print(json.load(sys.stdin)['status'])")" != "done" ]; do
|
||||
sleep 5
|
||||
done
|
||||
|
||||
# Get result
|
||||
curl http://localhost:8080/api/result/$JOB | jq .summary
|
||||
curl http://localhost:8085/api/result/$JOB | jq .summary
|
||||
```
|
||||
|
||||
---
|
||||
|
|
@ -149,7 +152,7 @@ curl http://localhost:8080/api/result/$JOB | jq .summary
|
|||
Listează modulele disponibile, pentru introspection.
|
||||
|
||||
```bash
|
||||
curl http://localhost:8080/api/forensic-modules
|
||||
curl http://localhost:8085/api/forensic-modules
|
||||
```
|
||||
|
||||
```json
|
||||
|
|
@ -177,7 +180,7 @@ curl http://localhost:8080/api/forensic-modules
|
|||
Polling pentru cereri async. Returns 200 cu status string.
|
||||
|
||||
```bash
|
||||
curl http://localhost:8080/api/status/abc123def456789a
|
||||
curl http://localhost:8085/api/status/abc123def456789a
|
||||
```
|
||||
|
||||
```json
|
||||
|
|
@ -205,7 +208,7 @@ Preluare rezultat job async. Comportament:
|
|||
| `error` | 500 cu mesajul de eroare |
|
||||
|
||||
```bash
|
||||
curl http://localhost:8080/api/result/abc123def456789a
|
||||
curl http://localhost:8085/api/result/abc123def456789a
|
||||
```
|
||||
|
||||
Error code 404 dacă job_id nu există.
|
||||
|
|
@ -217,7 +220,7 @@ Error code 404 dacă job_id nu există.
|
|||
Healthcheck pentru Docker / load balancer / monitoring.
|
||||
|
||||
```bash
|
||||
curl http://localhost:8080/health
|
||||
curl http://localhost:8085/health
|
||||
```
|
||||
|
||||
```json
|
||||
|
|
@ -228,6 +231,20 @@ curl http://localhost:8080/health
|
|||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### `GET /metrics`
|
||||
|
||||
Expune metrici Prometheus (contor + histogramă durată per rută) pentru
|
||||
monitoring. Format text Prometheus.
|
||||
|
||||
```bash
|
||||
curl http://localhost:8085/metrics
|
||||
```
|
||||
|
||||
Returnează `503` cu `prometheus_client not installed` dacă dependența opțională
|
||||
`prometheus_client` nu e instalată.
|
||||
|
||||
## Notes
|
||||
|
||||
### Limita upload
|
||||
|
|
@ -241,7 +258,7 @@ Job store este **in-memory** (Python dict). Asta înseamnă:
|
|||
- Joburile se pierd la restart container
|
||||
- Multi-replica fără sticky sessions = nu funcționează
|
||||
|
||||
Pentru producție serioasă, înlocuiește `_jobs` din `api.py:30` cu un store
|
||||
Pentru producție serioasă, înlocuiește `_jobs` din `api.py:46` cu un store
|
||||
persistent (Redis recomandat).
|
||||
|
||||
### CORS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue