Skip to content

Sample streamlit app deployed to Azure App Service with autoscaling

Notifications You must be signed in to change notification settings

meestaben/azure-streamlit-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy

Azure App Service - Autoscaling Streamlit PoC

Deploys a new custom registry in Azure Container Registry, builds a custom Docker image, and runs the image from the custom registry. The image contains a Streamlit demo app.

Running the App

  1. Create a new stack:

    $ pulumi stack init dev
  2. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):

    $ az login
  3. Create a Python virtualenv, activate it, and install dependencies:

    This installs the dependent packages needed for our Pulumi program.

    $ python3 -m venv venv
    $ source venv/bin/activate
    $ pip3 install -r requirements.txt
  4. Specify the Azure location to use:

    $ pulumi config set azure-native:location uksouth
  5. Run pulumi up to preview and deploy changes:

    $ pulumi up
    Previewing changes:
    ...
    
    Performing changes:
    ...
    Resources:
        + 5 created
    
    Duration: 56s
  6. Check the deployed endpoints:

    $ open $(pulumi stack output endpoint)
    

Building the app locally to test

cd app
docker build -t streamlit-app:latest .
docker run -p 8501:8501 streamlit-app:latest
open "http://localhost:8501"

Limitations

  1. PoC uses default Azure domain. In production it will require custom domain and SSL/TLS cert

  2. Single dev environment only at present

  3. Streamlit's in-memory state handling is potentially not compatible with a scale in/out model in which backend resources are generally considered to be ephemeral. Requires testing.

About

Sample streamlit app deployed to Azure App Service with autoscaling

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published