Commit Graph
100 Commits
Author SHA1 Message Date
moebiusband 5f94ae3b68 Initial template for registration service 2026-07-24 07:02:09 +02:00
moebiusbandandClaude Opus 4.8 44a4b279bb chore: remove Entire.io git integration
Remove all Entire.io tool artifacts: the .entire/ config directory, the
.claude/settings.json hooks that invoked `entire hooks claude-code ...`,
and a stray plan dump left in the repo root. Also removed the Entire CLI
git hooks (commit-msg, post-commit, pre-push, prepare-commit-msg).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 10:26:03 +02:00
moebiusbandandClaude Opus 4.8 411bc9b317 feat(web): make footer legal links configurable
Add a "main.footer-links" config option so the footer Imprint and
Privacy Policy links can point at internal pages (default) or external
URLs. External http(s) targets open in a new tab; empty/unset values
fall back to the built-in /imprint and /privacy routes, keeping the
existing ./var/*.tmpl override mechanism intact.

Closes #517

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: c5dca72c848f
2026-06-17 17:29:50 +02:00
moebiusband 3562bfa3aa Rewording of init README 2026-06-17 15:24:13 +02:00
moebiusbandandClaude Opus 4.8 83d04dff17 feat(auth): replace .env/godotenv secret handling with config-based secrets
Secrets (JWT keys, LDAP sync password, OIDC client id/secret, cross-login
keys) are now configured directly in config.json under the auth section
where they are used. Each secret can still be supplied via its existing
environment variable, which takes precedence over the config value.

The godotenv dependency, the .env file, configs/env-template.txt and the
loadEnvironment() bootstrap step are removed. -init now writes the demo
JWT keys into config.json instead of a .env file.

Closes #283

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 3a7cb814c53f
2026-06-17 12:28:17 +02:00
moebiusband b7f597bb7d Update entire config 2026-06-17 07:58:29 +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 9c6075ebb5 Update README to reflect main branch naming 2026-06-07 08:18:46 +02:00
moebiusband af7528c8b2 Update CLAUDE.md
Entire-Checkpoint: 306db138cb4c
2026-06-07 08:16:10 +02:00
moebiusband 01fb4d53f1 Fix broken link in README 2026-06-07 08:12:25 +02:00
moebiusbandandClaude Opus 4.8 1b72b0b5ad Fix critical/severe issues in init, startup and shutdown
- auth: do not abort the server when authentication is disabled. auth.Init
  is now always called; with disable-authentication it sets up an ephemeral
  session store (SESSION_KEY not required) and registers no authenticators,
  so the unconditional auth.GetAuthInstance() callers (server init,
  api.New()) always get a valid instance.
- main: run the graceful-shutdown sequence on the startup-error path. runServer
  derives a cancelable context and, on a server-start failure, cancels it and
  waits so the metricstore final checkpoint / WAL rotation, archiver flush and
  taskmanager shutdown actually run before exit.
- server: log the :80 HTTP->HTTPS redirect listener error instead of dropping it.
- archiver: guard Shutdown against being called when Start never ran
  (avoids close(nil) panic / blocking on a nil workerDone).
- nats API: stop worker goroutines on shutdown via a stop channel + idempotent
  Shutdown(); workers and subscription callbacks select on stop and the
  channels are never closed, so no send-on-closed-channel can occur. Wired
  into Server.Shutdown after the NATS client is closed.
- metricstore: make Shutdown idempotent (nil shutdownFunc, early return) and
  release shutdownFuncMu before the checkpoint write.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 3c179f9caa8f
2026-06-05 10:16:28 +02:00
moebiusband 56ae1de011 Update ReleaseNotes
Entire-Checkpoint: 051ff3c0d253
2026-06-05 09:01:47 +02:00
moebiusband 8733497223 Fix bug that prevents WAL cleanup on shutdown
Entire-Checkpoint: 5b79628feea4
2026-06-05 08:39:49 +02:00
moebiusband 6cfa511348 Update release notes
Entire-Checkpoint: 14328c112325
2026-06-04 20:19:09 +02:00
moebiusband 3bef199cbe Regenerate GraphQL 2026-06-04 20:12:27 +02:00
moebiusbandandClaude Opus 4.8 16942f55a0 Fix medium-severity issues from follow-up security audit
Addresses the remaining medium findings from the second-pass audit:

- DoS hardening: bound GraphQL query cost with FixedComplexityLimit, and
  reject non-positive items-per-page / page values so uint64 conversion
  cannot underflow into an unbounded LIMIT/OFFSET. The -1 "load all"
  sentinel stays valid for dashboards; REST now returns 400 for bad input.

- Security headers: add X-Content-Type-Options, X-Frame-Options,
  Referrer-Policy and a conservative CSP (frame-ancestors/object-src/
  base-uri) that hardens against clickjacking and base-tag injection
  without restricting the self-hosted SPA's inline scripts.

- Stored XSS: render job.metaData.message as escaped text instead of
  {@html ...} in Job.root and JobFootprint, preserving line breaks via
  white-space: pre-wrap.

- SQL injection hardening: parameterize the tag-scope IN list and the
  manager project subquery in CountTags instead of interpolating
  user.Username / user.Projects (externally sourced via OIDC/LDAP).

- CSRF defense-in-depth: reject cross-site state-changing requests via
  Sec-Fetch-Site, failing open for non-browser clients, on top of the
  existing SameSite=Lax session cookie.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: de7d47a85c7c
2026-06-04 20:08:41 +02:00
moebiusbandandClaude Opus 4.8 6d86690c76 Fix critical issues from follow-up security audit
A second-pass audit surfaced three severe issues missed by the previous
review, each a sibling code path of a bug class that was only partially
fixed before:

- auth: JWT session login (jwtSession.go) registered its authenticator
  even when CROSS_LOGIN_JWT_HS512_KEY was unset, leaving an empty HMAC
  key. golang-jwt verifies any HS256/HS512 signature against an empty
  key, allowing unauthenticated admin token forgery. Init() now refuses
  to register without a key, with a defense-in-depth empty-key guard in
  the keyfunc.

- repository: metric names from GraphQL ([String!]) were interpolated
  raw into json_extract(footprint, "$.<name>") SQL. SQLite parses
  double-quoted strings as literals, enabling SQL injection by any
  authenticated user. Validate metric names against ^[a-zA-Z0-9_]+$ in
  jobsMetricStatisticsHistogram and buildFloatJSONCondition.

- metricstore: cluster/host line-protocol tags flowed unvalidated into
  path.Join(RootDir, cluster, host) for checkpoint/WAL files, allowing
  arbitrary file write outside the checkpoint root via NATS
  (unauthenticated) or POST /api/write. Reject path-traversal sequences
  in DecodeLine before the tags become path components.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: b57246993ec1
2026-06-04 19:07:20 +02:00
moebiusband 6f7e262f3f Fix issues after security audit
Entire-Checkpoint: bc18358a9343
2026-06-04 18:33:30 +02:00
moebiusband 58ead40112 Merge branch 'main' into release/v1.5 2026-06-04 17:56:41 +02:00
moebiusband 0020f63582 Rebuild Swagger 2026-06-04 17:56:32 +02:00
moebiusband 8bf5f67bb2 Update dependencies 2026-05-29 16:44:05 +02:00
moebiusband 77fdcddc26 Prepare Release 1.5.4
Entire-Checkpoint: 535c1737ceb2
2026-05-12 12:00:05 +02:00
moebiusband 6397f1eaae Merge branch 'release/v1.5' into feature/add_subcluster_filter 2026-04-24 11:55:28 +02:00
moebiusband 2ca3285ccd Upgrade dependencies 2026-04-24 09:09:11 +02:00
moebiusband 86bc14b610 Merge branch 'main' into release/v1.5 2026-04-24 09:01:35 +02:00
moebiusband e45b5f70e3 fix: Changes in frontend ui 2026-04-03 05:13:07 +02:00
moebiusband 573f7d144b Update ReleaseNotes
Entire-Checkpoint: cd686356ea80
2026-04-01 13:58:26 +02:00
moebiusband 43807ae12a feat: Also submit projects array via oidc token
Entire-Checkpoint: 2064482d97e1
2026-04-01 13:46:21 +02:00
moebiusband 31a8a11f1b fix: Always request oidc roles from token
Entire-Checkpoint: bfdbffd7aae0
2026-04-01 12:36:37 +02:00
moebiusband 84fe61b3e0 fix: allow all role changes on SyncUser and UpdateUser callback
Entire-Checkpoint: 496bace0120e
2026-04-01 11:09:50 +02:00
moebiusband 1f04e0a1ce fix: oidc role extraction
Entire-Checkpoint: bbe9ad3cf817
2026-04-01 11:03:19 +02:00
moebiusband 641dc0e3b8 Run gofumpt 2026-03-30 16:49:27 +02:00
moebiusband b734c1a92a And another update
Entire-Checkpoint: 9bb66d18af6d
2026-03-30 16:48:12 +02:00
moebiusband c5fe3c5cd9 Update golangci settings
Entire-Checkpoint: b9544ef2c54f
2026-03-30 16:46:30 +02:00
moebiusband e2910b18b3 Fix golangci config
Entire-Checkpoint: 1a908bd95cfa
2026-03-30 16:29:15 +02:00
moebiusband ed236ec539 Add Make targets for formatting and linting
Add configuration and document usage in README

Entire-Checkpoint: 53425877e242
2026-03-30 16:23:12 +02:00
moebiusband 82c514b11a Ease samesite cookie settings
Entire-Checkpoint: 2fe286e23a4a
2026-03-30 16:10:15 +02:00
moebiusband 66707bbf15 Update metricstore documentation
Entire-Checkpoint: 99f20c1edd90
2026-03-29 21:38:04 +02:00
moebiusbandandClaude Opus 4.6 fc47b12fed fix: Pause WAL writes during binary checkpoint to prevent message drops
WAL writes during checkpoint are redundant since the binary snapshot
captures all in-memory data. Pausing eliminates channel saturation
(1.4M+ dropped messages) caused by disk I/O contention between
checkpoint writes and WAL staging. Also removes direct WAL file
deletion in checkpoint workers that raced with the staging goroutine.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 34d698f40bac
2026-03-29 11:13:39 +02:00
moebiusbandandClaude Opus 4.6 937984d11f fix: WAL rotation skipped for all nodes due to non-blocking send on small channel
RotateWALFiles used a non-blocking send (select/default) on rotation
channels buffered at 64. With thousands of nodes and few shards, the
channel fills instantly and nearly all hosts are skipped, leaving WAL
files unrotated indefinitely.

Replace with a blocking send using a shared 2-minute deadline so the
checkpoint goroutine waits for the staging goroutine to drain the
channel instead of immediately giving up.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: a1ec897216fa
2026-03-28 06:55:45 +01:00
moebiusband 3d99aec185 fix: Log viewer auto-refresh
Entire-Checkpoint: 0fc6e5388e08
2026-03-28 06:45:03 +01:00
moebiusband 280289185a Add checkpointReader to ReleaseNotes
Entire-Checkpoint: ea34ae75e21a
2026-03-28 06:28:07 +01:00
moebiusband cc3d03bb5b fix: Unbound growth of wal files in case of checkpointing error
Entire-Checkpoint: 95a89a7127c5
2026-03-28 06:26:21 +01:00
moebiusband ac0a4cc39a Increase shutdown timeouts and WAL flush interval
Entire-Checkpoint: 94ee2fb97830
2026-03-27 09:56:34 +01:00
moebiusband 97d65a9e5c Fix bugs in WAL journal pipeline
Entire-Checkpoint: 8fe0de4e6ac2
2026-03-26 07:25:36 +01:00
moebiusband e759810051 Add shutdown timings. Do not drain WAL buffers on shutdown
Entire-Checkpoint: d4b497002f54
2026-03-26 07:02:37 +01:00
moebiusband b1884fda9d Prepare bug fix release 1.5.3
Entire-Checkpoint: 84d4ab77be71
2026-03-25 07:18:27 +01:00
moebiusband c267501a1b Reduve noise in tagger logging 2026-03-25 06:53:01 +01:00
moebiusband a550344f13 Increase server shutdown timeout
Entire-Checkpoint: cf3b472471bd
2026-03-25 06:15:55 +01:00
moebiusband 93a9d732a4 fix: Improve shutdown time
Entire-Checkpoint: a4d012e1edcf
2026-03-24 07:17:34 +01:00
moebiusband 6f7dda53ee Cleanup
Entire-Checkpoint: ed68d32218ac
2026-03-24 07:03:46 +01:00
moebiusband 0325d9e866 fix: Increase throughput for WAL writers
Entire-Checkpoint: ddd40d290c56
2026-03-24 06:53:12 +01:00
moebiusband 3d94b0bf79 Merge branch 'master' into hotfix 2026-03-23 19:14:16 +01:00
moebiusband 45f329e5fb feat: Add command line switch to trigger manual metricstore checkpoint cleanup
Entire-Checkpoint: 29b9d52db89c
2026-03-23 07:58:35 +01:00
moebiusband 192c94a78d fix: Prevent interruption of body lineprotocol parsing on locks
Entire-Checkpoint: ccda3b2ff4cb
2026-03-23 07:12:13 +01:00
moebiusband e41d1251ba fix: Continue on error
Entire-Checkpoint: 6000eb5a5bb8
2026-03-23 06:37:24 +01:00
moebiusband 586c902044 Restructure metricstore cleanup archiving to stay withinh 32k parquet-go limit
Entire-Checkpoint: 1660b8cf2571
2026-03-23 06:32:24 +01:00
moebiusband 01ec70baa8 Iterate over subCluster MetricConfig directly so that removed metrics are not included
Entire-Checkpoint: efb6f0a96069
2026-03-20 11:39:34 +01:00
moebiusband fb176c5afb Remove static linkage for helper tools 2026-03-20 09:34:49 +01:00
moebiusband 999d93efc3 Fix goreleaser config. Cleanup. 2026-03-20 09:19:13 +01:00
moebiusband 359962d166 Fix typo 2026-03-20 08:23:46 +01:00
moebiusband 60554896d5 Update ReleaseNote for upcoming release
Entire-Checkpoint: 30099a746fc7
2026-03-20 08:21:16 +01:00
moebiusband bf48389aeb Optimize sortby in stats queries
Entire-Checkpoint: 9b5b833472e1
2026-03-20 05:39:22 +01:00
moebiusband 22057ff281 Pass reqKey as CacheKey
Entire-Checkpoint: b95ef43221bb
2026-03-19 11:04:32 +01:00
moebiusbandandClaude Opus 4.6 09501df3c2 fix: reduce memory usage in parquet checkpoint archiver
Stream CheckpointFile trees directly to parquet rows instead of
materializing all rows in a giant intermediate slice. This eliminates
~1.9GB per host of redundant allocations (repeated string headers)
and removes the expensive sort on millions of 104-byte structs.

Key changes:
- Replace flattenCheckpointFile + sortParquetRows + WriteHostRows with
  streaming WriteCheckpointFile that walks the tree with sorted keys
- Reduce results channel buffer from len(hostEntries) to 2 for
  back-pressure (at most NumWorkers+2 results in flight)
- Workers send CheckpointFile trees instead of []ParquetMetricRow
- Write rows in small 1024-element batches via reusable buffer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: f31dc1847539
2026-03-18 17:32:16 +01:00
moebiusband 8b0881fb17 Exclude down nodes from HealthCheck
Entire-Checkpoint: 0c3347168c79
2026-03-18 11:20:12 +01:00
moebiusband c1d51959d5 Change dtermineState to enforce priority order
Make exception if node is idle + down, then final state is idle

Entire-Checkpoint: 92c797737df8
2026-03-18 10:57:06 +01:00
moebiusband 3328d2ca11 Update go version in CLAUDE.md 2026-03-18 10:37:32 +01:00
moebiusband 8f10eba771 Extend CLAUDE.md
Entire-Checkpoint: 17cdf997acff
2026-03-18 10:05:09 +01:00
moebiusband c449996559 Add context to log message
Entire-Checkpoint: 55d95cdef0d4
2026-03-18 09:43:41 +01:00
moebiusbandandClaude Opus 4.6 51ae2a5d10 Remove tracked .entire/metadata/ files from git
These conversation transcript files were committed before the gitignore
rule existed. They are now properly ignored via .entire/.gitignore.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 07:10:01 +01:00
moebiusband 6ebc9e88fa Add more context information to auth failed log
Entire-Checkpoint: 2187cd89cb78
2026-03-18 06:56:01 +01:00
moebiusband 8b132ed7f8 fix: Blocking ReceiveNats call
Entire-Checkpoint: 38a235c86ceb
2026-03-18 06:47:45 +01:00
moebiusband bf1a8a174e fix: Shard WAL consumer for higher throughput
Entire-Checkpoint: e583b7b11439
2026-03-18 06:32:14 +01:00
moebiusband 50aed595cf fix: metricstore NATS contention
Entire-Checkpoint: 7e68050cab59
2026-03-18 06:14:15 +01:00
moebiusband 33bc19c732 Upgrade cc-lib 2026-03-18 05:52:58 +01:00
moebiusband 045f81f985 Prepare release v1.5.2
Entire-Checkpoint: 9286f4c43ab5
2026-03-18 05:31:49 +01:00
moebiusband d46e6371fc Add log about checkpoint archiving
Entire-Checkpoint: bf29af79b268
2026-03-18 05:22:39 +01:00
moebiusband 02f82c2c0b fix: Prevent memory spikes in parquet writer for metricstore move policy
Entire-Checkpoint: 4a675b8352a2
2026-03-18 05:08:37 +01:00
moebiusband 3314b8e284 Ignore ErrNoRows error. Include calling function in log.
Entire-Checkpoint: 20746187d135
2026-03-16 20:09:44 +01:00
moebiusband 6855d62bf2 Make log in scanRow more descriptive. No log for common no rows error
Entire-Checkpoint: 858b34ef56b8
2026-03-16 20:03:27 +01:00
moebiusband 7f3eb443d9 Include calling function in error message
Entire-Checkpoint: a4948d0fe7a3
2026-03-16 15:42:38 +01:00
moebiusband bab6eb4c3a Convert Warn message on missing metrics to Debug level 2026-03-16 15:35:24 +01:00
moebiusband 09d0ba71d2 Provide idential nodestate functionality in NATS API
Entire-Checkpoint: 3a40b75edd68
2026-03-16 12:13:14 +01:00
moebiusband df93dbed63 Add busyTimeout config setting
Entire-Checkpoint: 81097a6c52a2
2026-03-16 11:30:21 +01:00
moebiusband e4f3fa9ba0 Wrap SyncJobs in transaction
Entire-Checkpoint: d4f6c79a8dc1
2026-03-16 11:25:49 +01:00
moebiusband 51517f8031 Reduce insert pressure in db. Increase sqlite timeout value
Entire-Checkpoint: a1e2931d4deb
2026-03-16 11:17:47 +01:00
moebiusband 0aad8f01c8 Upgrade cc-lib
Fixes panic in AddNodeScope

Entire-Checkpoint: afef27e07ec9
2026-03-16 08:55:56 +01:00
moebiusband 973ca87bd1 Extend known issues in ReleaseNotes 2026-03-15 07:02:54 +01:00
moebiusband 045311eec0 Prepare release 1.5.1
Entire-Checkpoint: baed7fbee099
2026-03-13 17:30:03 +01:00
moebiusband e38396a081 Upgrade dependencies. Rebuild GraphQL.
Entire-Checkpoint: f770853c9fa0
2026-03-13 17:22:34 +01:00
moebiusband e83bd2babd Consolidate migrations
Entire-Checkpoint: a3dba4105838
2026-03-13 17:14:13 +01:00
moebiusband f15f1452cc Inline jobstate literal in query
Entire-Checkpoint: 35f06df74b51
2026-03-13 15:16:07 +01:00
moebiusband df2a13def2 Merge branch 'hotfix' of github.com:ClusterCockpit/cc-backend into hotfix 2026-03-13 14:34:11 +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
moebiusband cbe46c3524 Merge branch 'hotfix' of github.com:ClusterCockpit/cc-backend into hotfix 2026-03-13 13:17:34 +01:00
moebiusbandandClaude Opus 4.6 0037d969b2 Consolidate UsageDash into single GraphQL query
Merge three separate queries (topJobsQuery, topNodesQuery, topAccsQuery)
into one topStatsQuery with 6 aliased jobsStatistics fields, reducing
3 HTTP round trips to 1 on the status dashboard.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: 40d806a3240c
2026-03-13 13:14:29 +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 39ab12784c Make checkpointInterval an option config option again.
Also applies small fixes

Entire-Checkpoint: c11d1a65fae4
2026-03-13 09:07:38 +01:00
moebiusbandandClaude Opus 4.6 b214e1755a Add buffered I/O to WAL writes and fix MemoryCap comment
WAL writes now go through bufio.Writer instead of raw syscalls per record,
reducing I/O overhead. Buffers are flushed on rotate, drain, and shutdown.
Fixed misleading MemoryCap comment ("Max bytes" → "Max memory in GB").

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Entire-Checkpoint: b38dc35e5334
2026-03-13 09:05:24 +01:00