I have a flask app which was working perfectly in Azure App Services as a single container app. My team wanted to include 2 x celery containers in the application and initially configured the 2 celery containers as container instances in the same vNet – which did work – but I want to convert it from single to multi container web app.
I ran az webapp config container set
and provided the --multicontainer-config-type COMPOSE
and the --multicontainer-config-file *path*
options and now the website displays the “:( Application Error” message.
My compose file, for reference, looks like this:
version: '3.8'
services:
flask-app:
image: myregistry.azurecr.io/flask-app:latest
container_name: flask-app
platform: linux/amd64
command: bash -c "gunicorn -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker --timeout 1000 -b 0.0.0.0:8000 app:app"
ports:
- 8000:8000
restart: always
celery-worker:
image: myregistry.azurecr.io/celery-worker:latest
container_name: celery-worker
platform: linux/amd64
command: celery -A tasks worker --loglevel=info
depends_on:
- flask-app
celery-beat:
image: myregistry.azurecr.io/celery-beat:latest
container_name: celery-beat
platform: linux/amd64
command: celery -A tasks beat -S redbeat.RedBeatScheduler -l INFO
depends_on:
- flask-app
My Github actions workflow successfully builds, tags and pushes my container images to ACR in the build stage, I then see the correct image tags (i.e. github.sha), in the deploy stage logs. The I can also see the correct image tags in the is working up to the point where I see these entries in the log…
##[debug][GET] https://{server_name}.scm.azurewebsites.net:443/diagnostics/runtime
##[debug]Could not parse response body.
##[debug]{}
##[debug]Encountered a retriable status code: 503. Message: 'Service Unavailable'.
It retries a few times and then finally I get
##[debug]Failed to fetch Kudu App Runtime diagnostics.
##[debug]Service Unavailable (CODE: 503)
Error: Deployment Failed, Error: Failed to get app runtime OS
{}
I read in the link below that ports other than 80 and 8080 are ignored for multi container apps.
https://learn.microsoft.com/en-us/azure/app-service/configure-custom-container?tabs=debian&pivots=container-linux#docker-compose-options
So I tried changing my WEBSITES_PORT env var from 8000 to 8080 and then changing my compose port mapping to 8080:8000. I even tried changing all references to 8000 to 8080 (including the startup command -b 0.0.0.0:8080
). I must have tried every permutation I could conceivably think of but all give me the same result.
Can anyone point me in the right direction?