elestio 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/commands/backups.js +7 -2
- package/src/registry.js +1 -1
package/README.md
CHANGED
|
@@ -249,7 +249,7 @@ replica.
|
|
|
249
249
|
| `elestio backups remote-list <vmID>` | List remote backups |
|
|
250
250
|
| `elestio backups remote-take <vmID>` | Take remote backup |
|
|
251
251
|
| `elestio backups remote-restore <vmID> <snapshot>` | Restore remote backup |
|
|
252
|
-
| `elestio backups auto-enable <vmID
|
|
252
|
+
| `elestio backups auto-enable <vmID> [--path /opt] [--hour 03:00]` | Setup auto backups of a directory on the VM (default `/opt`) |
|
|
253
253
|
| `elestio backups auto-disable <vmID>` | Disable auto backups |
|
|
254
254
|
|
|
255
255
|
### Snapshots
|
package/package.json
CHANGED
package/src/commands/backups.js
CHANGED
|
@@ -83,8 +83,13 @@ export async function restoreRemoteBackup(vmID, snapshotName) {
|
|
|
83
83
|
return response;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
// Directory the backend hands to `borg create` on the VM. It must exist there,
|
|
87
|
+
// or every archive is empty. /opt holds the app stack; the dashboard sends it.
|
|
88
|
+
export const DEFAULT_BACKUP_PATH = '/opt';
|
|
89
|
+
|
|
90
|
+
export async function setupAutoBackups(vmID, backupPath = DEFAULT_BACKUP_PATH, backupHour = '03:00') {
|
|
91
|
+
if (!backupPath.startsWith('/')) throw new Error(`Backup path must be absolute, got "${backupPath}"`);
|
|
92
|
+
log('info', `Setting up auto backups for ${vmID} (${backupPath})...`);
|
|
88
93
|
const response = await apiRequest('/api/backups/SetupAutoBackups', 'POST', { serverID: String(vmID), backupPath, backupHour });
|
|
89
94
|
if (response.status !== 'OK') throw new Error(response.message || 'Failed to setup');
|
|
90
95
|
log('success', `Auto backups configured at ${backupHour}`);
|
package/src/registry.js
CHANGED
|
@@ -504,7 +504,7 @@ export const registry = {
|
|
|
504
504
|
'remote-list': { summary: 'List remote backups', usage: 'remote-list <vmID>', async run({ args, json }) { await (await load.backups()).listRemoteBackups(requireArg(args._[2], 'backups remote-list <vmID>'), json); } },
|
|
505
505
|
'remote-take': { summary: 'Take a remote backup', usage: 'remote-take <vmID>', async run({ args }) { await (await load.backups()).takeRemoteBackup(requireArg(args._[2], 'backups remote-take <vmID>')); } },
|
|
506
506
|
'remote-restore': { summary: 'Restore a remote backup', usage: 'remote-restore <vmID> <snapshot>', async run({ args }) { await (await load.backups()).restoreRemoteBackup(requireArg(args._[2], 'backups remote-restore <vmID> <snapshot>'), positional(args, 3, 'snapshot')); } },
|
|
507
|
-
'auto-enable': { summary: 'Enable scheduled backups (--path, --hour)', usage: 'auto-enable <vmID>', async run({ args }) { await (await load.backups()).setupAutoBackups(requireArg(args._[2], 'backups auto-enable <vmID>'), args.path, args.hour); } },
|
|
507
|
+
'auto-enable': { summary: 'Enable scheduled backups (--path dir on the VM, default /opt; --hour)', usage: 'auto-enable <vmID>', async run({ args }) { await (await load.backups()).setupAutoBackups(requireArg(args._[2], 'backups auto-enable <vmID>'), args.path, args.hour); } },
|
|
508
508
|
'auto-disable': { summary: 'Disable scheduled backups', usage: 'auto-disable <vmID>', async run({ args }) { await (await load.backups()).disableAutoBackups(requireArg(args._[2], 'backups auto-disable <vmID>')); } }
|
|
509
509
|
}
|
|
510
510
|
},
|