Skip to content

Commit 04b9a1f

Browse files
authored
[feat]: create backup via jsonl files (#2891)
* create backup via jsonl files * readd the objects preprocessing and fix the regex to also replace multiple levels after a system.host.id.xy * on validation also allow new backup format - out of cb hell for restoreBackup * also make restore functional * rework to startswith
1 parent d16b146 commit 04b9a1f

File tree

4 files changed

+417
-255
lines changed

4 files changed

+417
-255
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
## __WORK IN PROGRESS__
88
* (@foxriver76) enhanced translations for the `diskSpaceIssues` notification category
9+
* (@foxriver76) improved backup/restore process to work for arbitrary large installations
910

1011
## 6.0.11 (2024-08-21) - Kiera
1112
* (@foxriver76) only generate `packageUpdates` notification, if new updates detected

packages/cli/src/lib/setup.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@ async function processCommand(
12591259
case 'restore': {
12601260
const { BackupRestore } = await import('./setup/setupBackup.js');
12611261

1262-
dbConnect(params, ({ isOffline, objects, states }) => {
1262+
dbConnect(params, async ({ isOffline, objects, states }) => {
12631263
if (!isOffline) {
12641264
console.error(`Stop ${tools.appName} first!`);
12651265
return void callback(EXIT_CODES.CONTROLLER_RUNNING);
@@ -1273,17 +1273,16 @@ async function processCommand(
12731273
processExit: callback
12741274
});
12751275

1276-
backup.restoreBackup({
1276+
const { exitCode } = await backup.restoreBackup({
12771277
name: args[0],
12781278
force: !!params.force,
1279-
dontDeleteAdapters: false,
1280-
callback: ({ exitCode }) => {
1281-
if (exitCode === EXIT_CODES.NO_ERROR) {
1282-
console.log('System successfully restored!');
1283-
}
1284-
return void callback(exitCode);
1285-
}
1279+
dontDeleteAdapters: false
12861280
});
1281+
1282+
if (exitCode === EXIT_CODES.NO_ERROR) {
1283+
console.log('System successfully restored!');
1284+
}
1285+
return void callback(exitCode);
12871286
});
12881287
break;
12891288
}
@@ -1304,7 +1303,7 @@ async function processCommand(
13041303
try {
13051304
const filePath = await backup.createBackup(name);
13061305
console.log(`Backup created: ${filePath!}`);
1307-
console.log('This backup can only be restored with js-controller version up from 4.1');
1306+
console.log('This backup can only be restored with js-controller version 6.1 or higher');
13081307
return void callback(EXIT_CODES.NO_ERROR);
13091308
} catch (e) {
13101309
console.log(`Cannot create backup: ${e.message}`);

0 commit comments

Comments
 (0)