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
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
bba48f455e
use @connect-lastmile
2025-07-10 11:00:31 +02:00
Girish Ramakrishnan
639b7d9374
test: set req.resources earlier
2025-06-10 11:27:32 +02:00
Johannes Zellner
2e4bc5e218
Start using req.resources = { app, volume, ...} pattern
...
Reason was that req.app was clashing with expressjs v5 which
stores the main expressjs app object there
2025-06-10 11:02:43 +02:00
Girish Ramakrishnan
4ffff84540
test: fix dockerproxy test
2025-06-06 18:07:03 +02:00
Girish Ramakrishnan
74f4849144
req.connection.remoteAddress is deprecated
2025-01-29 10:35:21 +01:00
Girish Ramakrishnan
525e48ae59
json middleware is part of Express v4.16.0
2024-07-19 22:26:24 +02:00
Girish Ramakrishnan
bba1922120
dockerproxy: fix test
2024-06-08 22:26:34 +02:00
Girish Ramakrishnan
104997d77c
syslog: change it to unix domain socket
...
docker is using a extra udp port for every container. when there is
a lot of containers, a lot of random udp ports get used up. this causes
problems when installing apps that require contiguous port ranges
2024-03-21 18:59:08 +01:00
Girish Ramakrishnan
660260336c
dockerproxy: await on close
2024-01-23 12:38:57 +01:00
Girish Ramakrishnan
d45c433bc7
fix dockerproxy test
2023-12-04 00:11:11 +01:00
Girish Ramakrishnan
740c0fe318
dockerproxy: all volumes to be mounted in child containers
...
this will allow jupyterhub notebooks to access volumes
2023-11-27 23:06:11 +01:00
Girish Ramakrishnan
8e468788a9
dockerproxy: fix typo
2023-11-04 13:28:02 +01:00
Girish Ramakrishnan
9c78b2df9a
dockerproxy: lint
2023-10-01 12:12:02 +05:30
Girish Ramakrishnan
e6ba2a6e7a
replace usage of _.extend with Object.assign
2023-05-25 11:45:14 +02:00
Girish Ramakrishnan
c4f4f3e914
logs: use %o to format error
...
otherwise, they are printed as multi-line and this messes up tail+date formatting
2023-04-16 10:49:59 +02:00
Girish Ramakrishnan
354eff93b7
disable slowloris prevention: https://github.com/nodejs/node/issues/47421
2023-04-10 10:35:25 +02:00
Girish Ramakrishnan
05d7a7f496
constness
2022-04-14 17:50:41 -05:00
Girish Ramakrishnan
7709e155e0
more async'ification
2021-09-07 11:21:06 -07:00
Girish Ramakrishnan
6027397961
Add missing safe()
2021-08-31 08:37:16 -07:00
Girish Ramakrishnan
77f5cb183b
merge appdb.js into apps.js
2021-08-23 15:35:38 -07:00
Girish Ramakrishnan
442110a437
lint
2021-05-01 11:21:09 -07:00
Girish Ramakrishnan
1b307632ab
Use debug instead of console.* everywhere
...
No need to patch up console.* anymore
also removes supererror
2020-08-02 12:04:55 -07:00
Girish Ramakrishnan
f407ce734a
restrict the app to bind mount under /app/data only
...
rest have to be volumes
2020-03-29 13:57:45 -07:00
Girish Ramakrishnan
f813cfa8db
Listen only on the docker interface
2020-03-29 13:11:16 -07:00
Girish Ramakrishnan
d5880cb953
TODO block is obsolete
2020-03-29 13:10:19 -07:00
Johannes Zellner
38928d63d6
node's http server has a default timeout of 2min which is too short for build bot
2019-11-14 13:15:18 +01:00
Girish Ramakrishnan
bce1efb77c
Move AppsError to BoxError
2019-10-24 10:39:47 -07:00
Girish Ramakrishnan
ee9636b496
move use of TEST and CLOUDRON to constants
2019-07-26 10:13:20 -07:00
Girish Ramakrishnan
c32718b164
Make ldap and docker proxy port as constants
2019-07-25 16:08:54 -07:00
Girish Ramakrishnan
4a9b0e8db6
Remove all app containers before removing volume
...
If volume location changes, we re-create the volume. However, volume
can only be removed if all the containers using it are deleted. For
example, the scheduler might be running a container using it.
2019-01-17 23:56:31 -08:00
Girish Ramakrishnan
635557ca45
Fix failing tests
2019-01-04 10:56:56 -08:00
Girish Ramakrishnan
f338e015d5
Revert "Also allow docker in containers spawned by an authorized app"
...
This reverts commit 4f336a05fc .
This is not required by an app yet. Besides, it breaks tests
2018-08-20 20:10:16 -07:00
Girish Ramakrishnan
89cf8167e6
Make tests work
2018-08-20 20:10:14 -07:00
Johannes Zellner
d5194cfdc9
Remove nativeLogging docker addon support
...
Was only required for eclipse che
2018-08-20 15:22:10 +02:00
Johannes Zellner
eb07d3d543
Drop all custom network configs in docker proxy
2018-08-20 15:19:08 +02:00
Johannes Zellner
3640b0bd0e
Allow to override the logging backend for app like che
2018-08-17 15:30:37 +02:00
Johannes Zellner
4d4ce9b86e
Bare bones support of docker exec through the proxy
2018-08-17 15:30:23 +02:00
Johannes Zellner
2925e98d54
Make PUT requests through the docker proxy work
2018-08-17 12:33:46 +02:00
Johannes Zellner
dc3e3f5f4d
Ensure we pipe the parsed body again upstream to docker
2018-08-16 14:28:51 +02:00
Johannes Zellner
575e0cea33
Use syslog for containers created in apps
2018-08-16 11:37:08 +02:00
Girish Ramakrishnan
0bf3b45ddc
Fix bind mapping logic
2018-08-15 16:52:30 -07:00
Johannes Zellner
0522d1e3c4
Simply prefix all docker volume mounts with the app data dir
2018-08-15 18:00:51 +02:00
Johannes Zellner
12970bf50a
Add some debugs for volume rewriting
2018-08-15 16:51:10 +02:00
Johannes Zellner
4a739213bf
When creating a container the Labels are toplevel
2018-08-15 12:51:52 +02:00
Johannes Zellner
4f336a05fc
Also allow docker in containers spawned by an authorized app
2018-08-15 12:35:34 +02:00
Girish Ramakrishnan
c3dacba894
dockerproxy: rewrite labels and binds
2018-08-14 20:49:41 -07:00
Girish Ramakrishnan
f88c01eea6
dockerproxy: Add app authorization
2018-08-14 20:04:15 -07:00