From aee3f0ec7086512a84459de08966a405da8720b7 Mon Sep 17 00:00:00 2001 From: Matias Diaz <147676997+equinox-1092@users.noreply.github.com> Date: Sat, 22 Nov 2025 12:17:57 -0500 Subject: [PATCH 1/2] Add or update the Azure App Service build and deployment workflow config --- .../release-v1.0.0_edugraph-back-end.yml | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/release-v1.0.0_edugraph-back-end.yml diff --git a/.github/workflows/release-v1.0.0_edugraph-back-end.yml b/.github/workflows/release-v1.0.0_edugraph-back-end.yml new file mode 100644 index 0000000..bdc9ac1 --- /dev/null +++ b/.github/workflows/release-v1.0.0_edugraph-back-end.yml @@ -0,0 +1,76 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions +# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions + +name: Build and deploy Python app to Azure Web App - edugraph-back-end + +on: + push: + branches: + - release/v1.0.0 + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read #This is required for actions/checkout + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python version + uses: actions/setup-python@v5 + with: + python-version: '3.13' + + # 🛠️ Local Build Section (Optional) + # The following section in your workflow is designed to catch build issues early on the client side, before deployment. This can be helpful for debugging and validation. However, if this step significantly increases deployment time and early detection is not critical for your workflow, you may remove this section to streamline the deployment process. + - name: Create and Start virtual environment and Install dependencies + run: | + python -m venv antenv + source antenv/bin/activate + pip install -r requirements.txt + + # By default, when you enable GitHub CI/CD integration through the Azure portal, the platform automatically sets the SCM_DO_BUILD_DURING_DEPLOYMENT application setting to true. This triggers the use of Oryx, a build engine that handles application compilation and dependency installation (e.g., pip install) directly on the platform during deployment. Hence, we exclude the antenv virtual environment directory from the deployment artifact to reduce the payload size. + - name: Upload artifact for deployment jobs + uses: actions/upload-artifact@v4 + with: + name: python-app + path: | + . + !antenv/ + + # 🚫 Opting Out of Oryx Build + # If you prefer to disable the Oryx build process during deployment, follow these steps: + # 1. Remove the SCM_DO_BUILD_DURING_DEPLOYMENT app setting from your Azure App Service Environment variables. + # 2. Refer to sample workflows for alternative deployment strategies: https://github.com/Azure/actions-workflow-samples/tree/master/AppService + + + deploy: + runs-on: ubuntu-latest + needs: build + permissions: + id-token: write #This is required for requesting the JWT + contents: read #This is required for actions/checkout + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v4 + with: + name: python-app + + - name: Login to Azure + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_7E75525641A24520829051302654D29F }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_AD87DB1647414A3CBB09B7A8F44BD752 }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_2E093BDE9AAB4F32AB13C95E0B6DC2DE }} + + - name: 'Deploy to Azure Web App' + uses: azure/webapps-deploy@v3 + id: deploy-to-webapp + with: + app-name: 'edugraph-back-end' + slot-name: 'Production' + \ No newline at end of file From 56a24e5d251aefa20172870996d38532854cc1d4 Mon Sep 17 00:00:00 2001 From: equinox-1092 Date: Sat, 22 Nov 2025 12:35:26 -0500 Subject: [PATCH 2/2] fix: resolve azure app service import error by adding root main.py --- main.py | 5 +++++ requirements.txt | Bin 1170 -> 1236 bytes 2 files changed, 5 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..7ea6222 --- /dev/null +++ b/main.py @@ -0,0 +1,5 @@ +from app.main import app + +if __name__ == "__main__": + import uvicorn + uvicorn.run(app, host="0.0.0.0", port=8000) diff --git a/requirements.txt b/requirements.txt index 13434507cb14b7771925b779a8921519913b9fcb..2d2a126e7d58dcf9e3c50f38a9dd548e633c3a52 100644 GIT binary patch delta 96 zcmbQld4*Hu|Gz|rOon`hT!u=9VunJ790pq;G+@wUFa}~H23`g(hK)?;7#WQ=Uu1M- mlnwx@^9AByhCl`%uv$Z)IuJIR%**_i-Gspsq<1nS%R~Sjv=f;C delta 37 tcmcb@If;|$|G$X=A{#AsF)|u&{>