I have another question: Why do the builds take so long to deploy and then show that the deploy has failed?
from the logs I have shown below, the build seems to have completed properly and the service has been started, but it just gets stuck at in progress...
and then eventually fails.
...
Nov 23 02:27:56 PM ==> Uploading build...
Nov 23 02:28:49 PM ==> Build successful š
Nov 23 02:28:49 PM ==> Deploying...
Nov 23 02:29:10 PM ==> Starting service with 'cd app && gunicorn main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0'
Nov 23 02:29:14 PM [2021-11-23 08:59:14 +0000] [48] [INFO] Starting gunicorn 20.1.0
Nov 23 02:29:14 PM [2021-11-23 08:59:14 +0000] [48] [INFO] Listening at: http://0.0.0.0:8000 (48)
Nov 23 02:29:14 PM [2021-11-23 08:59:14 +0000] [48] [INFO] Using worker: uvicorn.workers.UvicornWorker
Nov 23 02:29:14 PM [2021-11-23 08:59:14 +0000] [51] [INFO] Booting worker with pid: 51
Nov 23 02:29:14 PM [2021-11-23 08:59:14 +0000] [52] [INFO] Booting worker with pid: 52
Nov 23 02:29:14 PM [2021-11-23 08:59:14 +0000] [53] [INFO] Booting worker with pid: 53
Nov 23 02:29:14 PM [2021-11-23 08:59:14 +0000] [54] [INFO] Booting worker with pid: 54
Nov 23 02:29:15 PM [2021-11-23 08:59:15 +0000] [52] [INFO] Started server process [52]
Nov 23 02:29:15 PM [2021-11-23 08:59:15 +0000] [52] [INFO] Waiting for application startup.
Nov 23 02:29:15 PM [2021-11-23 08:59:15 +0000] [52] [INFO] Application startup complete.
Nov 23 02:29:15 PM [2021-11-23 08:59:15 +0000] [53] [INFO] Started server process [53]
Nov 23 02:29:15 PM [2021-11-23 08:59:15 +0000] [53] [INFO] Waiting for application startup.
Nov 23 02:29:15 PM [2021-11-23 08:59:15 +0000] [53] [INFO] Application startup complete.
Nov 23 02:29:15 PM [2021-11-23 08:59:15 +0000] [51] [INFO] Started server process [51]
Nov 23 02:29:15 PM [2021-11-23 08:59:15 +0000] [51] [INFO] Waiting for application startup.
Nov 23 02:29:15 PM [2021-11-23 08:59:15 +0000] [51] [INFO] Application startup complete.
Nov 23 02:29:16 PM [2021-11-23 08:59:16 +0000] [54] [INFO] Started server process [54]
Nov 23 02:29:16 PM [2021-11-23 08:59:16 +0000] [54] [INFO] Waiting for application startup.
Nov 23 02:29:16 PM [2021-11-23 08:59:16 +0000] [54] [INFO] Application startup complete.
These are the last few lines of logs before the deploy fails.
EDIT: I managed to fix that too!
I had an environment variable PORT
that had a different value than what was expected. It had to match the port the server was listening on. (taken from this thread)