Johannes Zellner
918c2f8587
Move to @cloudron/safetydance
2026-04-01 09:49:34 +02:00
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
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
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
72c494e9dc
backuptask: fix usage of upload API
2026-01-21 09:48:21 +01:00
Girish Ramakrishnan
e106dcd76a
storage: pass limits object to backend
2025-11-14 13:18:21 +01:00
Girish Ramakrishnan
b8f486d8e4
backuptask: fix crash when (old) stats object has no copy field
2025-11-13 14:42:44 +01:00
Johannes Zellner
8522802f85
Update translations
2025-10-27 08:48:24 +01:00
Girish Ramakrishnan
07732310c1
backuptask: track copy and upload statistics
2025-10-20 14:09:12 +02:00
Girish Ramakrishnan
854661e2d4
backuptask: print the upload statistics
2025-10-20 11:22:28 +02:00
Girish Ramakrishnan
72030ee8fc
backups: display mail backup stats
2025-10-16 14:51:33 +02:00
Girish Ramakrishnan
847cb91759
backuptask: fix crash when accessing stats of old backups
2025-10-16 12:32:32 +02:00
Girish Ramakrishnan
961959d361
add aggregated size to system backups
2025-10-10 13:14:49 +02:00
Girish Ramakrishnan
0fd056dff9
add note why the backupinfo is unencrypted
2025-10-09 09:04:22 +02:00
Girish Ramakrishnan
10cf8f1d0e
rsync: integrity fixes
2025-10-09 00:23:44 +02:00
Girish Ramakrishnan
67d95cda76
store integrity signature in hex
2025-10-08 22:35:39 +02:00
Girish Ramakrishnan
43e426ab9f
Revert "Add no-use-before-define linter rule"
...
This reverts commit fdcc5d68a2 .
Unfortunately, this requires us to move exports to the bottom.
This in turn causes circular dep issues and also access of
exports.GLOBAL_VAR in the global context
2025-10-08 21:17:52 +02:00
Girish Ramakrishnan
ddb7551b92
integrity: store signature as base64
2025-10-07 18:42:51 +02:00
Girish Ramakrishnan
e93898d2ec
typo that broke encryption
2025-10-07 17:42:51 +02:00
Girish Ramakrishnan
832eca2d9c
backup size: display stats correctly
2025-10-01 17:43:27 +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
4c3a8e1fd7
backup site: add contents
...
it is a json that can be one of the three:
* null - include everything
* include - only include these ids
* exclude - everything except these ids
2025-09-22 13:28:16 +02:00
Girish Ramakrishnan
c5b7264f1a
rename backupTargets to backupSites
2025-09-12 10:32:37 +02:00
Girish Ramakrishnan
31df40a841
storage: add copyDir
...
we changed listDir in c44863a9bb to list
a directory . this broke copy for files since a '/' is added when listing
the file.
2025-08-26 00:01:14 +02:00
Girish Ramakrishnan
cdda8649fc
backuptask: log the target id
2025-08-25 23:04:56 +02:00
Girish Ramakrishnan
19682ec21b
tgz: integrity check
2025-08-15 21:23:39 +05:30
Girish Ramakrishnan
b71e2957d3
backuptask: add progress message for backupinfo
2025-08-15 16:01:59 +05:30
Girish Ramakrishnan
e7fb444bb3
backuptask: save backupinfo in one place
2025-08-15 14:33:31 +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
d7b5d1f947
rename .checksum to .backupinfo
2025-08-13 21:29:41 +05:30
Girish Ramakrishnan
2e16dd983f
backups: stash the stats to the backups table
2025-08-12 20:21:54 +05:30
Girish Ramakrishnan
47fc9561ab
backups (tgz): save integrity information
...
we generate a signing key pair for each target. Initially, I had this
as global. We needed a route to return the public key and putting it
under backup target seemed natural. Since we delete the backups when
we delete a target, we lose all the signing hashes. So, it's fine to lose
the key pair on target delete.
2025-08-12 19:00:29 +05:30
Johannes Zellner
410d4a47ed
Fix typo
2025-08-03 21:05:46 +02:00
Girish Ramakrishnan
ead6d9c7d3
Fix app import
2025-08-02 20:42:12 +02:00
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
a01e1bad0f
backuptarget: pseudo target for import and restore
2025-08-02 00:06:47 +02:00
Girish Ramakrishnan
3cabbc1328
backupformat: getFileExtension
2025-08-01 22:58:26 +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
a0792aa469
backups: make sure reused error backup is in same target
2025-07-25 14:06:35 +02:00
Girish Ramakrishnan
fc4da4408c
backups: fix app restore with tgz
2025-07-25 13:39:09 +02:00
Girish Ramakrishnan
276db17f0c
backups: use a real targetId
2025-07-25 08:12:27 +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