I have managed to get around the healthz conflict in a rather nasty way. I also enabled session_affinity
to help with websocket connections.
here is my app.yaml
, ill explain the healthz fix below:
runtime: python
env: flex
# This is a horrible workaround to get streamlit working on app engine
# https://discuss.streamlit.io/t/has-anyone-deployed-to-google-cloud-platform/931/20
entrypoint: find ${VIRTUAL_ENV}/lib/python3.6/site-packages/streamlit -type f \( -iname \*.py -o -iname \*.js \) -print0 | xargs -0 sed -i 's/healthz/health-check/g' && streamlit run sim_v3.py --server.port $PORT --server.enableCORS=false
runtime_config:
python_version: 3
manual_scaling:
instances: 1
network:
session_affinity: true
The hack is happening in the entrypoint command. I am finding all files in the python virtualenv dependencies folder, site-packages
, that are either .py
or .js
and replacing healthz
with health-check
If you are intending on supporting a deployed streamlit app, I suggest you avoid this solution. It will break if
- the version of python changes in the google python runtime
- streamlit make a change that would break this inline replacement
- google decide to change their folder naming conventions