Search code examples
azure-web-app-servicequarthypercorn

Facing Container startup issue, when deploying Quart App in Azure APP service


I'm trying to deploy a Quart application to Azure App Service using a Docker container, but I'm running into an issue where the Docker container fails to start on port 8000 and disconnects.

from quart import Quart

app = Quart(__name__)

@app.route('/')
async def hello():
    return 'Hello, World!'

if __name__ == '__main__':
    app.run()

Startup command Used : hypercorn -b 0.0.0.0:8080 app:app

Other configurations

SCM_DO_BUILD_DURING_DEPLOYMENT=1

Deployment Type : Manual Deployment from VS Code

App service Plan : Basic - Linux

Error Faced: ERROR - Container for site has exited, failing site start ERROR - Container didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.

Expected Outcome:

Container needs to be started and need to also verify the startup command given was correct w.r.t to Quart


Solution

  • Based on the error message provided, the issue is related to the startup command.

    I tried configuring the startup command that you've used, but I got the same error. So, I changed the startup command to

    gunicorn -w 4 -k uvicorn.workers.UvicornWorker app:app
    

    I created a simple Quart application and successfully deployed it to Azure App Service without any issues.

    This is requirements.txt:

    quart
    hypercon
    gunicorn
    uvicorn
    

    app .py:

    import  os
    from  quart  import  Quart
    app  =  Quart(__name__ 
    @app.route('/')
    async  def  hello():
    return  'Hello, World!'
    if  __name__  ==  '__main__':
    port  =  int(os.environ.get("PORT", 8080))
    app.run(host='0.0.0.0', port=port)
    

    I deployed the app successfully via visual studio code extension.

    configure the below startup command to azure app service.

    enter image description here

    Here's the output after deployment:

    enter image description here