Skip to content

Release the dashboard as crontab-dashboard, next to cronitor (34.0) - #89

Open
aflanagan wants to merge 12 commits into
masterfrom
agent/determined-pascal-ue639u
Open

aflanagan wants to merge 12 commits into
masterfrom
agent/determined-pascal-ue639u

Conversation

@aflanagan

Copy link
Copy Markdown
Contributor

The Crontab Guru Dashboard moves out of the cronitor binary into a second program, crontab-dashboard. Both are built from the same commit and released together. This replaces #64 and the separate crontab-dashboard repository: with one repo, the dashboard and the CLI always share the same crontab code, so there is no version skew to manage.

What changes for users

  • cronitor no longer contains the dashboard, its web frontend, or its MCP server. Its build needs no Node or npm.
  • cronitor dash is a launcher. It finds crontab-dashboard (CRONTAB_DASHBOARD_BIN, then the folder that holds cronitor, then PATH) and execs crontab-dashboard dash <args>. All arguments, including root flags before dash, the environment, and standard streams pass through. On Unix the dashboard keeps the PID, signals, and exit status, so systemd units and MCP configs need no change.
  • If crontab-dashboard is missing, cronitor dash exits 1 and prints a one-line install command for the matching release and the cronitor folder (it adds sudo when the folder is not writable; Windows gets the .zip URL).
  • cronitor update also updates a crontab-dashboard in the same folder. The dashboard's update button updates both. Before this change, that button would have installed the cronitor archive over the dashboard.
  • New release assets: crontab-dashboard_<os>_<arch>.tar.gz (Windows .zip) for the same 9 platforms. cronitor archives keep their names, so older cronitor update versions keep working.
  • dockerfile installs both programs and starts crontab-dashboard.
  • The version goes to 34.0, and docs/releases/34.0.md explains the change.

Commits

  1. Move the dashboard into internal/dashboard with no behavior change. internal/dashboard imports cmd, never the other way round; cmd/dashboard_api.go exports the helpers it uses.
  2. Add cmd/crontab-dashboard. The frontend is embedded by a new web package; web/static/README.md is committed so Go builds and tests without Node.
  3. One updater for both binaries.
  4. cronitor dash becomes the launcher; main.go stops importing the dashboard.
  5. CI/release: the CLI jobs (including the two with the live API key) no longer run npm. A new job builds the frontend and runs tests/dashboard-smoke.sh. Release builds the frontend once and adds a crontab-dashboard matrix (scripts/package-dashboard.sh); publish verifies both asset sets.
  6. Docs.
  7. tests/real-cron-dashboard.sh, run by the e2e label.
  8. Version 34.0 and release notes.

Testing

  • go test ./... passes. go vet and builds pass for linux, darwin, windows, and freebsd. The go vet composite-literal warnings in cmd/root.go also exist on master.
  • New unit tests: the launcher passes arguments and environment through, finds the dashboard next to cronitor, and prints the missing-dashboard message per platform. The updater picks each binary's asset and updates the sibling binary, in both directions; a mock release server covers this. crontab-dashboard runs dash by default.
  • tests/dashboard-smoke.sh passed locally with the real frontend build.
  • tests/real-cron-dashboard.sh passed locally under real cron. It turns monitoring on through the dashboard API and checks that the line is wrapped and that run and complete pings arrive. It then turns monitoring off and checks that the line is restored and no pings are sent.
  • I ran the printed install command against a locally built archive, using file:// in place of the GitHub URL. After that, cronitor dash found the dashboard.
  • Not verified: the release workflow, because it only runs on a tag, so check the first 34.0 release by hand. I also did not run actionlint here; I only checked that the YAML parses.

Before merging

  • Merge together with the 34.0 release. Until a release has crontab-dashboard_* assets, the install command and the dockerfile point at files that do not exist yet.
  • The public install docs in cronitorio/cronitor (docs/src/pages/docs/using-cronitor-cli.md and the guides that mention cronitor dash) need a separate update.

Generated by Claude Code

The dashboard code moves out of cmd with no change in behavior:
cmd/dash.go, lib/mcp_handler.go, lib/process_validator.go, the
dash SysProcAttr helper, and the dash tests.

- internal/dashboard imports cmd; cmd never imports the dashboard.
  cmd/dashboard_api.go exports the helpers the dashboard uses, and
  internal/dashboard/cli.go maps them to their old names so dash.go
  keeps its body.
- main.go registers dash. A later change can build cronitor without
  the dashboard by dropping that import, and build crontab-dashboard
  as a second binary.
- main_test.go checks that dash stays registered with its flags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B4Z4Doj15mT9bCnvdKp5UB
cmd/crontab-dashboard builds the dashboard as its own program from the
same commit as cronitor. It runs the dash command, so
`crontab-dashboard --port 9100` behaves like `cronitor dash --port 9100`
and accepts the same root flags.

- The frontend is embedded by a new web package. web/static/README.md
  is committed so Go builds and tests without Node; the npm build keeps
  it.
- cronitor still includes the dashboard; a later commit removes it.
- The systemd restart lookup still finds cronitor-dashboard.service when
  the running binary is crontab-dashboard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B4Z4Doj15mT9bCnvdKp5UB
Each release has <os>_<arch> archives for cronitor and
crontab-dashboard_<os>_<arch> archives for the dashboard. The updater
now picks the asset for the running program, then updates the other
program when it is in the same folder, so both stay at one version.

- `cronitor update` updates a crontab-dashboard next to it and says so.
- The dashboard's update button updates itself and the cronitor next to
  it. Before, it would have installed the cronitor archive over the
  dashboard.
- The cronitor archive keeps its name, so older `cronitor update`
  versions keep working.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B4Z4Doj15mT9bCnvdKp5UB
The cronitor binary no longer contains the dashboard, its web assets,
or the MCP server. `cronitor dash` finds crontab-dashboard
(CRONTAB_DASHBOARD_BIN, then the folder that holds cronitor, then PATH)
and execs `crontab-dashboard dash <args>`. Every argument passes through
as typed, including root flags before `dash`, with the environment and
standard streams. On Unix the dashboard keeps the PID, signals, and exit
status, so systemd units and MCP configs need no change.

When crontab-dashboard is missing, `cronitor dash` exits 1 with a
command that installs the matching release next to cronitor:

  curl -fsSL .../releases/download/<version>/crontab-dashboard_<os>_<arch>.tar.gz | tar -xz -C <dir>

It adds sudo when that folder is not writable. Windows gets the .zip URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B4Z4Doj15mT9bCnvdKp5UB
- Tests: the CLI jobs, including the two with the live API key, no
  longer install npm packages. A new dashboard job builds the frontend,
  runs tests/dashboard-smoke.sh, and packages one archive.
- Release: the frontend builds once; a crontab-dashboard matrix with the
  same platforms as cronitor packages crontab-dashboard_<os>_<arch>
  archives with scripts/package-dashboard.sh; publish verifies both sets.
  The cronitor build step is unchanged apart from dropping Node.
- tests/dashboard-smoke.sh checks the missing-dashboard message, that
  `cronitor --config X dash --port N` execs crontab-dashboard and serves
  the UI with auth, and a clean SIGTERM exit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B4Z4Doj15mT9bCnvdKp5UB
- README: how to install crontab-dashboard next to cronitor, that
  `cronitor dash` keeps working, and that `cronitor update` updates both.
- MCP guide: the MCP server is part of the dashboard.
- dockerfile: install crontab-dashboard from the latest release and
  start it directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B4Z4Doj15mT9bCnvdKp5UB
tests/real-cron-dashboard.sh builds cronitor and crontab-dashboard
against a mock API, starts the dashboard through `cronitor dash`, and
checks two real cron ticks:

1. Monitoring on through the dashboard API wraps the job with
   `cronitor exec`; the job runs and sends run and complete pings.
2. Monitoring off restores the original line; the job runs with no
   pings.

The real-cron workflow (e2e label) runs it after tests/real-cron.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B4Z4Doj15mT9bCnvdKp5UB
The major version marks the move of the dashboard into crontab-dashboard.
Users of `cronitor dash` must install it next to cronitor; the release
notes and the `cronitor dash` error give the command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B4Z4Doj15mT9bCnvdKp5UB
exec.LookPath on Windows only accepts files with an executable
extension, so the fake dashboard needs .exe. Without it the launcher
could not find it and exited the test binary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B4Z4Doj15mT9bCnvdKp5UB
The dashboard registered its SIGINT/SIGTERM handler after starting the
server, sleeping 500 ms, and opening the browser. A stop signal in that
window killed it without a graceful shutdown (exit 143). It now
registers the handler before the server starts. The smoke test sends
SIGTERM as soon as the dashboard answers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B4Z4Doj15mT9bCnvdKp5UB
A standalone dashboard install should not need the cronitor command.
`crontab-dashboard configure ...` and `crontab-dashboard update` now
run those commands instead of starting the dashboard; update replaces
the dashboard and the cronitor next to it. After first-run credentials
are saved, the dashboard now says to run crontab-dashboard again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B4Z4Doj15mT9bCnvdKp5UB
Conflict in cmd/root.go: keep Version "34.0".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B4Z4DjiMGeBZ2vo5fDc63q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants