Girish Ramakrishnan
f12b4faf34
lint
2026-03-12 23:23:23 +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
12177446a2
backupcleaner: remove cleanupSnapshotSuperfluous
...
this removes the workaround for the rsync bug to make integrity
checks work. see ec15f29e40 and
2c12bee79b
2026-03-12 08:07:25 +05:30
Girish Ramakrishnan
7c6a783fc8
tasks: fix progress percents
...
mostly rebalancing the percents
2026-03-04 16:37:34 +05:30
Girish Ramakrishnan
ec15f29e40
syncer: clean up superfluous files
2026-03-04 14:00:54 +05:30
Girish Ramakrishnan
b5a1554631
Fix various linter errors
2026-02-15 19:37:30 +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
9773c02e7d
backupcleaner: remove integrity information
2025-12-08 19:19:23 +01:00
Girish Ramakrishnan
e106dcd76a
storage: pass limits object to backend
2025-11-14 13:18:21 +01:00
Girish Ramakrishnan
cb30a57a59
backupcleaner: backupSite -> site
2025-11-14 13:10:27 +01:00
Girish Ramakrishnan
fb04f78112
backupcleaner: fix listing of backups by site
2025-10-21 13:56:08 +02:00
Girish Ramakrishnan
e93898d2ec
typo that broke encryption
2025-10-07 17:42:51 +02:00
Girish Ramakrishnan
68dd1fbedb
rename function to listByTypePaged
2025-10-07 12:07:46 +02:00
Girish Ramakrishnan
c5b7264f1a
rename backupTargets to backupSites
2025-09-12 10:32:37 +02:00
Girish Ramakrishnan
19682ec21b
tgz: integrity check
2025-08-15 21:23:39 +05:30
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
c935744f4c
backups: root ~~canal~~ path surgery
...
remove rootPath and getBackupFilePath from the backup target and
make this backend specific.
2025-08-02 10:15:34 +02:00
Girish Ramakrishnan
7192439b2c
no need for format specific getBackupFilePath
2025-08-01 20:49:11 +02:00
Girish Ramakrishnan
ea419509f1
backups: add setup/teardown
...
1. add setup, teardown hooks
2. move the managed mount setup and teardown to filesystem backend
3. remove this vague storage.js
we should convert storageApi into a real object, so we don't have to
keep passing apiConfig around
2025-08-01 15:36:25 +02:00
Girish Ramakrishnan
ae3a34287a
backup target: create snapshot and cache files per target
...
snapshot file tracks the snapshot directory. when app gets deleted,
the cleaner will remove the upstream snapshot directory when it runs.
cache files are used in rsync logic to track what was uploading into
snapshot in the previous run without needing to rescan upstream.
2025-07-30 11:44:42 +02:00
Girish Ramakrishnan
62017b3ff5
backup: rename back backuplisting.js to backups.js
...
this was a transitional rename till I figured out how to split
it in backuptargets.js
2025-07-25 01:37:19 +02:00
Girish Ramakrishnan
3aafbd2ccb
backups: add backup multiple targets
2025-07-25 01:30:27 +02:00
Girish Ramakrishnan
931311f11f
rename backups to backuptargets
2025-07-24 18:54:10 +02:00
Girish Ramakrishnan
5e456f378b
backups: split listing and targets
2025-07-24 18:21:48 +02:00
Girish Ramakrishnan
bf315258c5
backups: add target foreign key to backups table
...
format is part of the backup target
in the future, if we want per-app format or schedule, we can add this
separately to the apps table itself. the full box backup can ignore
apps with a set backup target and use the latest backup (like an errored app).
the nice thing is restore will work correctly.
2025-07-24 17:32:16 +02:00
Johannes Zellner
df408505e0
Ensure we include a much higher backups count for cleanup
2025-04-15 14:06:29 +02:00
Girish Ramakrishnan
cb6d531300
storage: automatically abort old multipart uploads in s3
2025-02-13 11:09:15 +01:00
Girish Ramakrishnan
490840b71d
archives: use separate table
...
Cleaner to separate things from the backups table.
* icon, appConfig, appStoreIcon etc are only valid for archives
* older version cloudron does not have appConfig in backups table (so it
cannot be an archive entry)
2024-12-10 10:36:44 +01:00
Girish Ramakrishnan
147e014205
backup: add archive flag
2024-12-09 16:25:31 +01:00
Girish Ramakrishnan
6742cdf373
backups: remount remote if not mounted before a backup
2024-09-09 18:15:49 +02:00
Girish Ramakrishnan
ea72cef7f9
storage: remove getProviderStatus
2024-09-09 17:36:51 +02:00
Girish Ramakrishnan
9704eefc21
backupcleaner: do not remove the backup in progress
...
the backup cleaner erroneously removes any "creating" state backups.
backups that are stuck are cleaned up elsewhere already (in the
backup retention logic with discardReason of "creating-too-long").
the missing backup logic is intended for any upstream lifecycle policies.
2024-08-15 15:53:31 +02:00
Girish Ramakrishnan
52cd52d83c
lint
2024-08-15 15:46:19 +02:00
Girish Ramakrishnan
5a3ffa20ce
backupcleaner: dump the retention
2023-09-05 08:48:48 +05:30
Girish Ramakrishnan
e73b75e4b5
settings: move backup settings
2023-08-04 11:54:12 +05:30
Girish Ramakrishnan
050a82039a
getBackupProviderStatus -> getProviderStatus
2023-07-15 11:00:45 +05:30
Girish Ramakrishnan
9cebde3005
backups: split config and policy
...
keeping them together makes the test/validation quite complicated.
for example, when policy is changed, we test the storage backends
part of #817
2023-07-13 11:07:06 +05:30
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
2759b6268e
backup cleaner: use object.assign instead
2023-01-31 11:46:46 +01:00
Girish Ramakrishnan
02b6aa93cb
backup cleaner: do not delete mail snapshot
2023-01-31 10:58:51 +01:00
Girish Ramakrishnan
ebd970d3f4
backup cleaner: better error messages
2023-01-31 10:56:37 +01:00
Girish Ramakrishnan
c3793da5bb
split checkPrecondition so it can be used in cleaner as well
2022-10-02 17:41:21 +02:00
Girish Ramakrishnan
e2c6672a5c
better wording
2022-07-02 17:16:47 +05:30
Johannes Zellner
5c50534e21
Improve backup cleanup progress message
2022-07-01 14:18:50 +02:00
Girish Ramakrishnan
7123ec433c
split up backupformat logic into separate files
2022-04-28 19:10:57 -07:00
Girish Ramakrishnan
685bda35b9
storage: make remove and removeDir async
2022-04-14 16:16:20 -05:00
Girish Ramakrishnan
d54c03f0a0
storage: make exists async
2022-04-14 12:24:34 -05:00
Girish Ramakrishnan
0280c2baba
keep the backup if preserveSecs is -1
2022-04-05 11:08:38 -07:00