[AZ-178] Implement streaming video detection endpoint

- Added `/detect/video` endpoint for true streaming video detection, allowing inference to start as upload bytes arrive.
- Introduced `run_detect_video_stream` method in the inference module to handle video processing from a file-like object.
- Updated media hashing to include a new function for computing hashes directly from files with minimal I/O.
- Enhanced documentation to reflect changes in video processing and API behavior.

Made-with: Cursor
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-04-01 03:11:43 +03:00
parent e65d8da6a3
commit be4cab4fcb
42 changed files with 2983 additions and 29 deletions
+65
View File
@@ -0,0 +1,65 @@
# Deployment Scripts
All scripts are in `scripts/` at the project root. Each script is POSIX-compatible (`bash` with `set -euo pipefail`), sources `.env` from the project root, and supports `--help`.
## Script Reference
| Script | Purpose | Key Env Vars |
|--------|---------|-------------|
| `deploy.sh` | Orchestrates full deployment | REGISTRY, IMAGE_TAG, DEPLOY_HOST, DEPLOY_USER |
| `pull-images.sh` | Pulls Docker images from registry | REGISTRY, IMAGE_TAG |
| `start-services.sh` | Starts the detections container | REGISTRY, IMAGE_TAG, LOADER_URL, ANNOTATIONS_URL |
| `stop-services.sh` | Gracefully stops and removes container | — |
| `health-check.sh` | Verifies `/health` endpoint | HEALTH_CHECK_HOST, HEALTH_CHECK_PORT |
## Usage
### Full Deployment
```bash
REGISTRY=registry.example.com IMAGE_TAG=a1b2c3d bash scripts/deploy.sh
```
### Remote Deployment (via SSH)
```bash
REGISTRY=registry.example.com \
IMAGE_TAG=a1b2c3d \
DEPLOY_HOST=production-server.example.com \
DEPLOY_USER=deploy \
bash scripts/deploy.sh
```
### Rollback
```bash
bash scripts/deploy.sh --rollback
```
Redeploys the previous image tag (saved in `.deploy-previous-tag` by `stop-services.sh`).
### Local Development
```bash
docker compose -f docker-compose.yml up
```
Or using the e2e compose for testing:
```bash
cd e2e && COMPOSE_PROFILES=cpu docker compose -f docker-compose.test.yml up --build
```
## Deployment Flow
```
deploy.sh
├── pull-images.sh → docker pull
├── stop-services.sh → docker stop (30s grace) + save previous tag
├── start-services.sh → docker run
└── health-check.sh → curl /health (10 retries, 3s interval)
```
## Environment Variables
All scripts source `.env` from the project root if it exists. Variables can also be passed directly via the environment. See `.env.example` for the full list.