Commit Graph

59 Commits

Author SHA1 Message Date
Girish Ramakrishnan
01d0c738bc replace debug() with our custom logger
mostly we want trace() and log(). trace() can be enabled whenever
we want by flipping a flag and restarting box
2026-03-12 23:08:35 +05:30
Girish Ramakrishnan
336dee53cd metrics: pick last item in series
picking the first item for "max" is not correct
2026-03-10 22:25:15 +05:30
Girish Ramakrishnan
866b72d029 services: distinguish error state and idle state for stopped containers 2026-03-08 18:36:24 +05:30
Girish Ramakrishnan
b5a1554631 Fix various linter errors 2026-02-15 19:37:30 +01:00
Girish Ramakrishnan
36aa641cb9 migrate to "export default"
also, set no-use-before-define in linter
2026-02-14 15:43:24 +01:00
Girish Ramakrishnan
96dc79cfe6 Migrate codebase from CommonJS to ES Modules
- Convert all require()/module.exports to import/export across 260+ files
- Add "type": "module" to package.json to enable ESM by default
- Add migrations/package.json with "type": "commonjs" to keep db-migrate compatible
- Convert eslint.config.js to ESM with sourceType: "module"
- Replace __dirname/__filename with import.meta.dirname/import.meta.filename
- Replace require.main === module with process.argv[1] === import.meta.filename
- Remove 'use strict' directives (implicit in ESM)
- Convert dynamic require() in switch statements to static import lookup maps
  (dns.js, domains.js, backupformats.js, backupsites.js, network.js)
- Extract self-referencing exports.CONSTANT patterns into standalone const
  declarations (apps.js, services.js, locks.js, users.js, mail.js, etc.)
- Lazify SERVICES object in services.js to avoid circular dependency TDZ issues
- Add clearMailQueue() to mailer.js for ESM-safe queue clearing in tests
- Add _setMockApp() to ldapserver.js for ESM-safe test mocking
- Add _setMockResolve() wrapper to dig.js for ESM-safe DNS mocking in tests
- Convert backupupload.js to use dynamic imports so --check exits before
  loading the module graph (which requires BOX_ENV)
- Update check-install to use ESM import for infra_version.js
- Convert scripts/ (hotfix, release, remote_hotfix.js, find-unused-translations)
- All 1315 tests passing

Migration stats (AI-assisted using Cursor with Claude):
- Wall clock time: ~3-4 hours
- Assistant completions: ~80-100
- Estimated token usage: ~1-2M tokens

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-14 15:11:45 +01:00
Girish Ramakrishnan
2a3110cd3d network: detect default ipv6 interface when no ipv4 interface 2025-11-28 10:02:36 +01:00
Girish Ramakrishnan
de75ae5b9e collectd is gone 2025-11-24 13:50:07 +01:00
Girish Ramakrishnan
a55adf12db More robust root disk detection 2025-10-17 16:34:51 +02:00
Girish Ramakrishnan
41c00eda74 metrics: fix root device detection
the existing logic does not work for device like /dev/md1 (on the dedis)
2025-10-15 11:32:09 +02:00
Johannes Zellner
25d6ec157f Check for statsLine not blockDevice 2025-10-14 15:22:57 +02:00
Girish Ramakrishnan
548418ecfe graphs: show correct metrics when container stops 2025-10-06 23:05:49 +02:00
Girish Ramakrishnan
c5b7264f1a rename backupTargets to backupSites 2025-09-12 10:32:37 +02:00
Girish Ramakrishnan
12e073e8cf use node: prefix for requires
mostly because code is being autogenerated by all the AI stuff using
this prefix. it's also used in the stack trace.
2025-08-14 12:55:35 +05:30
Girish Ramakrishnan
a684fadf43 metrics: fix crash 2025-07-18 19:32:04 +02:00
Girish Ramakrishnan
6ac0cd421a use the @cloudron/superagent module 2025-07-10 10:56:05 +02:00
Girish Ramakrishnan
1a471a7c20 metrics: disable debugs 2025-07-09 19:09:05 +02:00
Girish Ramakrishnan
c73e24c3a2 metrics: can safely throw now 2025-07-08 18:08:57 +02:00
Girish Ramakrishnan
e3bec5039b fix crash 2025-07-08 18:07:19 +02:00
Girish Ramakrishnan
85d9c91e5e metrics: no need AbortController 2025-07-08 17:50:20 +02:00
Girish Ramakrishnan
0952b6d68f metrics: group the metrics when sending live stats
without this the tooltip doesn't work. it needs to have the same
consistent timestamps
2025-07-08 17:41:00 +02:00
Girish Ramakrishnan
6b2e98b9be metrics: fix up app graphs after api changes 2025-07-07 20:09:09 +02:00
Girish Ramakrishnan
4cf1739604 metrics: overlay app metrics over system metrics 2025-07-07 19:12:57 +02:00
Girish Ramakrishnan
369474a0bc metrics: add route to query app metrics with the system 2025-07-07 19:12:57 +02:00
Girish Ramakrishnan
2317c17b4b metrics: interval is not configurable, unnecessary 2025-07-04 23:20:38 +02:00
Girish Ramakrishnan
fb02bdb445 unify the metrics API 2025-07-04 22:58:35 +02:00
Girish Ramakrishnan
53d85ac7a2 metrics: set objectMode to avoid lots of JSON 2025-07-04 22:42:05 +02:00
Girish Ramakrishnan
f25534ff0f metrics: add comment 2025-07-04 22:36:57 +02:00
Girish Ramakrishnan
463369f283 metrics: various formatting issues 2025-07-04 21:53:25 +02:00
Girish Ramakrishnan
5fd86b781b metrics: use "/" instead of ps 2025-07-04 14:26:09 +02:00
Girish Ramakrishnan
0d28292cfb metrics: tooltip label 2025-07-04 13:18:23 +02:00
Girish Ramakrishnan
8bf9d38711 metrics: show legend with multiple datasets 2025-07-04 12:51:51 +02:00
Girish Ramakrishnan
82ea2cd86d metrics: store app metrics by appid and not container id 2025-07-04 10:05:07 +02:00
Girish Ramakrishnan
89c0d5763c metrics: fix crash if could not translate 2025-07-04 09:52:12 +02:00
Girish Ramakrishnan
813409a8fb graphs: directly stream docker stats
docker stats API caches the stat and reading it frequently gives back the same value.
this trips our "rate" code into thinking rate is 0.

one approach was to persist polling like we do now and ignore entries based on stats.read.
this works fine but the streaming approach seems better since we don't need to poll anymore.
2025-07-04 00:03:43 +02:00
Girish Ramakrishnan
9f35801f64 docker: add options to getStats 2025-07-03 23:56:03 +02:00
Girish Ramakrishnan
526f5efb78 metrics: fix nano to msecs conversion 2025-07-03 18:43:42 +02:00
Girish Ramakrishnan
b3071603d0 graphs: make top level div and clean the timer 2025-07-03 17:44:32 +02:00
Girish Ramakrishnan
6f358dd8ea lint 2025-07-03 17:11:23 +02:00
Girish Ramakrishnan
a6a715b8c2 apps: make app graphs use GraphItem 2025-07-03 16:39:18 +02:00
Girish Ramakrishnan
5d55e558fe metrics: no need to pass cpuCount 2025-07-03 10:28:50 +02:00
Girish Ramakrishnan
aa35099a4d metrics: fix crash 2025-07-02 12:54:13 +02:00
Girish Ramakrishnan
4a7aa032c2 system: add network and disk graph 2025-07-02 09:08:05 +02:00
Girish Ramakrishnan
a10d0e45c9 metrics: blockio and network collection for system 2025-07-01 16:29:16 +02:00
Girish Ramakrishnan
6d5671dd0e typo 2025-07-01 15:28:39 +02:00
Girish Ramakrishnan
a357f5a1b8 apps: add live metrics route 2025-07-01 12:23:38 +02:00
Girish Ramakrishnan
b5e2c628cd metrics: collect data via docker api instead of cli 2025-07-01 11:10:21 +02:00
Girish Ramakrishnan
6b8b69d324 metrics: rename functions 2025-07-01 11:10:21 +02:00
Girish Ramakrishnan
227da8dce4 test: remove double uninit of db 2025-06-19 10:24:17 +02:00
Girish Ramakrishnan
1289a6e14f graphs: fix memory graphs 2025-05-23 16:24:37 +02:00