Skip to content

v2.0.0

Choose a tag to compare

@joshghent joshghent released this 01 Oct 21:31
· 37 commits to main since this release
v2.0.0
6e6088b

uptime is now an npm package, @joshghent/uptime, instead of a repository you
fork. A status page is a repository of its own with four files in it —
status.yaml, a three-line worker.js, wrangler.jsonc and a workflow — and
updates reach it as Dependabot pull requests that prove themselves against your
config and merge themselves. No token, no secret, no merging upstream.

Action required if you run a fork. Move it onto the package once; after
that there is nothing to do for minor and patch releases. It keeps the same
Worker, the same database and the same history, and the same repository, so
Cloudflare Workers Builds stays connected. In your fork:

git switch -c move-to-package

# Keep your monitors, drop everything else.
git rm -rq . && git checkout HEAD -- status.yaml

# Bring in the template, then put your status.yaml back over its example.
npm create uptime@2 ../uptime-template
cp -r ../uptime-template/. . && rm -rf ../uptime-template
git checkout HEAD -- status.yaml

Then copy three things from your old wrangler.jsonc (git show HEAD:wrangler.jsonc) into the new one: your database_id, your routes if
you set one, and your name if you changed it from uptime. A different name
deploys a different Worker.

npm install
npm run check        # your config, the build, and the Worker booted locally
git add -A && git commit -m "Move onto @joshghent/uptime"

Open that as a pull request and merge it; Workers Builds deploys it as usual.

  • If you set the Workers Builds deploy command to pnpm run deploy for 1.1.0,
    set it back to the default, npx wrangler deploy. Migrations no longer run
    there.
  • The database needs nothing. Its d1_migrations table already lists both
    migrations, and the Worker reads the same table.
  • Delete the SYNC_TOKEN secret and the token behind it, and the upstream
    remote if you added one.

Added

  • createWorker(source), the whole Worker around the text of a status.yaml.
  • The Worker applies its own migrations, on the first request or cron run in
    each isolate, into wrangler's own d1_migrations table. A release that adds
    a migration needs nothing from you.
  • status.yaml takes a version: (missing means 1). A release that changes
    the shape of the file upgrades older ones in memory, so an update never needs
    your config edited.
  • The uptime command: uptime lint, uptime check (lint, a dry-run build,
    then the Worker booted against an empty local database and its page and
    /health loaded) and uptime init. npm create uptime runs uptime init.
  • A template deployment with a Dependabot config and a workflow that runs
    uptime check on every pull request and merges minor and patch updates of
    the package when it passes.
  • Releases publish both packages to npm, with provenance.

Changed

  • /health answers 503 when the Worker could not bring the database up to
    date, rather than when a migration was not run by hand.
  • status.example.yaml is now template/status.yaml, and pnpm lint:config
    in a status page is npm run lint.

Removed

  • The upstream sync workflow and its SYNC_TOKEN, the Actions deploy job and
    DEPLOY_VIA_ACTIONS, and the deploy and db:* scripts. wrangler d1 migrations apply still works against a deployment's database, but nothing
    needs it.