Background - use AppEngine to deploy a Flask-app Vertex AI Widget (from Vertex Agent Builder with Datastore RAG on proprietary data).
Use App Engine Dashboard, default environment, and follow Google example (flask app): python-docs-samples/appengine/standard_python3/building-an-app/building-an-app-1 at main · GoogleClo...
After uploaded the files and ran locally and successfully via cloud shell, proceeded to gcloud app deploy, which went smoothly. Got "Service Unavailable" from target URL (project-ID.uc.r.appspot.com).
Recall two things I had to deviate from the guideline to complete App Engine deploy from Dashboard:
Out of curiosity, check
pip3 freeze | grep -i flask >> requirements_check.txt (
Solved! Go to Solution.
Since you added an entry point, gunicorn -b :$PORT main:app, to your app.yaml file, you have to include the server software in your requirements.txt file i.e. you have to add 'gunicorn' to your requirements.txt file - see documentation which says
>> If you have configured a Gunicorn web server entrypoint in the app.yaml file, you must also add gunicorn to your requirements.txt file.
Extra Information
1. While testing your app locally (running it locally), if you want to get a close approximation (not an exact match) of how your App will behave in production, then you should run your app with the dev_appserver.py tool.
2. Running with dev_appserver.py will invoke your app.yaml file (and you would have seen the error about missing gunicorn). This in turn will test any entrypoints you have, static routes you have and the maximum size of each request
Since you added an entry point, gunicorn -b :$PORT main:app, to your app.yaml file, you have to include the server software in your requirements.txt file i.e. you have to add 'gunicorn' to your requirements.txt file - see documentation which says
>> If you have configured a Gunicorn web server entrypoint in the app.yaml file, you must also add gunicorn to your requirements.txt file.
Extra Information
1. While testing your app locally (running it locally), if you want to get a close approximation (not an exact match) of how your App will behave in production, then you should run your app with the dev_appserver.py tool.
2. Running with dev_appserver.py will invoke your app.yaml file (and you would have seen the error about missing gunicorn). This in turn will test any entrypoints you have, static routes you have and the maximum size of each request
@NoCommandLine, that does it. Many Thanks. 🤠
Flask==3.0.0
gunicorn==22.0.0
Werkzeug==3.0.1
requirements.txt works like charm. It so happens doc in the Google Cloud Run Quickstart
Unless you have unique/detailed reasons to use specific versions, I'll advise removing the versions. Just have Flask, guicorn in your requirements.txt file
Wouldn't it be safer to lock the versions of each package, in order to reduce the chance of issues arising when packages release new versions?
I know gunicorn has inadvertently introduced issues with new versions in the past.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |