Azure / functions-container-action

Enable GitHub developers to deploy to Azure Function Apps Containers using GitHub Actions
MIT License
26 stars 14 forks source link

503 Errors Once Deployed #57

Open cj-clifton opened 4 months ago

cj-clifton commented 4 months ago

I'm using the provided github workflow and Dockerfile, and the github action completes, but then my app returns a 503 error.

The action shows this warning:

Run Azure/functions-container-action@v1
  with:
    app-name: doc-ai-[2](https://github.com/rateitapp/doc-ai-2/actions/runs/9778635997/job/26996475680#step:9:2)-dev
    image: docai2.azurecr.io/doc-ai-2-dev:78719c49[3](https://github.com/rateitapp/doc-ai-2/actions/runs/9778635997/job/26996475680#step:9:3)8d9ffc7a2033fd41c45435003d7d7f8
  env:
    AZURE_FUNCTIONAPP_PACKAGE_PATH: .
    AZURE_FUNCTIONAPP_NAME: doc-ai-2-dev
    AZURE_CONTAINER_REGISTRY: docai2.azurecr.io
    PYTHON_VERSION: 3.9
    DOCKER_CONFIG: /home/runner/work/_temp/docker_login_1720013361725
Updating App Service Configuration settings. Data: ***"linuxFxVersion":"DOCKER|docai2.azurecr.io/doc-ai-2-dev:78719c[4](https://github.com/rateitapp/doc-ai-2/actions/runs/9778635997/job/26996475680#step:9:4)938d9ffc7a2033fd41c45435003d7d7f8"***
Updated App Service Configuration settings.
Restarting app service: doc-ai-2-dev
Deployment passed
Restarted app service: doc-ai-2-dev
Warning: Failed to sync function triggers in function app. Trigger listing may be out of date.
Warning: Error: Failed to update deployment history.
Site Unavailable (CODE: [5](https://github.com/rateitapp/doc-ai-2/actions/runs/9778635997/job/26996475680#step:9:5)03)
Azure Function App URL: http://doc-ai-2-dev.azurewebsites.net

And in the function app there are another couple of warnings: Storage is not configured properly, Function scaling will be limited. Click to learn more. We were not able to load some functions in the list due to errors. Refresh the page to try again. See details

Here's my Dockerfile:

FROM mcr.microsoft.com/azure-functions/python:4-python3.9

ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true

# Install Tesseract OCR and poppler-utils
RUN apt-get update && \
    apt-get install -y tesseract-ocr poppler-utils

COPY requirements.txt /
RUN pip install -r /requirements.txt

COPY . /home/site/wwwroot

And workflow:

  deploy:
    needs: build
    runs-on: ubuntu-latest
    environment:
      name: "Dev"
      url: ${{ steps.deploy-to-function.outputs.app-url }}

    steps:
      - name: Login via Azure CLI
        uses: azure/login@v1
        with:
          creds: ${{ secrets.AZURE_CREDENTIALS }}

      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2

      - name: Log in to Azure Container Registry
        uses: azure/docker-login@v1
        with:
          login-server: ${{ env.AZURE_CONTAINER_REGISTRY }}
          username: ${{ vars.ACR_USERNAME }}
          password: ${{ secrets.ACR_PASSWORD }}

      - name: Build and push Docker image
        uses: docker/build-push-action@v4
        with:
          context: .
          file: ./Dockerfile
          push: true
          tags: ${{ env.AZURE_CONTAINER_REGISTRY }}/${{ env.AZURE_FUNCTIONAPP_NAME }}:${{ github.sha }}

      - name: Deploy to Azure Functions
        uses: Azure/functions-container-action@v1
        with:
          app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
          image: ${{ env.AZURE_CONTAINER_REGISTRY }}/${{ env.AZURE_FUNCTIONAPP_NAME }}:${{ github.sha }}

      - name: Azure logout
        run: |
          az logout

Am I doing something wrong?

My connection strings haven't change since before I used Docker to deploy the app, so I don't think it's that.