From 268b268044afbcace9955afbfec3dc0ff0914a08 Mon Sep 17 00:00:00 2001 From: Sterling Dreyer Date: Tue, 10 Jun 2025 12:05:00 -0700 Subject: [PATCH] Build staging from source (#421) --- .github/workflows/porter_app_worker_4828.yml | 20 +++++++++-- docker/Dockerfile | 2 +- porter/prod.yaml | 37 ++++++++++++++++++++ porter/staging.yaml | 37 ++++++++++++++++++++ 4 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 porter/prod.yaml create mode 100644 porter/staging.yaml diff --git a/.github/workflows/porter_app_worker_4828.yml b/.github/workflows/porter_app_worker_4828.yml index b79f2978..cd69515c 100644 --- a/.github/workflows/porter_app_worker_4828.yml +++ b/.github/workflows/porter_app_worker_4828.yml @@ -2,21 +2,37 @@ push: branches: - main -name: Deploy to worker + +name: Deploy to staging jobs: porter-deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 + - name: Set Github tag id: vars run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + - name: Setup porter uses: porter-dev/setup-porter@v0.1.0 + + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + version: 1.8.5 + + - name: Build Dist + run: make full-dist + + - name: Export Requirements + run: | + cd arcade && poetry export --output ../dist/requirements.txt + - name: Deploy stack timeout-minutes: 30 - run: exec porter apply + run: exec porter apply -f porter/staging.yaml env: PORTER_APP_NAME: worker PORTER_CLUSTER: "4828" diff --git a/docker/Dockerfile b/docker/Dockerfile index c8e9614f..c17757ba 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,7 +3,7 @@ FROM python:3.11-slim # Define build arguments with default values ARG PORT=8001 ARG HOST=0.0.0.0 -ARG VERSION=${VERSION:-1.0.1} +ARG VERSION=${VERSION:-0.1.0.dev0} ARG INSTALL_TOOLKITS=true # Set environment variables using the build arguments diff --git a/porter/prod.yaml b/porter/prod.yaml new file mode 100644 index 00000000..001e3d3c --- /dev/null +++ b/porter/prod.yaml @@ -0,0 +1,37 @@ +version: v2 +name: worker +services: +- name: worker + type: web + instances: 1 + cpuCores: 0.5 + ramMegabytes: 1024 + terminationGracePeriodSeconds: 30 + port: 8002 + autoscaling: + enabled: true + minInstances: 3 + maxInstances: 15 + gpu: false + cpuThresholdPercent: 50 + memoryThresholdPercent: 50 + gpuThresholdPercent: 100 + vramThresholdPercent: 100 + healthCheck: + enabled: true + httpPath: /worker/health + timeoutSeconds: 1 + initialDelaySeconds: 15 + private: true + sleep: false + serviceMeshEnabled: false +build: + context: ./ + method: docker + dockerfile: ./docker/Dockerfile +envGroups: +- otel-configs +- worker +autoRollback: + enabled: true +deploymentStrategy: {} diff --git a/porter/staging.yaml b/porter/staging.yaml new file mode 100644 index 00000000..4ed91ba2 --- /dev/null +++ b/porter/staging.yaml @@ -0,0 +1,37 @@ +version: v2 +name: worker +services: +- name: worker + type: web + instances: 1 + cpuCores: 0.5 + ramMegabytes: 1024 + terminationGracePeriodSeconds: 30 + port: 8002 + autoscaling: + enabled: true + minInstances: 1 + maxInstances: 5 + gpu: false + cpuThresholdPercent: 50 + memoryThresholdPercent: 50 + gpuThresholdPercent: 100 + vramThresholdPercent: 100 + healthCheck: + enabled: true + httpPath: /worker/health + timeoutSeconds: 1 + initialDelaySeconds: 15 + private: true + sleep: false + serviceMeshEnabled: false +build: + context: ./ + method: docker + dockerfile: ./docker/Dockerfile +envGroups: +- otel-configs +- worker +autoRollback: + enabled: true +deploymentStrategy: {}