Search code examples
pythongoogle-cloud-platformgoogle-app-enginestreamlit

[GCP][App Engine] Streamlit web app deployment - container crashed


I am trying to deploy a web app developed using Streamlit on Google App Engine. When the deployment process is close to completion. I got the following error:

ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error! Code: APP_CONTAINER_CRASHED

  You can now view your Streamlit app in your browser.

  Network URL: http://172.17.0.6:8080
  External URL: http://34.67.15.189:8080

Killed

I am unable to understand the root cause of this error. Any suggestion and/or help would be highly appreciated.

EDIT:

I am using flexible environment. The app.yaml is as follows:

runtime: custom
env: flex

runtime_config:
  python_version: 3

manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 5
  disk_size_gb: 25

Dockerfile is as follows:

FROM python:3.7

# Copy local code to the container image.
WORKDIR /app
COPY requirements.txt ./requirements.txt

# Install dependencies.
RUN pip3 install -r requirements.txt

EXPOSE 8080

COPY . /app

# Run the web service on container startup.
CMD streamlit run --server.port 8080 --server.enableCORS false app.py

And, the requirements are:

pandas==0.24.2
scikit_learn==0.23.1
streamlit==0.62.1

Solution

  • I used the streamlit example app and your configuration files I noticed that you are defining runtime_config, this is not necessary since you choosed generic python docker image in your Dockerfile, this only applies for the App Engine's Python image.

    For more information about Custom runtimes, please check this document

    After some modifications on your files, all is running by using the example app, feel free to use these files as staring point.

    this is my folder structure

    ./
    ├── app.py
    ├── app.yaml
    ├── Dockerfile
    └── requirements.txt
    
    

    this is my app.yaml

    runtime: custom
    env: flex
    
    manual_scaling:
      instances: 1
    
    resources:
      cpu: 4
      memory_gb: 5
      disk_size_gb: 25
    
    

    this is my Dockerfile

    FROM python:3.7
    
    # Copy local code to the container image.
    WORKDIR /app
    COPY requirements.txt ./requirements.txt
    
    # Install dependencies.
    RUN pip3 install -r requirements.txt
    
    EXPOSE 8080
    
    COPY . /app
    
    # Run the web service on container startup.
    CMD streamlit run --server.port 8080 --server.enableCORS false /app/app.py