feat: organization-owned regions, checkers and status page servers #53

Merged
Sebi merged 3 commits from feat/org-agents into main 2026-11-22 00:47:25 +00:00
Owner

Organization-owned regions, checkers and status page servers. Stacked on #51 (M5).

Ownership

  • Regions and agents (checkers, status page servers) belong to the platform or to one organization.
  • Platform resources are created by platform admins (admin panel /admin, or api region add / api agent create) and are usable by every org.
  • Organizations create their own under Regions & checkers; row-level security keeps them invisible to others. Org checkers only receive their org's monitors (also enforced in the job query).
  • Triggers keep agents in regions of the same owner and monitors in platform or own regions.
  • Region lists put the org's own regions first.

Platform admins

users.is_admin, granted with api admin grant <email>; the first user of a self-hosted installation (UPTIME_SIGNUP=first-user) becomes admin automatically.

Schema

Regions are now identified by id (keys only need to be unique per owner); monitor_regions, agents and check_results.region reference the id.

Fix included

Migrations ran under row-level security without a scope, so the data changes in 00009 and 00012 did nothing (existing members missed the Viewer role, Admin lacked tokens.manage). Migration connections now run in the system scope; 00016 repairs the data, with a regression test.

Closes #52

🤖 Generated with Claude Code

https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3

Organization-owned regions, checkers and status page servers. Stacked on #51 (M5). ## Ownership - Regions and agents (checkers, status page servers) belong to the platform or to one organization. - Platform resources are created by platform admins (admin panel `/admin`, or `api region add` / `api agent create`) and are usable by every org. - Organizations create their own under *Regions & checkers*; row-level security keeps them invisible to others. Org checkers only receive their org's monitors (also enforced in the job query). - Triggers keep agents in regions of the same owner and monitors in platform or own regions. - Region lists put the org's own regions first. ## Platform admins `users.is_admin`, granted with `api admin grant <email>`; the first user of a self-hosted installation (`UPTIME_SIGNUP=first-user`) becomes admin automatically. ## Schema Regions are now identified by id (keys only need to be unique per owner); `monitor_regions`, `agents` and `check_results.region` reference the id. ## Fix included Migrations ran under row-level security without a scope, so the data changes in 00009 and 00012 did nothing (existing members missed the Viewer role, Admin lacked `tokens.manage`). Migration connections now run in the system scope; 00016 repairs the data, with a regression test. Closes #52 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Sebi added this to the M9 Remote Mode milestone 2026-11-22 00:36:14 +00:00
Sebi changed target branch from feat/m5-alerting to main 2026-11-22 00:46:24 +00:00
Sebi added 3 commits 2026-11-22 00:46:24 +00:00
Row-level security hid every row from the data changes in migrations
00009 and 00012: existing members did not receive the Viewer role and
the built-in Admin role lacked tokens.manage. Built-in roles were also
not writable in the system scope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Regions are identified by id so organizations can reuse keys. Triggers
keep agents in regions of the same owner and monitors in platform or own
regions. Platform admins are a user flag.

Refs #52

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Organizations create regions and agents for themselves under Regions &
checkers; an org checker only receives its org's monitors. Platform admins
manage shared regions and agents in the admin panel or with the CLI,
which gains 'api admin grant|revoke'. The first user of a self-hosted
installation becomes a platform admin. Region lists show the org's own
regions first.

Closes #52
Refs #29

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Sebi merged commit 49707957d4 into main 2026-11-22 00:47:25 +00:00
Sebi deleted branch feat/org-agents 2026-11-22 00:47:27 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ZB-Server/uptimesebi#53