I’m attempting to create a Docker/Flask/Gunicorn app, but I can’t seem to get the PR service running (id: srv-c7ng1vjvog4uj72iscjg).
Here are the logs:
Jan 25 04:35:59 PM Pushing image to registry...
Jan 25 04:36:08 PM DONE
Jan 25 04:36:17 PM [2022-01-25 21:36:17 +0000] [8] [INFO] Starting gunicorn 20.0.4
Jan 25 04:36:17 PM [2022-01-25 21:36:17 +0000] [8] [INFO] Listening at: http://0.0.0.0:10000 (8)
Jan 25 04:36:17 PM [2022-01-25 21:36:17 +0000] [8] [INFO] Using worker: sync
Jan 25 04:36:17 PM [2022-01-25 21:36:17 +0000] [10] [INFO] Booting worker with pid: 10
Jan 25 04:36:24 PM [2022-01-25 21:36:24 +0000] [26] [INFO] Booting worker with pid: 26
Jan 25 04:36:32 PM [2022-01-25 21:36:32 +0000] [42] [INFO] Booting worker with pid: 42
Jan 25 04:36:39 PM [2022-01-25 21:36:39 +0000] [58] [INFO] Booting worker with pid: 58
Jan 25 04:36:47 PM [2022-01-25 21:36:47 +0000] [74] [INFO] Booting worker with pid: 74
Jan 25 04:36:54 PM [2022-01-25 21:36:54 +0000] [90] [INFO] Booting worker with pid: 90
Jan 25 04:37:02 PM [2022-01-25 21:37:02 +0000] [106] [INFO] Booting worker with pid: 106
...
It continues to boot workers indefinitely, but without any signs of crashing or other errors. Trying to visit this PR service url just spins and times out.
I’ve defined my PORT environment variable as 10000 as was the cause of this issue, which superficially looks similar.
I’ve also made sure my health check endpoint exists and should return a 200 response, which it does locally, as was the issue here, which also seemed superficially similar.
In my Dockerfile I define a few env variables:
ENV FLASK_APP=app.py
ENV FLASK_RUN_HOST=0.0.0.0
ENV FLASK_ENV=production
and further down my CMD:
CMD gunicorn app:app
And finally, in my app.py:
if __name__ == '__main__':
port = int(os.environ.get('PORT', 5000))
app.run(host='0.0.0.0', port=port)
Do you have any ideas why this might not be working? Any help is appreciated.