Commit Graph

449 Commits

Author SHA1 Message Date
Girish Ramakrishnan
2597402496 make build work across server restart
tmp files disappear on server restart
2026-02-14 19:37:14 +01:00
Girish Ramakrishnan
e9f96593c3 reorder functions for no-use-before-define 2026-02-14 16:34:34 +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
a9ae34b149 community: download iconUrl
also rename existing db field appStoreIcon to packageIcon
2026-02-06 19:13:55 +01:00
Johannes Zellner
a7929e142f Build local image for updates in apptask 2026-01-27 22:01:18 +01:00
Johannes Zellner
fd0d65b8ce Keep the app source archive with the app instance data dir 2026-01-27 22:01:18 +01:00
Johannes Zellner
ef2a94c2c8 use local/id:version-ts as docker image tag for locally built apps 2026-01-27 22:01:18 +01:00
Johannes Zellner
b43daf2f08 Use the uploaded app source tarball to build a local docker image 2026-01-27 22:01:18 +01:00
Girish Ramakrishnan
5bd6001f95 boxerror: details is not a subobject 2025-10-17 20:42:19 +02:00
Girish Ramakrishnan
5157789774 backups: add per site enabledForUpdates flag
previously, we had a singleton 'main' flag to indicate a site can
be used for updates. with this new approach, we can get rid of the
'primary' concept. each site can be used for updates or not.
2025-09-22 18:03:01 +02:00
Girish Ramakrishnan
c5b7264f1a rename backupTargets to backupSites 2025-09-12 10:32:37 +02:00
Girish Ramakrishnan
3b38440385 apptask: delete app dir files when restoring
also, better deleteAppDir logs
2025-08-22 19:37:50 +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
1d1197e18a restore: use PENDING_RESTORE instead of PENDING_IMPORT 2025-08-05 12:46:50 +02:00
Girish Ramakrishnan
36ab052dda restore: import with the latest backup on cloudron restore
in previous versions, the single backup target was replaced during
restore. we cannot do this anymore with multiple backup targets.

during cloudron restore, a pseudo target is created and all the apps
are restored using this backup target.
2025-08-04 23:24:06 +02:00
Girish Ramakrishnan
ead6d9c7d3 Fix app import 2025-08-02 20:42:12 +02:00
Girish Ramakrishnan
a01e1bad0f backuptarget: pseudo target for import and restore 2025-08-02 00:06:47 +02:00
Girish Ramakrishnan
a1a683ec56 import: use inPlace flag 2025-08-01 13:22:12 +02:00
Girish Ramakrishnan
d81fa897ad apptask: use primary target during update 2025-07-25 14:32:22 +02:00
Girish Ramakrishnan
931311f11f rename backups to backuptargets 2025-07-24 18:54:10 +02:00
Girish Ramakrishnan
e7799fef1c appstore: fail properly for non-200 when downloading icon 2025-07-21 12:11:26 +02:00
Girish Ramakrishnan
0fa281083e apps: backup is not a state anymore
this is launched as a separate task
2025-07-18 14:14:54 +02:00
Girish Ramakrishnan
989d843fcb shell: make shell.sudo promise based and waitable 2025-07-16 22:04:24 +02:00
Girish Ramakrishnan
313256adff use @cloudron/manifest-format 2025-07-10 11:17:04 +02:00
Girish Ramakrishnan
19c9d7d59d updateInfo: move updateInfo into apps table
this has many advantages:
* easy to deliver the updateInfo via the apps object
* after updating, the task can clear it
* when apps are deleted, the info is automatically gone

otherwise, it's a mess of deps between apps/updater/apptask/rest routes

box update info is still in a file
2025-06-26 15:47:15 +02:00
Girish Ramakrishnan
39cbfb84ae refactor: move moveDataDir into services 2025-06-14 21:18:56 +02:00
Girish Ramakrishnan
73a56830b0 apps: do not start redis when app is stopped
stopped apps stop the container and the services. a good reason to
not delete them is to keep the image around and it's quick to start up again.

only update is not allowed during the app is stopped (because the start.sh
cannot be run).

all other operations like cpu/memory/device/service changes/data dir/location change
are all allowed.
2025-06-14 21:03:10 +02:00
Girish Ramakrishnan
7744568eb8 apptask: rename command functions 2025-06-11 14:19:31 +02:00
Girish Ramakrishnan
dd5e4adc73 replace underscore with our own
we only need like 5 simple functions
2025-02-13 14:14:34 +01:00
Girish Ramakrishnan
6b7edbd552 docker: fallback to quay if docker hub does not work 2024-12-14 15:22:12 +01:00
Girish Ramakrishnan
65f507bc75 clone: read custom icon from downloaded backup
the backups table does not have icon to save space. only the
archives table has it for the moment.
2024-12-10 22:47:21 +01:00
Girish Ramakrishnan
61341b8380 boxerror: always pass second error string 2024-10-30 17:32:12 +01:00
Girish Ramakrishnan
a32b567eb1 boxerror: remove unused override 2024-10-30 15:43:53 +01:00
Girish Ramakrishnan
a9e1d7641d shell: make require take a tag 2024-10-14 21:08:32 +02:00
Johannes Zellner
1b810ec74f Only add unchecked checklist items on fresh installs for the moment 2024-09-16 13:46:19 +02:00
Johannes Zellner
13d8db3daa For the moment new checklist items on update are acknowledged 2024-09-07 09:37:39 +02:00
Girish Ramakrishnan
dca548b8a0 apptask: better progress message 2024-08-26 17:26:23 +02:00
Girish Ramakrishnan
01deb4d285 update: updateConfig can be missing values, selectively update db 2024-07-17 08:58:43 +02:00
Girish Ramakrishnan
9bf240d83b update: handle change in secondary domains and multiDomain flag 2024-07-16 10:32:31 +02:00
Girish Ramakrishnan
dd9e6e63ad apptask: only delete image if it is different 2024-07-08 12:59:34 +02:00
Girish Ramakrishnan
d9b478cf1f rename setupStorage to setupManagedStorage 2024-06-25 13:06:40 +02:00
Johannes Zellner
20396a8c7d Adjust checklist item api to support audits trail 2024-06-24 19:09:03 +02:00
Girish Ramakrishnan
f386c326e2 apptask: only move app uses localstorage addon 2024-06-06 16:26:02 +02:00
Girish Ramakrishnan
3b26f6f5ea use optional chaining 2024-06-06 15:19:19 +02:00
Girish Ramakrishnan
52701e1173 add note 2024-06-06 15:16:04 +02:00
Girish Ramakrishnan
4fac0cb535 const fixes 2024-06-06 11:33:42 +02:00
Johannes Zellner
4516b0c57c Do not return but continue in a loop 2024-04-19 14:29:41 +02:00
Johannes Zellner
16521d5434 Fix updateChecklist usage 2024-04-19 12:15:13 +02:00
Johannes Zellner
7d6636bb54 Only add checklist items if they apply due to sso state 2024-04-18 16:05:38 +02:00