Full rebrand across cosmetic branding, code identifiers, and infrastructure/data-plane naming, using the supplied Cairn OBS logo package. Cosmetic: favicon/logo swap (also closes a stale license-audit finding -- the old favicon was SvelteKit's unreplaced scaffold logo), new centered welcome landing page, larger/legible sidebar logo, page titles, CLAUDE.md/README/docs prose. Code identifiers: Go module path github.com/sentry/sentry -> github.com/cairnobs/cairnobs across all 13 modules and ~91 files (protoc regenerated); Rust crates sentry-agent/sentry-parser/sentry-search -> cairnobs-*; CLI sentryctl -> cairnobsctl; Terraform provider fully renamed (sentry_dashboard etc. -> cairnobs_dashboard, provider type, env vars); every session/auth cookie name; agent config paths and Windows service identity. Deliberately preserved: the gRPC wire protocol's protobuf packages (sentry.logs.v1, sentry.agent.v1) and their Go import directory (proto/sentry/...) -- renaming the wire-level package would break every currently-deployed agent binary (confirmed two real hosts, including mail.inbuxa.com, are actively streaming through this exact contract) until rebuilt and redeployed in lockstep with an ingest cutover. Only the Go module path wrapping the generated code changes. Infrastructure: every docker-compose container name (root and three component-level compose files); the Helm chart (directory, Chart.yaml, named-template helpers, all templates, values.yaml image repos); Kubernetes Operator (CRD group sentry.io -> cairnobs.io, both CRD YAML files, Go identifiers, RBAC markers); the coupled enterprise/tenantcrd package. Caught and fixed real path-coupling bugs along the way: the Helm chart's search/ingest volume mounts and the dev-only-credential detection constant vs. docker-compose.yml's literal values had to move together or a security warning would have silently stopped firing. Data plane: Postgres database sentry_metadata -> cairnobs_metadata and role sentry -> cairnobs; ClickHouse database sentry -> cairnobs; Kafka topic sentry.logs.raw -> cairnobs.logs.raw and its consumer groups. Source-level defaults, docker-compose.yml, and every migrate.sh/ provision script default updated together; already-applied migration files left untouched per this repo's immutable-migration convention. Verified at every layer: all 13 Go modules build/vet/test clean, both Rust workspaces (agent, search) build/clippy/test clean, npm run check/ build clean, docker compose config validates on all four compose files. Live-verified against a real docker stack multiple times through this work, including a final fresh-volume run confirming the actual renamed Postgres database/role, ClickHouse database, and Kafka topic all work end to end with a real login and query, zero console errors.
83 lines
3.5 KiB
Markdown
83 lines
3.5 KiB
Markdown
# cairnobsctl
|
|
|
|
Cairn OBS's control CLI.
|
|
|
|
```sh
|
|
cairnobsctl ping # checks http://localhost:8080/healthz
|
|
cairnobsctl ping --api http://api.internal:8080
|
|
CAIRNOBSCTL_API_URL=http://api.internal:8080 cairnobsctl ping
|
|
```
|
|
|
|
Exits 0 and prints `ok` if `/api`'s `/healthz` responds 200; exits 1 with an
|
|
error on `stderr` otherwise.
|
|
|
|
```sh
|
|
cairnobsctl query 'service=api | where status>=500 | stats count by host'
|
|
cairnobsctl query 'SELECT * FROM logs LIMIT 10' --language sql
|
|
cairnobsctl query 'message:"connection refused"' --json
|
|
```
|
|
|
|
Quote the query in your shell — pipe syntax uses `|`, which your shell
|
|
interprets as an actual pipe if you don't. Hits the exact same `POST
|
|
/query` endpoint the web UI does (`internal/querylang` in `/api` does the
|
|
compiling; there's no separate query logic here to drift out of sync —
|
|
see `/docs/query-language-reference.md`). `--language` overrides
|
|
auto-detection, same optional override the HTTP API itself exposes.
|
|
Prints a table by default (stdlib `text/tabwriter`, no new dependency);
|
|
`--json` prints the raw `{columns, rows}` response instead.
|
|
|
|
```sh
|
|
cairnobsctl dashboards list
|
|
cairnobsctl dashboards get <id>
|
|
cairnobsctl dashboards apply dashboard.json # imports a dashboard exported via the web UI's "Export JSON" button
|
|
|
|
cairnobsctl dashboards permissions list <dashboard-id>
|
|
cairnobsctl dashboards permissions grant <dashboard-id> <user-id> viewer|editor
|
|
cairnobsctl dashboards permissions revoke <dashboard-id> <user-id>
|
|
|
|
cairnobsctl alerts list
|
|
cairnobsctl alerts get <id>
|
|
cairnobsctl alerts apply rule.json # creates a rule from a JSON file shaped like POST /rules's body
|
|
```
|
|
|
|
`dashboards permissions` is Phase 4's per-resource dashboard grant
|
|
(`api/dashboards.PermissionStore`) — additive-only, raises someone to
|
|
`viewer` or `editor` on one specific dashboard (Admin/Owner already have
|
|
tenant-wide access, so the server rejects any other role). On plain
|
|
`api` (no `enterprise-api`, no permission service wired in) every
|
|
`permissions` call fails with a 501 whose message says so explicitly —
|
|
that's the deployment telling you this feature isn't available, not a
|
|
CLI bug.
|
|
|
|
`dashboards` talks to `/api` (`--api`, same override as `query`/`ping`).
|
|
`alerts` talks to `/alerting`, a separate service with its own base URL
|
|
(`--alerting-api`, or `$CAIRNOBSCTL_ALERTING_API_URL`, default
|
|
`http://localhost:8081`) — see `/docs/phase-3-alerting-design.md`'s
|
|
component boundary for why alerting isn't just another `/api` route.
|
|
`apply` in both cases sends the file's JSON as-is to the corresponding
|
|
create/import endpoint — no reshaping, since the file's shape already
|
|
matches what the endpoint expects (the same JSON the web UI's export
|
|
button downloads, or the same shape `GET /rules/{id}` returns). This is
|
|
deliberately the seed of a future Terraform provider: one JSON contract,
|
|
multiple callers (web export, CLI apply, eventually a provider), not
|
|
three different formats to keep in sync.
|
|
|
|
No CLI framework (cobra/urfave-cli/etc.) — six commands split across a
|
|
few files (`cmd_ping.go`, `cmd_query.go`, `cmd_dashboards.go`,
|
|
`cmd_alerts.go`) is still boring enough not to need one; stdlib
|
|
`os.Args` handling plus a hand-rolled `switch` in `main.go` covers it.
|
|
Revisit once there's a real command tree (nested subcommands, nontrivial
|
|
flag parsing) to justify a dependency.
|
|
|
|
## Building & testing
|
|
|
|
```sh
|
|
go build ./...
|
|
go vet ./...
|
|
go test ./...
|
|
```
|
|
|
|
```sh
|
|
docker build -f Dockerfile -t cairnobsctl . # context is cli/, not the repo root
|
|
```
|