From e3e29fbbd6fa239cf29fa7ec032f4662cfa22aeb Mon Sep 17 00:00:00 2001 From: Trevor Blanarik Date: Mon, 11 Nov 2024 07:18:14 +0000 Subject: [PATCH] remove Azure Function cruft, add always-on functin --- .github/workflows/main_hamalertspotbot.yml | 73 ---------------------- app.py | 7 +++ host.json | 7 --- 3 files changed, 7 insertions(+), 80 deletions(-) delete mode 100644 .github/workflows/main_hamalertspotbot.yml delete mode 100644 host.json diff --git a/.github/workflows/main_hamalertspotbot.yml b/.github/workflows/main_hamalertspotbot.yml deleted file mode 100644 index 4e9d513..0000000 --- a/.github/workflows/main_hamalertspotbot.yml +++ /dev/null @@ -1,73 +0,0 @@ -# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action -# More GitHub Actions for Azure: https://github.com/Azure/actions -# More info on Python, GitHub Actions, and Azure Functions: https://aka.ms/python-webapps-actions - -name: Build and deploy Python project to Azure Function App - hamalertspotbot - -on: - workflow_dispatch: - -env: - AZURE_FUNCTIONAPP_PACKAGE_PATH: './' # set this to the path to your web app project, defaults to the repository root - PYTHON_VERSION: '3.11' # set this to the python version to use (supports 3.6, 3.7, 3.8) - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Python version - uses: actions/setup-python@v1 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Create and start virtual environment - run: | - python -m venv venv - source venv/bin/activate - - - name: Install dependencies - run: pip install -r requirements.txt - - - name: Run Python unit tests - run: python -u -m unittest test.py - - - name: Zip artifact for deployment - run: zip release.zip ./* -r - - - name: Upload artifact for deployment job - uses: actions/upload-artifact@v4 - with: - name: python-app - path: | - release.zip - !venv/ - - deploy: - runs-on: ubuntu-latest - needs: build - environment: - name: 'staging' - url: ${{ steps.deploy-to-function.outputs.webapp-url }} - - steps: - - name: Download artifact from build job - uses: actions/download-artifact@v4 - with: - name: python-app - - - name: Unzip artifact for deployment - run: unzip release.zip - - - name: 'Deploy to Azure Functions' - uses: Azure/functions-action@v1 - id: deploy-to-function - with: - app-name: 'hamalertspotbot' - slot-name: 'staging' - package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} - publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_STAGING }} - scm-do-build-during-deployment: true - enable-oryx-build: true diff --git a/app.py b/app.py index 9fe4b9b..94d3d37 100644 --- a/app.py +++ b/app.py @@ -15,5 +15,12 @@ def run(): else: return make_response("Accepted", 202) +''' +Empty endpoint used for keeping the container on and loaded +''' +@app.route('/', methods=["GET"]) +def always_on(): + return make_response("OK", 200) + if __name__ == "__main__": app.run() \ No newline at end of file diff --git a/host.json b/host.json deleted file mode 100644 index dccc50a..0000000 --- a/host.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": "2.0", - "extensionBundle": { - "id": "Microsoft.Azure.Functions.ExtensionBundle", - "version": "[4.*, 5.0.0)" - } - } \ No newline at end of file