diff --git a/docs/architecture/01a-local-architecture.dot b/docs/architecture/01a-local-architecture.dot new file mode 100644 index 0000000..208d88a --- /dev/null +++ b/docs/architecture/01a-local-architecture.dot @@ -0,0 +1,94 @@ +digraph local_architecture { + rankdir=TB + node [shape=box, style=rounded, fontname="Helvetica"] + edge [fontname="Helvetica", fontsize=10] + + labelloc="t" + label="MPR - Local Architecture (Celery + MinIO)" + fontsize=16 + fontname="Helvetica-Bold" + + graph [splines=ortho, nodesep=0.8, ranksep=0.8] + + // External + subgraph cluster_external { + label="External" + style=dashed + color=gray + + browser [label="Browser\nmpr.local.ar", shape=ellipse] + } + + // Nginx reverse proxy + subgraph cluster_proxy { + label="Reverse Proxy" + style=filled + fillcolor="#e8f4f8" + + nginx [label="nginx\nport 80"] + } + + // Application layer + subgraph cluster_apps { + label="Application Layer" + style=filled + fillcolor="#f0f8e8" + + django [label="Django Admin\n/admin\nport 8701"] + fastapi [label="FastAPI + GraphQL\n/api + /graphql\nport 8702"] + timeline [label="Timeline UI\n/\nport 5173"] + } + + // Worker layer + subgraph cluster_workers { + label="Worker Layer" + style=filled + fillcolor="#fff8e8" + + grpc_server [label="gRPC Server\nport 50051"] + celery [label="Celery Worker\nFFmpeg transcoding"] + } + + // Data layer + subgraph cluster_data { + label="Data Layer" + style=filled + fillcolor="#f8e8f0" + + postgres [label="PostgreSQL\nport 5436", shape=cylinder] + redis [label="Redis\nCelery queue\nport 6381", shape=cylinder] + } + + // Storage + subgraph cluster_storage { + label="S3 Storage (MinIO)" + style=filled + fillcolor="#f0f0f0" + + minio [label="MinIO\nS3-compatible API\nport 9000", shape=folder] + bucket_in [label="mpr-media-in/\ninput videos", shape=note] + bucket_out [label="mpr-media-out/\ntranscoded output", shape=note] + } + + // Connections + browser -> nginx [label="HTTP"] + + nginx -> django [xlabel="/admin"] + nginx -> fastapi [xlabel="/api, /graphql"] + nginx -> timeline [xlabel="/"] + nginx -> minio [xlabel="/media/*"] + + timeline -> fastapi [label="REST API\nGraphQL"] + django -> postgres + + fastapi -> postgres [label="read/write jobs"] + fastapi -> grpc_server [label="gRPC\nprogress updates"] + + grpc_server -> celery [label="dispatch tasks"] + celery -> redis [label="task queue"] + celery -> postgres [label="update job status"] + celery -> minio [label="S3 API\ndownload input\nupload output"] + + minio -> bucket_in [style=dotted, arrowhead=none] + minio -> bucket_out [style=dotted, arrowhead=none] +} diff --git a/docs/architecture/01a-local-architecture.svg b/docs/architecture/01a-local-architecture.svg new file mode 100644 index 0000000..0c045c2 --- /dev/null +++ b/docs/architecture/01a-local-architecture.svg @@ -0,0 +1,243 @@ + + + + + + +local_architecture + +MPR - Local Architecture (Celery + MinIO) + +cluster_external + +External + + +cluster_proxy + +Reverse Proxy + + +cluster_apps + +Application Layer + + +cluster_workers + +Worker Layer + + +cluster_data + +Data Layer + + +cluster_storage + +S3 Storage (MinIO) + + + +browser + +Browser +mpr.local.ar + + + +nginx + +nginx +port 80 + + + +browser->nginx + + +HTTP + + + +django + +Django Admin +/admin +port 8701 + + + +nginx->django + + +/admin + + + +fastapi + +FastAPI + GraphQL +/api + /graphql +port 8702 + + + +nginx->fastapi + + +/api, /graphql + + + +timeline + +Timeline UI +/ +port 5173 + + + +nginx->timeline + + +/ + + + +minio + +MinIO +S3-compatible API +port 9000 + + + +nginx->minio + + +/media/* + + + +postgres + + +PostgreSQL +port 5436 + + + +django->postgres + + + + + +grpc_server + +gRPC Server +port 50051 + + + +fastapi->grpc_server + + +gRPC +progress updates + + + +fastapi->postgres + + +read/write jobs + + + +timeline->fastapi + + +REST API +GraphQL + + + +celery + +Celery Worker +FFmpeg transcoding + + + +grpc_server->celery + + +dispatch tasks + + + +celery->postgres + + +update job status + + + +redis + + +Redis +Celery queue +port 6381 + + + +celery->redis + + +task queue + + + +celery->minio + + +S3 API +download input +upload output + + + +bucket_in + + + +mpr-media-in/ +input videos + + + +minio->bucket_in + + + + +bucket_out + + + +mpr-media-out/ +transcoded output + + + +minio->bucket_out + + + + diff --git a/docs/architecture/01b-aws-architecture.dot b/docs/architecture/01b-aws-architecture.dot new file mode 100644 index 0000000..a3dc459 --- /dev/null +++ b/docs/architecture/01b-aws-architecture.dot @@ -0,0 +1,85 @@ +digraph aws_architecture { + rankdir=TB + node [shape=box, style=rounded, fontname="Helvetica"] + edge [fontname="Helvetica", fontsize=10] + + labelloc="t" + label="MPR - AWS Architecture (Lambda + Step Functions)" + fontsize=16 + fontname="Helvetica-Bold" + + graph [splines=ortho, nodesep=0.8, ranksep=0.8] + + // External + subgraph cluster_external { + label="External" + style=dashed + color=gray + + browser [label="Browser\nmpr.mcrn.ar", shape=ellipse] + } + + // Nginx reverse proxy + subgraph cluster_proxy { + label="Reverse Proxy" + style=filled + fillcolor="#e8f4f8" + + nginx [label="nginx\nport 80"] + } + + // Application layer + subgraph cluster_apps { + label="Application Layer" + style=filled + fillcolor="#f0f8e8" + + django [label="Django Admin\n/admin\nport 8701"] + fastapi [label="FastAPI + GraphQL\n/api + /graphql\nport 8702"] + timeline [label="Timeline UI\n/\nport 5173"] + } + + // Data layer (still local) + subgraph cluster_data { + label="Data Layer" + style=filled + fillcolor="#f8e8f0" + + postgres [label="PostgreSQL\nport 5436", shape=cylinder] + } + + // AWS layer + subgraph cluster_aws { + label="AWS Cloud" + style=filled + fillcolor="#fde8d0" + + step_functions [label="Step Functions\nOrchestration\nstate machine"] + lambda [label="Lambda Function\nFFmpeg container\ntranscoding"] + s3 [label="S3 Buckets", shape=folder] + bucket_in [label="mpr-media-in/\ninput videos", shape=note] + bucket_out [label="mpr-media-out/\ntranscoded output", shape=note] + } + + // Connections + browser -> nginx [label="HTTP"] + + nginx -> django [xlabel="/admin"] + nginx -> fastapi [xlabel="/api, /graphql"] + nginx -> timeline [xlabel="/"] + + timeline -> fastapi [label="REST API\nGraphQL"] + django -> postgres + + fastapi -> postgres [label="read/write jobs"] + fastapi -> step_functions [label="boto3\nstart_execution()\nexecution_arn"] + + step_functions -> lambda [label="invoke with\njob parameters"] + lambda -> s3 [label="download input\nupload output"] + lambda -> fastapi [label="POST /jobs/{id}/callback\nupdate status"] + + fastapi -> postgres [label="callback updates\njob status"] + + s3 -> bucket_in [style=dotted, arrowhead=none] + s3 -> bucket_out [style=dotted, arrowhead=none] +} diff --git a/docs/architecture/01b-aws-architecture.svg b/docs/architecture/01b-aws-architecture.svg new file mode 100644 index 0000000..b6f684d --- /dev/null +++ b/docs/architecture/01b-aws-architecture.svg @@ -0,0 +1,225 @@ + + + + + + +aws_architecture + +MPR - AWS Architecture (Lambda + Step Functions) + +cluster_external + +External + + +cluster_proxy + +Reverse Proxy + + +cluster_apps + +Application Layer + + +cluster_data + +Data Layer + + +cluster_aws + +AWS Cloud + + + +browser + +Browser +mpr.mcrn.ar + + + +nginx + +nginx +port 80 + + + +browser->nginx + + +HTTP + + + +django + +Django Admin +/admin +port 8701 + + + +nginx->django + + +/admin + + + +fastapi + +FastAPI + GraphQL +/api + /graphql +port 8702 + + + +nginx->fastapi + + +/api, /graphql + + + +timeline + +Timeline UI +/ +port 5173 + + + +nginx->timeline + + +/ + + + +postgres + + +PostgreSQL +port 5436 + + + +django->postgres + + + + + +fastapi->postgres + + +read/write jobs + + + +fastapi->postgres + + +callback updates +job status + + + +step_functions + +Step Functions +Orchestration +state machine + + + +fastapi->step_functions + + +boto3 +start_execution() +execution_arn + + + +timeline->fastapi + + +REST API +GraphQL + + + +lambda + +Lambda Function +FFmpeg container +transcoding + + + +step_functions->lambda + + +invoke with +job parameters + + + +lambda->fastapi + + +POST /jobs/{id}/callback +update status + + + +s3 + +S3 Buckets + + + +lambda->s3 + + +download input +upload output + + + +bucket_in + + + +mpr-media-in/ +input videos + + + +s3->bucket_in + + + + +bucket_out + + + +mpr-media-out/ +transcoded output + + + +s3->bucket_out + + + + diff --git a/docs/architecture/index.html b/docs/architecture/index.html index e9d2dc5..d2e90bb 100644 --- a/docs/architecture/index.html +++ b/docs/architecture/index.html @@ -21,13 +21,32 @@

System Overview

+ +

Local Architecture (Development)

-

Architecture

- - System Overview + + Local Architecture - Open full size + + + +

AWS Architecture (Production)

+
+
+ + AWS Architecture + + Open full size