Streamlit-based dashboard prototype for the Internet Quality Barometer (IQB) project.
The dashboard is automatically published using Cloud Run:
| Trigger | Environment | URL |
|---|---|---|
Push to sandbox-* branch |
Sandbox | https://iqb.mlab-sandbox.measurementlab.net/ |
| Merge pull request | Staging | https://iqb.mlab-staging.measurementlab.net/ |
Use sandbox deployments to see experimental changes or share them with a colleague for feedback.
To see recent builds:
gcloud builds list --project=mlab-sandbox --limit=10To see a build logs:
gcloud builds log {BUILD_ID} --project=mlab-sandboxChange the project to mlab-staging for the staging environment.
-
Python 3.13 (see
.python-versionat repo root) -
uv installed (see root README.md)
# Enter into the prototype directory if you're in the repository root
cd prototype
# Sync dependencies (creates .venv if needed)
uv sync --dev
# Run the Streamlit app
uv run streamlit run Home.pyThe app will be available at: http://localhost:8501
If you make changes to Home.py or any other file in this directory, Streamlit will reload on save.
prototype/
├── Home.py # Main Streamlit entry point
├── app_state.py # Application state management
├── session_state.py # Session state management
├── pages/ # Streamlit multi-page app pages
├── cache/ # Static data cache (JSON files per country)
├── utils/ # Helpers (data loading, calculations, constants)
├── visualizations/ # Chart and UI components (sunburst, etc.)
├── natural_earth/ # GeoJSON extraction for map visualizations
├── pyproject.toml # Dependencies (streamlit, pandas, mlab-iqb)
├── Dockerfile # Container image for Cloud Run
└── README.md # This file
To test the Dockerfile locally before deploying:
# Build the image (from repo root)
cd ..
docker build -f prototype/Dockerfile -t iqb-prototype:test .
# Run the container
docker run --rm -p 8501:8501 iqb-prototype:test
# Access at http://localhost:8501
# Press Ctrl+C three or more times to stopTo run in background:
# Start container
docker run -d -p 8501:8501 --name iqb-test iqb-prototype:test
# Check logs
docker logs iqb-test
# Stop container
docker stop iqb-test
docker rm iqb-testFor manual deployment to Cloud Run using Cloud Build:
# From the directory containing cloudbuild.yaml
gcloud builds submit --config=cloudbuild.yaml --project=mlab-sandboxThis will:
-
Build the Docker image from
prototype/Dockerfile -
Push to Artifact Registry
-
Deploy to Cloud Run in
us-east1region
Configuration: See cloudbuild.yaml for deployment
settings (memory, CPU, region).
Permissions required:
-
roles/editor- Deploy and update services -
roles/run.admin- Make new services public (see below)
Making the service public:
If deploying a new service or if you get 403 errors, an admin needs to run this command:
gcloud run services add-iam-policy-binding iqb-prototype \
--region=us-central1 \
--member="allUsers" \
--role="roles/run.invoker" \
--project=mlab-sandboxThis IAM policy persists across deployments, so it's only needed once.
The prototype depends on:
-
streamlit - Web framework
-
pandas - Data manipulation
-
numpy - Numerical operations
-
mlab-iqb - IQB library (from ../library, managed via uv workspace)
Dependencies are locked in the workspace uv.lock
at the repository root.