update workflows-4
Some checks failed
Backend EC - Modal Deployment / notify-deploy (push) Has been cancelled
Backend EC - Modal Deployment / build-and-push (push) Has been cancelled

This commit is contained in:
DatTT127
2026-07-18 22:02:43 +07:00
parent d904c775c7
commit 6e9cfebf84
4 changed files with 9 additions and 33 deletions

View File

@@ -88,14 +88,14 @@ jobs:
modal token set --token-id ${{ env.MODAL_TOKEN_ID }} \ modal token set --token-id ${{ env.MODAL_TOKEN_ID }} \
--token-secret ${{ env.MODAL_TOKEN_SECRET }} --token-secret ${{ env.MODAL_TOKEN_SECRET }}
modal run ${{ env.MODAL_SCRIPT }} \ modal run ${{ env.MODAL_SCRIPT }} \
--registry ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }} \ --registry ${{ env.ECR_REGISTRY }} \
--image-name "" \ --image-name ${{ env.ECR_REPOSITORY }} \
--tag ${{ steps.tag.outputs.tag }} \ --tag ${{ steps.tag.outputs.tag }} \
--platform linux/amd64 \ --platform linux/amd64 \
--push --push
notify-deploy: notify-deploy:
needs: modal-build needs: build-and-push
if: success() && github.event_name == 'push' if: success() && github.event_name == 'push'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

View File

@@ -42,7 +42,10 @@ logger = logging.getLogger(__name__)
async def lifespan(app: FastAPI): async def lifespan(app: FastAPI):
if not settings.triton_endpoint: if not settings.triton_endpoint:
raise RuntimeError("TRITON_ENDPOINT is not set. Set it via environment variable.") logger.warning("TRITON_ENDPOINT is not set. Triton-dependent features disabled.")
yield
return
logger.info("Starting CV inference service on Triton: %s", settings.triton_endpoint) logger.info("Starting CV inference service on Triton: %s", settings.triton_endpoint)
from backend.services.triton_warmup import warmup_triton_models from backend.services.triton_warmup import warmup_triton_models

View File

@@ -114,5 +114,5 @@ EXPOSE 8001
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8001/health')" || exit 1 CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8001/health')" || exit 1
# Run the CV inference server # # Run the CV inference server
ENTRYPOINT ["python", "-m", "backend.cv_inference_server"] ENTRYPOINT ["python", "-m", "backend.cv_inference_server"]

View File

@@ -77,8 +77,6 @@ app = modal.App(APP_NAME, image=backend_image)
memory=8192, # 8GB RAM - plenty for wheel building memory=8192, # 8GB RAM - plenty for wheel building
secrets=[ secrets=[
modal.Secret.from_name("aws-secrets"), # AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION modal.Secret.from_name("aws-secrets"), # AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION
# modal.Secret.from_name("dockerhub-credentials"), # DOCKERHUB_USERNAME, DOCKERHUB_TOKEN (optional)
# modal.Secret.from_name("gcp-artifact-registry"), # GCP credentials (optional)
], ],
) )
def build_and_push( def build_and_push(
@@ -189,19 +187,6 @@ def _authenticate_registry(registry: str, client):
], check=True, capture_output=True) ], check=True, capture_output=True)
# Note: Modal's aws-ecr-credentials secret should handle this via env vars # Note: Modal's aws-ecr-credentials secret should handle this via env vars
elif "docker.io" in registry or "index.docker.io" in registry or "/" not in registry.split("/")[0]:
# Docker Hub
username = os.getenv("DOCKERHUB_USERNAME")
password = os.getenv("DOCKERHUB_TOKEN")
if username and password:
print("Authenticating with Docker Hub...")
client.login(username=username, password=password)
elif "gcr.io" in registry or "pkg.dev" in registry:
# Google Container Registry / Artifact Registry
print("Authenticating with GCP Artifact Registry...")
subprocess.run(["gcloud", "auth", "configure-docker", "--quiet"], check=True)
@app.function( @app.function(
image=backend_image, image=backend_image,
@@ -218,14 +203,6 @@ def test_image(registry: str, image_name: str, tag: str) -> dict:
print(f"Pulling {full_image} for testing...") print(f"Pulling {full_image} for testing...")
client.images.pull(full_image) client.images.pull(full_image)
# print("Running health check...")
# output = client.containers.run(
# full_image,
# command=["python", "-c", "import backend.cv_inference_server; print('Import OK')"],
# remove=True,
# detach=False,
# )
print("Running basic smoke test...") print("Running basic smoke test...")
output = client.containers.run( output = client.containers.run(
full_image, full_image,
@@ -233,15 +210,11 @@ def test_image(registry: str, image_name: str, tag: str) -> dict:
"python", "-c", "python", "-c",
"import sys; print('Python', sys.version); " "import sys; print('Python', sys.version); "
"import cv2; print('OpenCV', cv2.__version__); " "import cv2; print('OpenCV', cv2.__version__); "
# "import backend.cv_inference_server; print('Import OK')",
], ],
remove=True, remove=True,
detach=False, detach=False,
) )
return { return {
"status": "healthy", "status": "healthy",
"output": output.decode().strip(), "output": output.decode().strip(),
@@ -274,7 +247,7 @@ def main(
test: Run health check after build (default: false) test: Run health check after build (default: false)
""" """
print("=" * 60) print("=" * 60)
print("VKIST Backend Docker Build on Modal") print("MSK-Lumina Backend Docker Build on Modal")
print("=" * 60) print("=" * 60)
print(f"Registry: {registry}") print(f"Registry: {registry}")
print(f"Image: {image_name}") print(f"Image: {image_name}")