Deployment guide

Streamlit

Overview

Streamlit is a Python framework for building and sharing data apps. You write a Python script, and Streamlit turns it into an interactive web app with charts, dataframes, widgets and maps, with no front-end code. Data scientists and ML engineers use it for dashboards, internal tools and model demos.

This SecureAnyCloud image installs Streamlit 1.58.0 in a dedicated Python virtualenv and serves a sample dashboard app as a systemd service. The service is bound to loopback behind an nginx reverse proxy on port 80 with HTTP Basic authentication. Every VM generates a unique login password on first boot.

What you get:

  • Streamlit 1.58.0 in a Python virtualenv at /opt/streamlit/venv, with pandas and numpy
  • A sample interactive dashboard app at /var/lib/streamlit/app.py
  • nginx on :80, fronting the loopback Streamlit server with HTTP Basic authentication and websocket proxying
  • A dedicated Azure data disk at /var/lib/streamlit that holds the app and its data. It is separate from the OS disk and re-provisioned with every VM.
  • streamlit.service and nginx.service as enabled, active systemd units
  • 24/7 SecureAnyCloud support

Prerequisites

You need an active Azure subscription, an SSH key pair, and a VNet with a subnet in the target region.

Standard_B2ms (2 vCPU / 8 GiB RAM) is a good starting size. Scale up for heavier apps.

In the network security group (NSG), allow inbound 22/tcp from your management network and 80/tcp for the app. For public exposure, put TLS in front of the app (see Enabling HTTPS).

Step 1 - Deploy from the Azure Marketplace

Sign in to the Azure Portal, choose Create a resource, search the Marketplace for Streamlit by SecureAnyCloud, and select Create.

On the Basics tab, pick your subscription, resource group, region and size. Under Administrator account, choose SSH public key and paste your key. Under Inbound port rules, allow SSH (22) and HTTP (80).

Review the dedicated data disk on the Disks tab, then select Review + create and Create.

Step 2 - Deploy from the Azure CLI

# Accept the Marketplace terms once per subscription (required before the first CLI deploy)
az vm image terms accept --urn sac1647283583153:streamlit-ubuntu-24-04:default:latest
az vm create \
  --resource-group <your-rg> \
  --name streamlit \
  --image sac1647283583153:streamlit-ubuntu-24-04:default:latest \
  --size Standard_B2ms \
  --admin-username azureuser \
  --ssh-key-values ~/.ssh/id_ed25519.pub \
  --vnet-name <your-vnet> --subnet <your-subnet> \
  --public-ip-sku Standard
az vm open-port --resource-group <your-rg> --name streamlit --port 80 --priority 1010

Step 3 - Connect to your VM

ssh azureuser@<vm-public-ip>

Step 4 - Confirm the services are running

systemctl is-active streamlit.service nginx.service

Both services report active. Streamlit takes a few seconds to start.

Step 5 - Retrieve your password

Your VM generates a unique admin password on first boot and writes it to a root-only file. Read it with:

sudo cat /root/streamlit-credentials.txt

The file contains STREAMLIT_ADMIN_USER (admin), STREAMLIT_ADMIN_PASSWORD and the app URL. Store the password in a safe place.

Step 6 - Check the health endpoint

nginx serves an unauthenticated health endpoint for load balancers and probes. Query it with:

curl -s http://localhost/health

It returns ok.

Step 7 - Open the app

Browse to http://<vm-public-ip>/ and sign in as admin with the password from Step 5.

The bundled sample app demonstrates Streamlit's building blocks: a sidebar with interactive widgets, metrics, a live line chart and a dataframe. Move the sliders and the app reruns instantly.

Scroll down to see the chart and the data table:

Step 8 - Confirm the server from the command line

Streamlit also exposes a health endpoint behind the same Basic authentication. Confirm that it is serving:

curl -s -u admin:<STREAMLIT_ADMIN_PASSWORD> http://localhost/_stcore/health; echo

It returns ok.

Step 9 - Deploy your own app

Replace the sample script with your own Streamlit app, then restart the service:

# edit /var/lib/streamlit/app.py with your Streamlit code, then:
sudo systemctl restart streamlit

Install any extra Python packages your app needs into the bundled virtualenv:

sudo /opt/streamlit/venv/bin/pip install <your-packages>
sudo systemctl restart streamlit

The app reloads, and your dashboard is served at the same URL behind the same authentication.

Step 10 - Confirm the app lives on the dedicated disk

Your app and its data are stored on the dedicated Azure data disk, so they survive OS changes and can be resized independently. Confirm the mount:

findmnt /var/lib/streamlit

A separate Azure data disk backs the mount. The disk is captured into the image and re-provisioned on every VM.

Enabling HTTPS

The nginx reverse proxy serves plain HTTP on port 80. To expose the app publicly, add TLS in front of it.

Add a DNS name for the VM. Then either use the companion SecureAnyCloud nginx-ssl-certbot image as a TLS reverse proxy, or install certbot and extend the existing nginx site with a listen 443 ssl; server block.

Keep Streamlit bound to loopback, so the only public surface is the authenticated, TLS-terminated proxy. The proxy already forwards the websocket that Streamlit needs.

Maintenance

  • Your app: edit /var/lib/streamlit/app.py, or point the service at a different file, then run sudo systemctl restart streamlit.
  • Packages: install them into /opt/streamlit/venv with its pip.
  • Backups: snapshot the /var/lib/streamlit data disk.
  • Upgrades: run sudo /opt/streamlit/venv/bin/pip install -U streamlit, then sudo systemctl restart streamlit.
  • Security patches: unattended-upgrades stays enabled, so the OS keeps receiving security updates automatically.

Support

SecureAnyCloud provides 24/7 support for this image. Contact sales@secureanycloud.com.

Deploy on Azure

Launch Streamlit on Ubuntu 24.04 LTS on Azure with 24/7 support from SecureAnyCloud.

View this image

Need Help?

Our support team is available 24/7.

sales@secureanycloud.com

Deploy on Azure