update the cv modal inference proxy server with optimization
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
# Install Docker image
|
||||
docker network create jenkins
|
||||
|
||||
# install docker-integratable image
|
||||
docker run --name jenkins-docker --rm --detach \
|
||||
-p 8080:8080 -p 50000:50000 \
|
||||
--restart=on-failure \
|
||||
--privileged --network jenkins --network-alias docker \
|
||||
--env DOCKER_TLS_CERTDIR=/certs \
|
||||
--volume jenkins-docker-certs:/certs/client \
|
||||
--volume jenkins-data:/var/jenkins_home \
|
||||
--publish 2376:2376 \
|
||||
docker:dind --storage-driver overlay2 \
|
||||
-v jenkins_home:/var/jenkins_home jenkins/jenkins:lts
|
||||
|
||||
# install the docker images
|
||||
docker run \
|
||||
--name jenkins-blueocean \
|
||||
--restart=on-failure \
|
||||
--detach \
|
||||
--network jenkins \
|
||||
--env DOCKER_HOST=tcp://docker:2376 \
|
||||
--env DOCKER_CERT_PATH=/certs/client \
|
||||
--env DOCKER_TLS_VERIFY=1 \
|
||||
--publish 8080:8080 \
|
||||
--publish 50000:50000 \
|
||||
--volume jenkins-data:/var/jenkins_home \
|
||||
--volume jenkins-docker-certs:/certs/client:ro \
|
||||
jenkins/jenkins:lts
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
### 1. The Core Application Stack (Replacing the streaming engine)
|
||||
|
||||
* **Database:** **PostgreSQL** or **SQLite**
|
||||
* *Why:* Extremely lightweight, universally supported, and standard for medical/relational data (like patient exercises, joint ranges of motion, and logs).
|
||||
|
||||
|
||||
* **Backend:** **Node.js (Express)**, **Python (FastAPI)**, or **Go**
|
||||
* *Why:* Fast to build for a PoC, easily containerized via Docker, and highly efficient. FastAPI is excellent if you plan to incorporate any musculoskeletal data analysis or ML later.
|
||||
|
||||
|
||||
|
||||
### 2. CI/CD & Infrastructure Components
|
||||
|
||||
* **Codebase:** **Gitea**
|
||||
* *Why:* A lightweight, self-hosted Git platform that runs in a simple local Docker container using very little memory.
|
||||
|
||||
|
||||
* **CI/CD Orchestrator & Build Server:** **Woodpecker CI** or **GitHub Actions** (if you're okay using GitHub until migrating to a private cloud).
|
||||
* *Why:* Woodpecker is an open-source, container-first CI engine that runs locally with almost zero overhead.
|
||||
|
||||
|
||||
* **Artifact Repository:** **Gitea Packages** or **Docker Registry**
|
||||
* *Why:* You can store your built application images right inside Gitea or a tiny local Docker registry container.
|
||||
|
||||
|
||||
|
||||
### 3. Environments & Deployment
|
||||
|
||||
* **Deployment-Manager:** **Docker Compose** or **Portainer**
|
||||
* *Why:* To deploy your musculoskeletal app, you just need Docker Compose to orchestrate your backend and database containers. Portainer gives you a simple web GUI to manage them locally.
|
||||
|
||||
|
||||
* **Staging & Production Env:** Isolated local containers or separate virtual machines.
|
||||
|
||||
### 4. Feedback & Monitoring Loop
|
||||
|
||||
* **User Feedback Collector:** A custom-built form widget inside your app or an open-source tool like **Feedback Fish** / **Air Table**
|
||||
* **Feedback-Resolve:** **Focalboard** or **Leantime** (Self-hosted, lightweight project boards to track bugs and user feature requests).
|
||||
* **Monitoring & Logging:** **Prometheus + Grafana**
|
||||
* *Why:* Perfect for tracking application uptime, API response times, and server health.
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
|
||||
```planUML
|
||||
@startuml C4_Elements
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
|
||||
|
||||
|
||||
title Component Diagram for CI/CD Pipeline Architecture
|
||||
|
||||
Person(developer, "Developer(s)", "Writes code and pushes changes.")
|
||||
Person(enduser, "End-User(s)", "Interacts with the production application.")
|
||||
|
||||
Container_Boundary(pipeline_boundary, "CI/CD Pipeline System") {
|
||||
Component(codebase, "Codebase", "Git Repository", "Stores the source code and tracks version history.")
|
||||
Component(orchestrator, "CI/CD Orchestrator", "Workflow Engine", "Triggers actions based on repository events.")
|
||||
Component(build_server, "Build Server", "Compiler/Packager", "Compiles code and builds release packages.")
|
||||
Component(artifact_repo, "Artifact Repository", "Storage", "Stores compiled binaries or container images.")
|
||||
Component(test_pipeline, "Test-Pipeline", "Automation Suite", "Runs unit, integration, and security tests.")
|
||||
Component(deploy_manager, "Deployment-Manager", "CD Engine", "Orchestrates deployment to various environments.")
|
||||
Component(user_feedback, "User Feedback Collector", "In-App/Portal Widget", "Collects explicit feature requests and bug reports from users.")
|
||||
Component(feedback_resolve, "Feedback-Resolve", "Tracking System", "Manages issues, bugs, and deployment logs.")
|
||||
Component(monitoring, "Monitoring & Logging", "Observability", "Monitors application health and metrics.")
|
||||
|
||||
Container_Boundary(deploy_env, "Deployment Environments") {
|
||||
Component(staging_env, "Staging/QA Env", "Environment", "Pre-production environment for testing.")
|
||||
Component(prod_env, "Production Env", "Environment", "Live environment hosting the customer application.")
|
||||
}
|
||||
}
|
||||
|
||||
' Directional Flow Links
|
||||
Rel(developer, codebase, "1. Pushes code")
|
||||
Rel(codebase, orchestrator, "2. Triggers event webhook")
|
||||
Rel(orchestrator, build_server, "3. Triggers build job")
|
||||
Rel(build_server, artifact_repo, "4. Stores compiled artifact")
|
||||
Rel(orchestrator, test_pipeline, "5. Runs automated tests")
|
||||
Rel(orchestrator, deploy_manager, "6. Signals ready for deployment")
|
||||
|
||||
Rel(deploy_manager, artifact_repo, "7. Pulls latest artifact")
|
||||
Rel(deploy_manager, staging_env, "8. Deploys to")
|
||||
Rel(deploy_manager, prod_env, "9. Promotes approved changes to")
|
||||
|
||||
Rel(enduser, prod_env, "10. Interacts with application")
|
||||
Rel(enduser, user_feedback, "11. Submits requests & feedback")
|
||||
Rel(user_feedback, feedback_resolve, "12. Forwards user tickets")
|
||||
Rel(monitoring, prod_env, "13. Reads metrics and errors")
|
||||
Rel(monitoring, feedback_resolve, "14. Feeds performance/error logs")
|
||||
Rel(feedback_resolve, developer, "15. Alerts for loop closure")
|
||||
|
||||
@enduml
|
||||
```
|
||||
@@ -205,6 +205,9 @@ async def forward_list_models():
|
||||
min_containers=1, # for keeping warm and prevention,
|
||||
buffer_containers=2, # Number of additional idle containers to maintain under active load.
|
||||
scaledown_window=30, # Max time (in seconds) a container can remain idle while scaling down.
|
||||
volumes= {
|
||||
'/mnt/vkist-ml-model' : modal.CloudBucketMount(bucket_name="vkist-ml-model", secret=modal.Secret.from_name("aws-secrets"))
|
||||
},
|
||||
secrets=[modal.Secret.from_name("aws-secrets")]
|
||||
)
|
||||
@modal.asgi_app()
|
||||
@@ -213,7 +216,11 @@ def unified_triton_server():
|
||||
|
||||
# Spawns Triton in the background. It will automatically read
|
||||
# your "aws-secrets" environment keys to mount s3://vkist-ml-model/
|
||||
cmd = ["tritonserver", "--model-repository=s3://vkist-ml-model/"]
|
||||
# cmd = ["tritonserver", "--model-repository=s3://vkist-ml-model/"] # bad pattern causing latency
|
||||
cmd = ["tritonserver", "--model-repository=/mnt/vkist-ml-model/"]
|
||||
|
||||
# triton issue network connection -> AWS -> adding cold-off latency
|
||||
# idea mounting the model to Modal Volume
|
||||
subprocess.Popen(cmd)
|
||||
|
||||
print("📋 Triton background process delegated. Handing routing control over to FastAPI.")
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
cd ../PILOT_PROJECT/workspace/sprint_1_2/CODEBASE/infra/implementation/triton_run
|
||||
MODAL_PROFILE=dtj-tran modal deploy PILOT_PROJECT/workspace/sprint_1_2/codebase/infra/implementation/triton_run/modal_triton.py
|
||||
MODAL_PROFILE=dtj-tran modal deploy modal_triton.py
|
||||
Reference in New Issue
Block a user