Deploy Streamlit apps on GCP App Engine without Docker

I realized that almost all the tutorials I could find on deployment of streamlit apps on GCP are based on docker images, which basically says that containerize your app inside a docker and deploy it on App engine or Compute engine.

But while doing some research I found that we can directly deploy python applications to App Engine without the need for containerizing inside docker. This method is cheaper and much faster and better performance than the docker version.

Did anyone explore this, can you please point such a tutorial to me. Otherwise, I will try to create a tutorial around this.

1 Like

I deployed the app to GCP APP engine standard environment (without docker), but when I open the url, it is stuck at “Please wait”. I tried all the solutions available online sample below:
streamlit run --server.port=8080 --server.address=0.0.0.0 --server.enableCORS=false --server.enableWebsocketCompression=false --server.enableXsrfProtection=false --server.headless=true

Any help would be appreciated.

Finally I was able to deploy streamlit to Google App Engine in the flexible environment without any docker/container.
The standard environment lacks web socket support which prevents Streamlit app to handle the backend-frontend communications.

Here is the app.yaml file I used:

runtime: python
runtime_config:
operating_system: “ubuntu18”
runtime_version: “3.8”
entrypoint: streamlit run --server.port=8080 --server.address=0.0.0.0 --server.enableCORS=false --server.enableWebsocketCompression=false --server.enableXsrfProtection=false --server.headless=true app.py
env: flex
network:
session_affinity: true

1 Like

Hello

I am facing the same problem. This is the complete app.yaml file that you used? because it generated some error when you execute the command of gcloud app deploy

gcloud app deploy --project project_name_here --version=v11

What is the error message you are getting?

Thank you for your reply.

The web app just says: “Please wait”, when I use my app.yaml wich is the following:

runtime: python310

# Declaracion de variables de entorno
env_variables:
  PORT: 8080

entrypoint: streamlit run web_app.py --server.port $PORT

I tried the one that you posted:

runtime: python
runtime_config:
operating_system: “ubuntu18”
runtime_version: “3.8”
entrypoint: streamlit run --server.port=8080 --server.address=0.0.0.0 --server.enableCORS=false --server.enableWebsocketCompression=false --server.enableXsrfProtection=false --server.headless=true app.py
env: flex
network:
session_affinity: true

When I use this other app.yaml file i get several errors when I try to deploy the app with the comandop of gloud app deploy such as:

Unexpected attribute 'operating_system' for object of type AppInfoExternal.