Commit Graph
37 Commits
Author SHA1 Message Date
moebiusbandandClaude Opus 5 ecb1ba2bbe feat(fleet): add service type enum and infra scope
Replace the free-form service_type string with a ServiceType enum (ccms,
ccmc, ccb, cces, ccsa, ccnc, ccem). The short code is the canonical value
stored in the DB, the config-tree directory name and a NATS discovery
subject token; Description() gives the human-readable name.

Add a second scope alongside per-node agents: ScopeInfra covers
cluster-independent monitoring infrastructure services, which are
identified by (hostname, service_type) and carry an empty cluster.
InfraRegistry is the ScopeInfra sibling of Registry and shares the same
table, state machine and config-revision handshake. It deliberately
exposes no StartSweep: MarkStale ages rows by last_heartbeat regardless
of scope, so a single sweep goroutine per process covers both scopes.

On the repository side ServiceDB gains a Scope column and the two
queries the discovery publisher and infra enumeration need, ListActive()
and ListByScope(). ResetConnection() now also resets the fleet
repository singleton so tests get a fresh handle.

Migration 13 is edited in place rather than superseded by a new
migration: the service table is unreleased, so no existing deployment
has it yet.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 08:06:50 +02:00
moebiusband 5f94ae3b68 Initial template for registration service 2026-07-24 07:02:09 +02:00
moebiusbandandClaude Opus 4.8 2b01b57495 feat: replace gorilla/sessions with alexedwards/scs/v2
Browser sessions are now server-side, stored in the SQLite database via
scs/sqlite3store (new `sessions` table, DB migration to version 12) instead
of gorilla/sessions client-side cookie storage. Only an opaque random token
is kept in the cookie; session data lives server-side and survives restarts.

Session middleware is wired as a hybrid to avoid buffering large responses:
scs.LoadAndSave on the login/logout write paths, and a non-buffering
read-only LoadSession middleware on the secured/config/frontend read paths
so the large GraphQL /query responses stream unbuffered. JWT-only APIs
(/api, /userapi, /api/metricstore) and static files are left unwrapped.

The session cookie Secure flag is now derived from the server config (set
when cc-backend terminates TLS itself); previously it was effectively never
set. The SESSION_KEY env var is removed as server-side tokens need no
signing secret. The dormant Bearer-JWT branch in the frontend urql client
is removed; the web UI authenticates GraphQL via the session cookie.

Closes #558

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: b51075f43cc7
2026-06-17 07:54:26 +02:00
moebiusband e83bd2babd Consolidate migrations
Entire-Checkpoint: a3dba4105838
2026-03-13 17:14:13 +01:00
moebiusbandandClaude Opus 4.6 d586fe4b43 Optimize usage dashboard: partial indexes, request cache, parallel histograms
- Add migration 14: partial covering indexes WHERE job_state='running'
  for user/project/subcluster groupings (tiny B-tree vs full table)
- Inline literal state value in BuildWhereClause so SQLite matches
  partial indexes instead of parameterized placeholders
- Add per-request statsGroupCache (sync.Once per filter+groupBy key)
  so identical grouped stats queries execute only once per GQL operation
- Parallelize 4 histogram queries in AddHistograms using errgroup
- Consolidate frontend from 6 GQL aliases to 2, sort+slice top-10
  client-side via $derived

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 5b26a6e5ff10
2026-03-13 14:31:37 +01:00
moebiusbandandClaude Opus 4.6 dd3e5427f4 Add covering indexes for status/dashboard queries (migration 13)
Adds composite covering indexes on (cluster, job_state, <group_col>, ...)
for user, project, and subcluster groupings to enable index-only scans
for status views. Drops subsumed 3-column indexes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 3d8def28e96e
2026-03-13 13:12:54 +01:00
moebiusband 8e86e8720d Make stats query selective. Add stats index. Add paging to user list.
Entire-Checkpoint: d42431eee30d
2026-03-12 20:16:55 +01:00
Christoph Kluge 972b14033a add db migration 11, optimizing index count 2026-03-11 16:07:29 +01:00
moebiusband 8f0bb907ff Improve documentation and add more tests 2026-01-15 06:41:23 +01:00
moebiusband 8576ae458d Switch to cc-lib v2 2025-12-24 09:24:18 +01:00
moebiusband 1cd4a57bd3 Remove support for mysql/mariadb 2025-12-20 11:13:41 +01:00
moebiusband f4b00e9de1 Use Info instead of warn loglevel for database file missing msg 2025-12-17 08:38:00 +01:00
moebiusband 40398497c2 Update Node table code. Add simple unit test 2025-10-16 12:54:16 +02:00
moebiusband 639e1b9c6d Port to cc-lib. Extend legal header. 2025-06-30 12:06:35 +02:00
moebiusband 4dc0da5099 Add node table schema 2025-06-02 12:07:01 +02:00
moebiusband eab7961a83 Introduce caching table for faster job inserts
Fixes #392
2025-05-16 17:32:19 +02:00
Christoph Kluge bd0cc69668 Review fatalf log calls and messages 2025-02-27 18:10:04 +01:00
moebiusband 35bd7739c6 fix: Replace reserved keywords in database schemas
Port migration to mariadb
2024-11-21 15:02:30 +01:00
moebiusband 786770f56a Start to convert to new footprint layout 2024-06-28 16:48:10 +02:00
moebiusband fb8bbea99d Remove year in copyright notice 2024-04-11 23:04:30 +02:00
moebiusband 06d01962a6 feat: Allow to revert db to previous version 2024-03-08 11:28:26 +01:00
moebiusband 2c2c1accb5 Allow up and down migration of database 2024-03-08 10:58:45 +01:00
moebiusband 105b7eabf0 Add migration and introduce dirty flag handling 2024-03-08 10:47:32 +01:00
moebiusband dd80d5af9e Change config value datatype
Fixes #167
2023-06-29 14:55:38 +02:00
moebiusband 3828c138b8 Add init flag 2023-06-28 12:41:27 +02:00
moebiusband 34050c8ce0 Fix argument dashes 2023-06-27 14:30:09 +02:00
moebiusband d1e3e06b10 Add insert timestamp to tag, jobtag
Fixes #43
2023-06-27 09:41:06 +02:00
moebiusband e444b83149 Fix errors 2023-06-05 16:07:01 +02:00
moebiusband d9b18d1763 Cleanup
Use external cc-units
Lint code
Fix import tests
2023-05-04 15:34:36 +02:00
Jan Eitzinger 500ae29d25 Synchronize DB Schema with json schema
Rework tests
2023-04-21 12:59:27 +02:00
Jan Eitzinger 10f4e09562 Set all versions and print in version flag 2023-04-12 10:43:46 +02:00
Christoph Kluge df44bd9621 Merge branch 'master' into 40_45_82_update_roles 2023-02-28 11:18:46 +01:00
moebiusband 89b1d8f7da Treat error no change as non fatal 2023-02-25 08:26:56 +01:00
Christoph Kluge acbef39045 Fix header, add migration for user.projects column 2023-02-21 17:33:27 +01:00
moebiusband 63f8555af7 Add migration support for mysql 2023-02-21 14:45:59 +01:00
moebiusband 42d3318125 Add documentation in README 2023-02-21 13:50:15 +01:00
moebiusband 8ffb562d6b Introduce db migration support 2023-02-21 10:57:22 +01:00