Skip to content

Streamlit Keep-Alive

A scheduled job that keeps my demo links loadable. Headless Chromium opens each sleeping app and clicks the wake button every four hours.

cron interval
4 h
  • Python
  • Playwright
  • GitHub Actions

The problem

Streamlit Community Cloud puts apps to sleep after a period of inactivity, so the first person to click one of my demo links would wait a minute or see an error.

Pipeline

  1. Cron, every 4 h
  2. Ubuntu runner
  3. Headless Chromium
  4. Visit each app
  5. Click wake
A scheduled real browser visit, because a ping does not wake the app. The highlighted stage is where the key decision sits.

How it works

A GitHub Actions cron schedule starts a fresh Ubuntu runner every four hours, or on demand.

The runner installs Python and Playwright with headless Chromium, visits each app, and clicks the wake button if the app is asleep.

Adding an app is a one-line change to a list in the script.

The decision

I chose
Drive a real headless browser.
Instead of
A plain HTTP ping.
Because
A ping gets 200 OK from a static HTML shell and never starts the Python process, so the app stays asleep. Only a rendered visit that clicks the button actually wakes it.

What I would do next

  • Alert me when a wake fails, instead of finding out from a slow demo.
  • GitHub disables scheduled workflows after 60 days without repository activity. A periodic commit would remove that failure mode.