Rebrand: Sentry -> Cairn OBS
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.
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
func cmdDashboards(args []string, stdout, stderr io.Writer) int {
|
||||
if len(args) == 0 {
|
||||
fmt.Fprintln(stderr, "cairnobsctl dashboards: expected a subcommand (list, get, apply, permissions)")
|
||||
return 1
|
||||
}
|
||||
apiURL, rest := extractAPIFlag(args[1:], os.Getenv)
|
||||
token := resolveToken(os.Getenv)
|
||||
|
||||
switch args[0] {
|
||||
case "list":
|
||||
return httpGetJSON(apiURL, "/dashboards", token, stdout, stderr)
|
||||
case "get":
|
||||
if len(rest) == 0 {
|
||||
fmt.Fprintln(stderr, "cairnobsctl dashboards get: missing dashboard id")
|
||||
return 1
|
||||
}
|
||||
return httpGetJSON(apiURL, "/dashboards/"+rest[0], token, stdout, stderr)
|
||||
case "apply":
|
||||
if len(rest) == 0 {
|
||||
fmt.Fprintln(stderr, "cairnobsctl dashboards apply: missing file path")
|
||||
return 1
|
||||
}
|
||||
// The import endpoint consumes exactly the shape GET
|
||||
// /dashboards/{id}/export produces and the web UI's Export JSON
|
||||
// button downloads -- one JSON contract, three call sites.
|
||||
return httpPostFileJSON(apiURL, "/dashboards/import", token, rest[0], stdout, stderr)
|
||||
case "permissions":
|
||||
if len(rest) == 0 {
|
||||
fmt.Fprintln(stderr, "cairnobsctl dashboards permissions: expected a subcommand (list, grant, revoke)")
|
||||
return 1
|
||||
}
|
||||
return cmdDashboardsPermissions(rest, apiURL, token, stdout, stderr)
|
||||
default:
|
||||
fmt.Fprintf(stderr, "cairnobsctl dashboards: unknown subcommand %q (want list, get, apply, permissions)\n", args[0])
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
// cmdDashboardsPermissions is api/dashboards.PermissionStore's CLI
|
||||
// surface -- PUT/DELETE /dashboards/{id}/permissions/{userId} existed
|
||||
// with no caller but Go tests and curl until now (see
|
||||
// /docs/phase-4-runbook.md's "Known gaps"). Kept as dashboards'
|
||||
// own sub-subcommand rather than a flat cairnobsctl command (like
|
||||
// "cairnobsctl dashboard-permissions grant ...") since a grant only ever
|
||||
// makes sense in the context of one specific dashboard -- args[0]
|
||||
// selects list/grant/revoke.
|
||||
func cmdDashboardsPermissions(args []string, apiURL, token string, stdout, stderr io.Writer) int {
|
||||
sub, rest := args[0], args[1:]
|
||||
switch sub {
|
||||
case "list":
|
||||
if len(rest) == 0 {
|
||||
fmt.Fprintln(stderr, "cairnobsctl dashboards permissions list: missing dashboard id")
|
||||
return 1
|
||||
}
|
||||
return httpGetJSON(apiURL, "/dashboards/"+rest[0]+"/permissions", token, stdout, stderr)
|
||||
case "grant":
|
||||
if len(rest) < 3 {
|
||||
fmt.Fprintln(stderr, "cairnobsctl dashboards permissions grant: usage: grant <dashboard-id> <user-id> <viewer|editor>")
|
||||
return 1
|
||||
}
|
||||
dashboardID, userID, role := rest[0], rest[1], rest[2]
|
||||
// Mirrors api/dashboards.validGrantRole -- Admin/Owner already
|
||||
// have tenant-wide dashboard access, so a resource-level grant
|
||||
// only ever raises someone as high as Editor; the server
|
||||
// rejects anything else too, this just fails faster/locally.
|
||||
if role != "viewer" && role != "editor" {
|
||||
fmt.Fprintf(stderr, "cairnobsctl dashboards permissions grant: role must be \"viewer\" or \"editor\", got %q\n", role)
|
||||
return 1
|
||||
}
|
||||
body := fmt.Sprintf(`{"role":%q}`, role)
|
||||
path := "/dashboards/" + dashboardID + "/permissions/" + userID
|
||||
return httpMutateNoBody(http.MethodPut, apiURL, path, token, body, "granted", stdout, stderr)
|
||||
case "revoke":
|
||||
if len(rest) < 2 {
|
||||
fmt.Fprintln(stderr, "cairnobsctl dashboards permissions revoke: usage: revoke <dashboard-id> <user-id>")
|
||||
return 1
|
||||
}
|
||||
dashboardID, userID := rest[0], rest[1]
|
||||
path := "/dashboards/" + dashboardID + "/permissions/" + userID
|
||||
return httpMutateNoBody(http.MethodDelete, apiURL, path, token, "", "revoked", stdout, stderr)
|
||||
default:
|
||||
fmt.Fprintf(stderr, "cairnobsctl dashboards permissions: unknown subcommand %q (want list, grant, revoke)\n", sub)
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
// extractAPIFlag pulls an optional --api <url> out of args, resolving
|
||||
// the default the same way parsePingArgs/parseQueryArgs do, and returns
|
||||
// the remaining positional args. Shared by dashboards and alerts since
|
||||
// both take an optional --api/--alerting-api override the same way.
|
||||
func extractAPIFlag(args []string, env func(string) string) (apiURL string, rest []string) {
|
||||
apiURL = resolveAPIURL(env)
|
||||
for i := 0; i < len(args); i++ {
|
||||
if args[i] == "--api" && i+1 < len(args) {
|
||||
apiURL = args[i+1]
|
||||
i++
|
||||
continue
|
||||
}
|
||||
rest = append(rest, args[i])
|
||||
}
|
||||
return apiURL, rest
|
||||
}
|
||||
Reference in New Issue
Block a user