plug task enqueing properly

This commit is contained in:
2026-02-06 10:49:05 -03:00
parent 2cf6c89fbb
commit 013587d108
20 changed files with 413 additions and 356 deletions

View File

@@ -76,43 +76,38 @@ docker compose exec django python manage.py createsuperuser
## Code Generation
Models are defined in `schema/models/` and generate:
- Django ORM models
- Pydantic schemas
- TypeScript types
- Protobuf definitions
Models are defined as dataclasses in `schema/models/` and generated via `modelgen`:
- **Django ORM** models (`--include dataclasses,enums`)
- **Pydantic** schemas (`--include dataclasses,enums`)
- **TypeScript** types (`--include dataclasses,enums,api`)
- **Protobuf** definitions (`--include grpc`)
Each target only gets the model groups it needs via the `--include` flag.
```bash
# Regenerate all
python schema/generate.py --all
# Or specific targets
python schema/generate.py --django
python schema/generate.py --pydantic
python schema/generate.py --typescript
python schema/generate.py --proto
# Regenerate all targets
bash ctrl/generate.sh
```
## Media Storage
MPR stores media file paths **relative to the media root** for cloud portability.
MPR separates media into **input** (`MEDIA_IN`) and **output** (`MEDIA_OUT`) paths, each independently configurable. File paths are stored relative for cloud portability.
### Local Development
- Files: `/app/media/video.mp4`
- Stored path: `video.mp4`
- Served via: `http://mpr.local.ar/media/video.mp4` (nginx alias)
- Source files: `/app/media/in/video.mp4`
- Output files: `/app/media/out/video_h264.mp4`
- Served via: `http://mpr.local.ar/media/in/video.mp4` (nginx alias)
### AWS/Cloud Deployment
For S3 or cloud storage, set `MEDIA_BASE_URL`:
Input and output can be different buckets/locations:
```bash
MEDIA_BASE_URL=https://bucket.s3.amazonaws.com/
MEDIA_IN=s3://source-bucket/media/
MEDIA_OUT=s3://output-bucket/transcoded/
```
- Files: S3 bucket
- Stored path: `video.mp4` (same relative path)
- Served via: `https://bucket.s3.amazonaws.com/video.mp4`
**Scan Endpoint**: `POST /api/assets/scan` recursively scans `MEDIA_IN` and registers new files with relative paths.
**Scan Endpoint**: `POST /api/assets/scan` recursively scans the media folder and registers new files with relative paths.
See [docs/media-storage.md](docs/media-storage.md) for full details.
## Project Structure
@@ -126,7 +121,9 @@ mpr/
├── ctrl/ # Docker & deployment
│ ├── docker-compose.yml
│ └── nginx.conf
├── media/ # Media files (local storage)
├── media/
│ ├── in/ # Source media files
│ └── out/ # Transcoded output
├── rpc/ # gRPC server & client
│ └── protos/ # Protobuf definitions (generated)
├── mpr/ # Django project
@@ -151,7 +148,8 @@ See `ctrl/.env.template` for all configuration options.
| `GRPC_HOST` | grpc | gRPC server hostname |
| `GRPC_PORT` | 50051 | gRPC server port |
| `MPR_EXECUTOR` | local | Executor type (local/lambda) |
| `MEDIA_ROOT` | /app/media | Media files directory |
| `MEDIA_IN` | /app/media/in | Source media files directory |
| `MEDIA_OUT` | /app/media/out | Transcoded output directory |
| `MEDIA_BASE_URL` | /media/ | Base URL for serving media (use S3 URL for cloud) |
| `VITE_ALLOWED_HOSTS` | - | Comma-separated allowed hosts for Vite dev server |