@highstate/restic 0.9.14 → 0.9.15
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/dist/highstate.manifest.json +2 -2
- package/dist/index.js +78 -38
- package/dist/index.js.map +1 -1
- package/package.json +9 -8
- package/src/job-pair.ts +85 -43
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"sourceHashes": {
|
|
3
|
-
"./dist/index.js": "
|
|
4
|
-
"./dist/repo/index.js": "
|
|
3
|
+
"./dist/index.js": "57b088fadfe8a074b088be9906c6021680360b0b7d504dad9a99bdd6a9414b12",
|
|
4
|
+
"./dist/repo/index.js": "4bde0e0b91ade62340d678d491ce68c90167e6148ffe91ffa0c65d536af55aca"
|
|
5
5
|
}
|
|
6
6
|
}
|
package/dist/index.js
CHANGED
|
@@ -9063,6 +9063,13 @@ var Type2 = {
|
|
|
9063
9063
|
Default
|
|
9064
9064
|
};
|
|
9065
9065
|
|
|
9066
|
+
// assets/images.json
|
|
9067
|
+
var terminal_restic = {
|
|
9068
|
+
name: "ghcr.io/exeteres/highstate/terminal-restic",
|
|
9069
|
+
tag: "latest",
|
|
9070
|
+
image: "ghcr.io/exeteres/highstate/terminal-restic:latest@sha256:10ff1f65bbc5d5f84e0accc388c28ddb97f8a1a824bd7a90d2d5674506f5dee3"
|
|
9071
|
+
};
|
|
9072
|
+
|
|
9066
9073
|
// src/scripts.ts
|
|
9067
9074
|
var backupEnvironment = {
|
|
9068
9075
|
alpine: {
|
|
@@ -9166,52 +9173,57 @@ var BackupJobPair = class extends ComponentResource {
|
|
|
9166
9173
|
{ ...opts, parent: this }
|
|
9167
9174
|
);
|
|
9168
9175
|
});
|
|
9169
|
-
|
|
9170
|
-
const
|
|
9171
|
-
return {
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
|
-
|
|
9175
|
-
|
|
9176
|
-
|
|
9177
|
-
|
|
9178
|
-
|
|
9176
|
+
this.resticRepoPath = output(args).apply((args2) => {
|
|
9177
|
+
const relativePath = args2.resticRepo.pathPattern.replace(/\$clusterName/g, args2.cluster.name).replace(/\$appName/g, name).replace(/\$unitName/g, getUnitInstanceName());
|
|
9178
|
+
return `rclone:${args2.resticRepo.remoteName}:${relativePath}`;
|
|
9179
|
+
});
|
|
9180
|
+
const environment = output({ args, repoPath: this.resticRepoPath }).apply(
|
|
9181
|
+
({ args: args2, repoPath }) => {
|
|
9182
|
+
return {
|
|
9183
|
+
alpine: {
|
|
9184
|
+
packages: ["rclone"]
|
|
9185
|
+
},
|
|
9186
|
+
ubuntu: {
|
|
9187
|
+
preInstallPackages: ["curl", "unzip"],
|
|
9188
|
+
preInstallScripts: {
|
|
9189
|
+
"rclone.sh": text`
|
|
9179
9190
|
#!/bin/sh
|
|
9180
9191
|
set -e
|
|
9181
9192
|
|
|
9182
9193
|
curl https://rclone.org/install.sh | bash
|
|
9183
9194
|
`
|
|
9195
|
+
},
|
|
9196
|
+
allowedEndpoints: ["rclone.org:443", "downloads.rclone.org:443"]
|
|
9184
9197
|
},
|
|
9185
|
-
allowedEndpoints: [
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9193
|
-
|
|
9194
|
-
|
|
9195
|
-
RCLONE_CONFIG: "/credentials/rclone.conf",
|
|
9196
|
-
EXTRA_BACKUP_OPTIONS: args2.backupOptions?.join(" ")
|
|
9197
|
-
},
|
|
9198
|
-
volumes: [this.credentials, ...args2.volume ? [args2.volume] : []],
|
|
9199
|
-
volumeMounts: [
|
|
9200
|
-
{
|
|
9201
|
-
volume: this.credentials,
|
|
9202
|
-
mountPath: "/credentials",
|
|
9203
|
-
readOnly: true
|
|
9198
|
+
allowedEndpoints: [
|
|
9199
|
+
...args2.allowedEndpoints ?? [],
|
|
9200
|
+
...args2.resticRepo.remoteEndpoints ?? []
|
|
9201
|
+
],
|
|
9202
|
+
environment: {
|
|
9203
|
+
RESTIC_REPOSITORY: repoPath,
|
|
9204
|
+
RESTIC_PASSWORD_FILE: "/credentials/password",
|
|
9205
|
+
RESTIC_HOSTNAME: "default",
|
|
9206
|
+
RCLONE_CONFIG: "/credentials/rclone.conf",
|
|
9207
|
+
EXTRA_BACKUP_OPTIONS: args2.backupOptions?.join(" ")
|
|
9204
9208
|
},
|
|
9205
|
-
...args2.volume ? [
|
|
9209
|
+
volumes: [this.credentials, ...args2.volume ? [args2.volume] : []],
|
|
9210
|
+
volumeMounts: [
|
|
9206
9211
|
{
|
|
9207
|
-
volume:
|
|
9208
|
-
mountPath: "/
|
|
9209
|
-
|
|
9210
|
-
}
|
|
9211
|
-
|
|
9212
|
-
|
|
9213
|
-
|
|
9214
|
-
|
|
9212
|
+
volume: this.credentials,
|
|
9213
|
+
mountPath: "/credentials",
|
|
9214
|
+
readOnly: true
|
|
9215
|
+
},
|
|
9216
|
+
...args2.volume ? [
|
|
9217
|
+
{
|
|
9218
|
+
volume: args2.volume,
|
|
9219
|
+
mountPath: "/data",
|
|
9220
|
+
subPath: args2.subPath
|
|
9221
|
+
}
|
|
9222
|
+
] : []
|
|
9223
|
+
]
|
|
9224
|
+
};
|
|
9225
|
+
}
|
|
9226
|
+
);
|
|
9215
9227
|
this.scriptBundle = output(args).apply((args2) => {
|
|
9216
9228
|
return new ScriptBundle(
|
|
9217
9229
|
`${name}-backup-scripts`,
|
|
@@ -9283,6 +9295,10 @@ var BackupJobPair = class extends ComponentResource {
|
|
|
9283
9295
|
* The cron job resource which backups the volume regularly.
|
|
9284
9296
|
*/
|
|
9285
9297
|
backupJob;
|
|
9298
|
+
/**
|
|
9299
|
+
* The full name of the Restic repository.
|
|
9300
|
+
*/
|
|
9301
|
+
resticRepoPath;
|
|
9286
9302
|
handleTrigger(triggers) {
|
|
9287
9303
|
const triggerName = `restic.backup-on-destroy.${this.name}`;
|
|
9288
9304
|
const invokedTrigger = triggers.find((trigger) => trigger.name === triggerName);
|
|
@@ -9299,6 +9315,30 @@ var BackupJobPair = class extends ComponentResource {
|
|
|
9299
9315
|
}
|
|
9300
9316
|
};
|
|
9301
9317
|
}
|
|
9318
|
+
createTerminal() {
|
|
9319
|
+
return {
|
|
9320
|
+
name: "restic",
|
|
9321
|
+
title: "Restic",
|
|
9322
|
+
description: "Manage Restic repository",
|
|
9323
|
+
icon: "material-symbols:backup",
|
|
9324
|
+
image: terminal_restic.image,
|
|
9325
|
+
command: ["bash", "/welcome.sh"],
|
|
9326
|
+
files: {
|
|
9327
|
+
"/welcome.sh": text`
|
|
9328
|
+
echo "Use 'restic' to manage the repository."
|
|
9329
|
+
echo
|
|
9330
|
+
|
|
9331
|
+
exec bash
|
|
9332
|
+
`,
|
|
9333
|
+
"/credentials/password": output(this.args).backupPassword,
|
|
9334
|
+
"/root/.config/rclone/rclone.conf": output(this.args).resticRepo.rcloneConfig
|
|
9335
|
+
},
|
|
9336
|
+
env: {
|
|
9337
|
+
RESTIC_REPOSITORY: this.resticRepoPath,
|
|
9338
|
+
RESTIC_PASSWORD_FILE: "/credentials/password"
|
|
9339
|
+
}
|
|
9340
|
+
};
|
|
9341
|
+
}
|
|
9302
9342
|
async createBackupOnDestroyJob() {
|
|
9303
9343
|
new batch.v1.Job(
|
|
9304
9344
|
`${this.name}-backup-on-destroy`,
|