Commit Graph

456 Commits

Author SHA1 Message Date
Girish Ramakrishnan f12b4faf34 lint 2026-03-12 23:23:23 +05:30
Girish Ramakrishnan ff49759f42 promise-retry: rename api to log 2026-03-12 23:11:16 +05:30
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 4bc0f44789 services: lazy start services / on demand services
services are now stopped when no app is using them.

on start up, services are always created and run. they are later
stopped when unused. it's this way to facilitate the upgrade code
path. the database meta files have to be upgraded even if no app is using them.
the other hook to stop unused services is at the end of an app task.

maybe mail container is a candidate for the future where all sending is no-op.
But give this is rare, it's not implemented.
2026-03-08 18:35:50 +05:30
Girish Ramakrishnan 7c6a783fc8 tasks: fix progress percents
mostly rebalancing the percents
2026-03-04 16:37:34 +05:30
Girish Ramakrishnan 812d471573 add backupCommand, restoreCommand, persistentDirs 2026-02-21 19:42:52 +01:00
Girish Ramakrishnan 4ed6fbbd74 eslint: add no-shadow 2026-02-18 08:18:37 +01:00
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