From 9a86921dd1b1fbc35bfe092f143863339b6ec6c8 Mon Sep 17 00:00:00 2001 From: Christopher Gondek Date: Wed, 15 Oct 2025 10:33:20 +0200 Subject: [PATCH] chore: prepare deployment --- .../workflows/main_poweron-preprocessing.yml | 70 +++++++++++++++++++ env_prod.env | 8 +++ requirements.txt | 42 +++++++++++ startup.txt | 1 + 4 files changed, 121 insertions(+) create mode 100644 .github/workflows/main_poweron-preprocessing.yml create mode 100644 env_prod.env create mode 100644 requirements.txt create mode 100644 startup.txt diff --git a/.github/workflows/main_poweron-preprocessing.yml b/.github/workflows/main_poweron-preprocessing.yml new file mode 100644 index 0000000..2f75117 --- /dev/null +++ b/.github/workflows/main_poweron-preprocessing.yml @@ -0,0 +1,70 @@ +name: Build and deploy Python app to Azure Web App - poweron-preprocessing + +on: + push: + branches: [main] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@v4 + + # ---------- BACKEND / PYTHON ---------- + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install uv + uses: astral-sh/setup-uv@v6 + + # ---------- ARTIFACT ---------- + - name: Upload artifact for deployment jobs + uses: actions/upload-artifact@v4 + with: + name: python-app + path: | + . + !venv/ + !.venv/ + !.git/ + !.cache/ + + deploy: + runs-on: ubuntu-latest + needs: build + permissions: + id-token: write # <-- required for OIDC + contents: read + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v4 + with: + name: python-app + + - name: Login to Azure (OIDC) + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_AA4B9998A69E4C5C8FDF357E3FEAADD5 }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_CC57AD1F29D44DDA960AE3EAC6D2C27A }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_4CD1D97C506D403E8E284466DB4E7898 }} + + # Runtime env files (required in your setup) + - name: Set productive environment (runtime) + run: | + set -euo pipefail + cp env_prod.env .env + + - name: Deploy to Azure Web App + uses: azure/webapps-deploy@v3 + with: + app-name: "poweron-preprocessing" + slot-name: "Production" + package: . # reuse the downloaded artifact folder + # no publish-profile here; it will use the az login from azure/login diff --git a/env_prod.env b/env_prod.env new file mode 100644 index 0000000..658a4d4 --- /dev/null +++ b/env_prod.env @@ -0,0 +1,8 @@ +PP_CONFIG_PATH="/Users/christopher/Documents/Repos/vo-customer-preprocessor/src/pp-config.yaml" +PP_API_KEY="kj823u90209mj020394jp2msakhfkjashjkf" +DB_ENDPOINT_API_KEY="ouho02j0rj2oijroi3rj2oijro23jr0990" +DB_URL="/Users/christopher/Documents/Repos/vo-customer-preprocessor/data/data_althaus.db" +POWERBI_DATASET_ID="0e72b1f1-3d32-4caa-bc1a-e523b6232343" +POWERBI_CLIENT_ID="9f6fa2cf-3fe1-4ed5-a430-bb7e408c0d87" +POWERBI_CLIENT_SECRET="Vdy8Q~Bm2_5ooy-pgYtEgvA9-LjRN2HiXFw6Ody0" +POWERBI_TENANT_ID="6a51aaeb-2467-4186-9504-2a05aedc591f" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..3657656 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,42 @@ +aiosqlite==0.21.0 +annotated-types==0.7.0 +anyio==4.11.0 +certifi==2025.8.3 +cffi==2.0.0 +charset-normalizer==3.4.3 +click==8.3.0 +cryptography==46.0.1 +fastapi==0.117.1 +greenlet==3.2.4 +h11==0.16.0 +httpcore==1.0.9 +httpx==0.28.1 +idna==3.10 +iniconfig==2.1.0 +msal==1.34.0 +numpy==2.3.3 +packaging==25.0 +pandas==2.3.2 +pluggy==1.6.0 +pycparser==2.23 +pydantic==2.11.9 +pydantic-core==2.33.2 +pydantic-settings==2.10.1 +pygments==2.19.2 +pyjwt==2.10.1 +pytest==8.4.2 +pytest-asyncio==1.2.0 +python-dateutil==2.9.0.post0 +python-dotenv==1.1.1 +pytz==2025.2 +pyyaml==6.0.2 +requests==2.32.5 +six==1.17.0 +sniffio==1.3.1 +sqlalchemy==2.0.43 +starlette==0.48.0 +typing-extensions==4.15.0 +typing-inspection==0.4.1 +tzdata==2025.2 +urllib3==2.5.0 +uvicorn==0.37.0 diff --git a/startup.txt b/startup.txt new file mode 100644 index 0000000..0d38a09 --- /dev/null +++ b/startup.txt @@ -0,0 +1 @@ +uvicorn app:app --host 0.0.0.0 --port 8000 \ No newline at end of file