@webship.co/workspace-uptime-kuma 1.0.0 · github.com/webship/workspace-uptime-kuma · npm
Uptime Kuma for the Webship Workspace dashboard. It brings:
- a builder that runs Uptime Kuma, the self-hosted monitoring tool, from its official image in a container of its own, and does its first run;
- the Uptime Kuma step pack wired into the testing setup of that app;
- its AI items: two agents, a skill, a command and two prompts for building and testing Uptime Kuma apps, each listed in the workspace folder of its kind.
An app runs Uptime Kuma's official image, pinned by digest:
- 2.5.12, the latest stable, by default;
- 1.23.17, the last of the 1.x line, with
--release 1.23.17.
Its data is the project's data/ folder, as Uptime Kuma's own compose.yaml keeps it. Nothing of Uptime Kuma runs on the machine: what the builder asks of the app (its first run, a copy of its database, a check of one) runs in the app's own container, with the image's own Node.js, socket.io client and SQLite.
The workspace is container-based (DDEV by default). An app is a row like any other, so the row menus the core draws (start, stop, launch, backup, restore, remove, tests) work on it. Its Backup and Restore go through the plugin's own database hook.
The builder builds on DDEV by default, and with --runtime on Docker Compose, Podman or a Kubernetes cluster: see Runtimes. It needs Webship Workspace 1.0.42 or newer, the core with the database hook (webship/workspace#937), and says so on an older one before it makes anything.
Use it
cd ~/workspace
bash core/scripts/plugins.sh --require uptime-kuma --with-needs # npm install into the dashboard
bash core/scripts/plugins.sh --activate uptime-kuma --with-needs # plugins.uptime-kuma in settings.yml
bash core/scripts/plugins.sh --install uptime-kuma # the builder, functions, args, AI items, its settings file
bash core/scripts/plugins.sh --configure uptime-kuma # its settings: the update check
The same four steps are buttons on the dashboard's Settings → Plugins page. --install is idempotent. --uninstall removes what it placed; an AI item you edited stays.
Everything the plugin carries lands in the folder it belongs to, when that folder is an active workspace folder:
| What | Lands in |
|---|---|
cmd-uptime-kuma-project.sh |
every active sites folder: dev/, test/, sandboxes/, demos/ |
The agents uptime-kuma-app-builder, uptime-kuma-tester |
ai-agents/ |
The skill uptime-kuma-scenarios |
ai-skills/ |
The command /uptime-kuma-test |
ai-commands/ |
The prompts uptime-kuma-build-and-test, uptime-kuma-scenarios-for-an-app |
ai-prompts/ |
Its settings, plugin.uptime-kuma.settings.yml |
core/config/ (once; never overwritten) |
There they are listed like any other item of the folder, and installed into Claude Code from there.
What it needs
A workspace starts empty, so the manifest says what else this plugin needs (needs):
- One sites folder, for the builder:
dev,test,sandboxesordemos(devis the one added when none is there). The folder also carriescmd-tools-testing.sh, the Users tools and the backup script this plugin's hooks answer to. ai-agents,ai-skills,ai-commandsandai-prompts: the AI folders its agents, its skill, its command and its prompts are placed in.
--require says so, --activate and --install stop until the workspace has them, and --with-needs adds what is missing first:
bash core/scripts/plugins.sh --activate uptime-kuma --with-needs # dev and the four AI folders are required, activated and installed first
bash core/scripts/plugins.sh --install uptime-kuma
Everything the builder runs for an app runs in its own container, through the container tool the workspace already needs; the plugin asks for no command of its own on the machine.
What the package holds
| Path | What it is |
|---|---|
commands/cmd-uptime-kuma-project.sh |
The builder, in the Build list as Uptime Kuma (monitoring), installed into every sites folder |
scripts/functions/fun-uptime-kuma.sh |
The bash functions behind it, sourced by bootstrap once installed. They hold the names the core's tools look for (set_uptimekuma_users, add_uptimekuma_users, cancel_uptimekuma_users, testing_configure_uptimekuma) and the database hook (uptimekuma_is_project, uptimekuma_export_db, uptimekuma_import_db, uptimekuma_db_extension). |
scripts/args/arg-uptime-kuma.sh |
Its argparse; the Build form draws the builder's flags from it |
scripts/docker-compose.uptime-kuma.yaml |
On DDEV, the app's service, copied into the project's .ddev/ |
scripts/uptime-kuma-setup.js |
The app's first run, run in its container: its database (SQLite, on 2.x), its one account, its update check |
scripts/uptime-kuma-db.js |
A copy of the app's live database (VACUUM INTO), and the check of a copy before a restore, run in its container |
config/plugin.uptime-kuma.settings.yml |
The template of its settings file |
testing/site.feature |
The first feature an app gets when testing is set up |
ai/agents/uptime-kuma-app-builder.md |
The agent that builds and fixes apps: their container, their data and database, their account |
ai/agents/uptime-kuma-tester.md |
The agent that writes and runs scenarios with the step pack |
ai/skills/uptime-kuma-scenarios/ |
The skill: the step pack's phrases, the traps, three example features |
ai/commands/uptime-kuma-test.md |
The slash command /uptime-kuma-test <app>: set up when missing, match every step, run, report |
ai/prompts/uptime-kuma-build-and-test.md, uptime-kuma-scenarios-for-an-app.md |
Two prompts: whole launch commands for a new session |
src/index.ts |
register(api): what the assistant is told about Uptime Kuma here |
features/uptime-kuma.feature, features/uptime-kuma-runtimes.feature |
Scenarios for the dashboard's own browser suite |
The workspacePlugin block in package.json is the manifest the installer reads. Its functions and its claim on a project are named uptimekuma (a bash function takes no dash): cmd-tools-add-users.sh <name> uptimekuma.
What is different from a platform
| WordPress (a platform) | Uptime Kuma | |
|---|---|---|
| What is built | A WordPress site | An Uptime Kuma app, 2.5.12 (or 1.23.17), with its one account |
| Project | --project-type=wordpress |
--project-type=generic --webserver-type=generic, DDEV's database omitted: Uptime Kuma's own server serves it, on its own SQLite |
| The image | The container tool's | Uptime Kuma's official image, pinned by digest |
| Its data | — | The project's data/ folder: the SQLite database and the images uploaded to the app, so they go with the project's backup |
| Recognised by | The project type | On DDEV a file the builder writes, .ddev/config.uptime-kuma.yaml; on another runtime its claim, platform: uptimekuma in the x-webship block of compose.yaml |
| Accounts | WP-CLI | The app's own first run: its one account, the admin, through the events its setup page sends |
| Backup and Restore | DDEV's export-db and import-db |
The plugin's database hook: a copy of the live database by the app's own SQLite, checked before it is put back |
| Testing | The WordPress pack | The Uptime Kuma pack, which reads a monitor's badge, pushes to a push monitor, and waits on the app's socket |
The commands
Run it from a sites folder. --help is safe.
Build and serve an app
cd ~/workspace/dev
bash cmd-uptime-kuma-project.sh monitors --install --add-users # Uptime Kuma 2.5.12, started, with its admin
bash cmd-uptime-kuma-project.sh monitors --install --add-users --release 1.23.17 # the last of the 1.x line
bash cmd-uptime-kuma-project.sh monitors --install --add-users --runtime docker # on Docker Compose instead of DDEV
bash cmd-uptime-kuma-project.sh monitors --install --runtime kubernetes # on the workspace's Kubernetes cluster
| Flag | What it does |
|---|---|
--install |
Start the app, choose its database (SQLite, on 2.x), and check that it answers at its address (https://<name>.ddev.site on DDEV) |
--add-users |
Make its one account too, through the app's own first run (see Its account) |
--release 2.5.12|1.23.17 |
The release to run, each from its official image pinned by digest (default: 2.5.12) |
--runtime ddev|docker|podman|kubernetes |
The container runtime to build on (default: DDEV, or container.runtime of settings.yml); see Runtimes |
--launch |
Open the app in a browser when it is ready |
The builder works in this order:
- It deletes a project of the same name first: its containers and its data.
- It makes the project with its empty
data/folder and configures it. - It writes its own folder,
.webship-uptime-kuma/(only you can read it): the release it runs, and the two scripts it runs in the app's container. - With
--install, it starts the app, waits until it answers, and chooses its database: on 2.x the app asks for one on its first run, and gets SQLite (data/kuma.db); 1.23 has SQLite only. - With
--add-users, it makes the app's one account, then sets its update check.
Its data and its database
The data is the project's data/ folder: the app's DATA_DIR, /var/www/html/data in its container on every runtime. It holds:
- the SQLite database,
kuma.db, with thekuma.db-walandkuma.db-shmthe app keeps open beside it; - the images uploaded to the app (
upload/: the logos of status pages), and folders of its own (docker-tls/,screenshots/); - on 2.x,
db-config.json: the database it was given on its first run.
On DDEV the app runs as the project's user, so these are the project's own files. On the other runtimes the web container runs it as the same user.
The row's Backup archives the project's folder, so the archive holds data/. Its database files are the live ones, taken as they were mid-write: the app writes a heartbeat at every check, and a file copied while it is written can hold half of a change. So the plugin declares the core's database hook (webship/workspace#937, core 1.0.42), which the row's Backup and Restore ask first, on every runtime:
- Backup writes a copy of the database beside the archive (
<archive>-db.db.gz). The app's own SQLite takes it while the app runs (VACUUM INTO, which reads the database in one transaction), so the copy is whole and consistent. It is gzipped and checked. A stopped app is started for the copy and stopped again after it. - Restore from the backups list puts the archive back, starts the project, then imports that copy, over the archive's database files: the
.db.gzbeside the archive is the database a Restore ends with, not the archive's copy. The row's Import does the same with a copy you choose. Either works in this order:- It checks the copy: gzipped and whole, SQLite's, then, by the app's own SQLite in its container, whole (
integrity_check), Uptime Kuma's (its tables), and one the app's release opens (1.23 cannot open a database of 2.x; 2.x takes one of 1.23 and migrates it as it starts). A copy that is not leaves everything as it was. - It stops the app, so nothing has the database open, and keeps the old database files aside,
kuma.db-walandkuma.db-shmwithkuma.db(a-walleft beside anotherkuma.dbwould be read into it). - It puts the copy in
kuma.db's place and starts the app on it. - Once the app answers, the old files go. When it does not, they are put back and the app starts on them again.
- It checks the copy: gzipped and whole, SQLite's, then, by the app's own SQLite in its container, whole (
The rest of data/ (the uploaded images) is not in the copy: it comes back with the project's backup archive.
A name ending in .sql.gz (the safety dump the core takes before a remove or a clone asks for one) gets the same copy: the database is SQLite's own file, and the plugin's import reads it under any name.
On a terminal, in the project's folder:
cd ~/workspace/dev/monitors
bash ~/workspace/core/scripts/runtime-verb.sh export-db --file=../monitors-before.db.gz
bash ~/workspace/core/scripts/runtime-verb.sh import-db --file=../monitors-before.db.gz
Proven on DDEV and on Docker Compose, with the row's own actions:
- Backup: the archive held
data/kuma.dbwith its-waland-shm, and the copy beside it (10.5 KB gzipped) the monitor the app had. A monitor added after it, the row's Import put the copy back, with the core's export of the database as it was taken first: the app answered with the one monitor, read through its socket straight after the Import. - The Restore from the backups list ends with the copy, not with the archive's database files. A monitor was added after a Backup, and a second Backup taken; the copy beside the second archive was then made the first Backup's. So the archive's own database files held both monitors, and the copy beside it one. After the row's Remove, the Restore of the second archive from the backups list ended with the copy's one monitor.
- Across the lines, on a terminal: a copy of a 2.5.12 app was refused by a 1.23.17 app ("It is a database of Uptime Kuma 2 (its table knex_migrations), which Uptime Kuma 1.23.17 cannot open"), which kept its own database; a copy of the 1.23.17 app went into a 2.5.12 app, which migrated it as it started and listed its monitor.
Its settings: the update check
core/config/plugin.uptime-kuma.settings.yml holds one setting the builder applies to each app it makes, through the app's own settings:
| Setting | Default here | Uptime Kuma's default | What it is |
|---|---|---|---|
check_update |
"off" |
on | Uptime Kuma asks now and then for a newer release, and shows a notice when there is one. Off here: no call out of a test workspace, and no notice that changes the pages under a test. "on" keeps Uptime Kuma's default. |
It can be changed later in the app itself: Settings, About, Show update if available.
Test an app
bash cmd-tools-testing.sh monitors # webship-js, the step pack, the account, a first feature
bash cmd-tools-testing.sh monitors --run --path tests/features/site.feature
The testing setup does four things:
- adds
@webship-js/uptime-kuma-stepsto the project, with webship-js 2.0.20 or newer (its fill takes the one field shown when a label names several, as on Uptime Kuma's monitor form), and lists the pack's step definitions incucumber.js; - gives the suite the app's address;
- adds the account the scenarios name:
admin, its password fromUPTIME_KUMA_ADMIN_PASSWORD(the workspace's by default); - writes
tests/features/site.feature.
It changes nothing in a project that is not an app of this builder.
Every page of the app needs JavaScript. Its entry page (/api/entry-page) answers without it.
Feature: The first monitors
@js-warn
Scenario: A push monitor is up at its first push, and gone once deleted
Given I am signed in to the monitoring dashboard as "admin"
When I add a push monitor named "Webship test push"
And the "Webship test push" monitor gets a push up with the message "first push"
Then the "Webship test push" monitor should be up
When I delete the "Webship test push" monitor
Then the monitor list should not show "Webship test push"
Runtimes
The commands are the same on every runtime. The builder speaks DDEV's verbs, and on another runtime the core's layer gives each verb its meaning there (webship/workspace#694 and #841):
- the app's image is the stack, with the image's own init (
dumb-init) and its own healthcheck by its path; - the web container runs Uptime Kuma's own server (
node server/server.jsfrom/app), its data in the project'sdata/.
| Runtime | The address of the app | Where the data is | Proven with this builder |
|---|---|---|---|
| DDEV (the default) | https://<name>.ddev.site |
<project>/data (the app's /var/www/html/data) |
Built and served in 68 s with the image already pulled (1.23.17: 25 s), the app a service of the project and DDEV's db omitted; SQLite chosen and the admin made by the builder; the update check off; its first page, its entry page and its sign-in answered, the data the project's user's; the row's Backup and Import, and the Restore from the backups list (see Its data and its database); the copies across the lines; the testing setup from npm (uptime-kuma-steps 2.0.0, webship-js 2.0.20) and its first feature (3 scenarios, 14 steps), twice, on 2.5.12 and on 1.23.17 |
Docker Compose (--runtime docker) |
http://127.0.0.1:<port>, a free port kept in compose.yaml |
<project>/data (in the web container: /var/www/html/data) |
Built in 35 s, the web image built on the app's; the same checks; the row's menu with Export, Import and Backup, the same Backup and Import with the same counts, read through the app's socket straight after the Import, and the Restore from the backups list; the testing setup and its first feature, twice; the plugin's features on the dashboard, its Docker Compose scenarios among them |
Podman (--runtime podman) |
http://127.0.0.1:<port> |
<project>/data |
Built in 5 min 3 s, the image taken into Podman's own storage on that first build; the same checks; the row's menu with Export, Import and Backup, and the same Backup and Import with the same counts; the testing setup and its first feature, twice; the skill's three examples (4 scenarios, 38 steps); the plugin's features on the dashboard, its Podman scenarios among them |
Kubernetes (--runtime kubernetes) |
http://<node address>:<NodePort> |
<project>/data too: the web pod mounts the project's folder by hostPath (see below) |
On kind: built in 4 min 34 s (the web image built by Docker on the app's image and loaded into the node), served at the node's address; the same checks; the row's menu with Export, Import and Backup, and the same Backup and Import with the same counts; the database the app wrote in its pod read from the project's folder on this machine; the testing setup on the cluster and its first feature, twice; the plugin's features on the dashboard with the Docker Compose, Podman and Kubernetes apps up: 12 scenarios, 12 passed |
On Kubernetes the data is in the project too. The web pod mounts the project's folder at /var/www/html by hostPath, and the app's DATA_DIR is its data/. The workspace's kind cluster has /home mounted into its node at the same path (and the workspace's root when it lives elsewhere), so the hostPath is the project's folder on this machine: the database the app writes in its pod is <project>/data/kuma.db here, and the row's Backup archives it, as on the other runtimes. On a cluster of your own (WORKSPACE_KUBE_CONTEXT), the hostPath is a folder of the node the pod runs on: the data is in this machine's project only when that node sees this machine's folder at the same path.
A project of the builder is known by DDEV's file on DDEV and by its claim on another runtime. So the testing setup, the Users tools, the database hook and the dashboard's row work the same on each. Lando and Docksal are runtimes of the workspace too, not proven with this builder yet: it says so and stops, before anything is made.
Its account
| Account | Made by |
|---|---|
admin |
--add-users, or cmd-tools-add-users.sh <name> uptimekuma: through the app's own first run, as its setup page makes it |
Uptime Kuma keeps a single account, which has no mail. It gets the workspace's password, which the builder never prints: it reaches the first run on the script's input, never on a command line. On an app that has its account already, cmd-tools-add-users.sh says so and checks that the password signs it in; when it does not, it says so and changes nothing (the name and password are changed in the app: Settings, Security).
cmd-tools-cancel-users.sh <name> uptimekuma changes nothing: the one account can be neither removed nor kept from signing in, and it says so.
The AI items
| Item | Kind | What it is for |
|---|---|---|
uptime-kuma-app-builder |
agent | Builds and fixes Uptime Kuma apps: their container, their data and database, their account, what to read when one does not answer |
uptime-kuma-tester |
agent | Writes and runs scenarios with the step pack: signing in, monitors read by their badge, pushes, toasts, status pages, test content deleted, never a fixed wait |
uptime-kuma-scenarios |
skill | The step pack's phrases, the traps of the two lines, three example features |
/uptime-kuma-test <app> |
command | Sets the pack up when missing, matches every step, runs, reports |
uptime-kuma-build-and-test |
prompt | Builds an app and proves it with its first feature |
uptime-kuma-scenarios-for-an-app |
prompt | Writes and runs the scenarios of an app of the workspace: its monitors, its dashboard, its status pages |
Every item says the workspace is container-based (DDEV by default), and the agents and the skill send the reader to the book Automated Functional Testing Recipes first.
Develop it
npm install
npm test # builds, then the unit tests: the manifest, the scripts, the AI items, the needs
npm run lint # the TypeScript compiler, no output
CI runs the same on Node.js 24 and 26, and checks that every shell script parses. It also runs the plugin's webship-js features against a dashboard with the plugin installed (the reusable workflow webship/workspace/.github/workflows/plugin-browser-suite.yml):
- before the features it builds the app the manifest names (
featuresSite:cmd-uptime-kuma-project.sh ci-uptime-kuma --install --add-users --runtime docker); - so the scenarios of
features/uptime-kuma-runtimes.featuretagged@needs-runtime-dockerdrive a real app on Docker Compose; - the Podman and Kubernetes ones run where such an app is.
tests/fixtures/step-definitions.txt holds the step definitions of the step pack and of webship-js, read from their packages: every phrase an AI item shows must match one of them.
License
ISC (see LICENSE).
Logo
The logo is Uptime Kuma's mark from Simple Icons (uptimekuma, CC0-1.0), filled with the colour Simple Icons lists for the brand, #5CDD8B, so it reads on a light and a dark page. Uptime Kuma and its mark are Uptime Kuma's: the logo names the software the plugin builds. It is not covered by this package's licence.