mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
fix(backups): correctly apply repository compression mode
This commit is contained in:
@@ -238,6 +238,7 @@ const executeBackup = async (scheduleId: number, manual = false) => {
|
|||||||
|
|
||||||
await restic.backup(repository.config, volumePath, {
|
await restic.backup(repository.config, volumePath, {
|
||||||
...backupOptions,
|
...backupOptions,
|
||||||
|
compressionMode: repository.compressionMode ?? "auto",
|
||||||
onProgress: (progress) => {
|
onProgress: (progress) => {
|
||||||
serverEvents.emit("backup:progress", {
|
serverEvents.emit("backup:progress", {
|
||||||
scheduleId,
|
scheduleId,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { logger } from "./logger";
|
|||||||
import { cryptoUtils } from "./crypto";
|
import { cryptoUtils } from "./crypto";
|
||||||
import type { RetentionPolicy } from "../modules/backups/backups.dto";
|
import type { RetentionPolicy } from "../modules/backups/backups.dto";
|
||||||
import { safeSpawn } from "./spawn";
|
import { safeSpawn } from "./spawn";
|
||||||
import type { RepositoryConfig } from "~/schemas/restic";
|
import type { CompressionMode, RepositoryConfig } from "~/schemas/restic";
|
||||||
|
|
||||||
const backupOutputSchema = type({
|
const backupOutputSchema = type({
|
||||||
message_type: "'summary'",
|
message_type: "'summary'",
|
||||||
@@ -234,6 +234,7 @@ const backup = async (
|
|||||||
exclude?: string[];
|
exclude?: string[];
|
||||||
include?: string[];
|
include?: string[];
|
||||||
tags?: string[];
|
tags?: string[];
|
||||||
|
compressionMode?: CompressionMode;
|
||||||
signal?: AbortSignal;
|
signal?: AbortSignal;
|
||||||
onProgress?: (progress: BackupProgress) => void;
|
onProgress?: (progress: BackupProgress) => void;
|
||||||
},
|
},
|
||||||
@@ -241,7 +242,14 @@ const backup = async (
|
|||||||
const repoUrl = buildRepoUrl(config);
|
const repoUrl = buildRepoUrl(config);
|
||||||
const env = await buildEnv(config);
|
const env = await buildEnv(config);
|
||||||
|
|
||||||
const args: string[] = ["--repo", repoUrl, "backup", "--one-file-system"];
|
const args: string[] = [
|
||||||
|
"--repo",
|
||||||
|
repoUrl,
|
||||||
|
"backup",
|
||||||
|
"--one-file-system",
|
||||||
|
"--compression",
|
||||||
|
options?.compressionMode ?? "auto",
|
||||||
|
];
|
||||||
|
|
||||||
if (options?.tags && options.tags.length > 0) {
|
if (options?.tags && options.tags.length > 0) {
|
||||||
for (const tag of options.tags) {
|
for (const tag of options.tags) {
|
||||||
@@ -291,6 +299,7 @@ const backup = async (
|
|||||||
|
|
||||||
let stdout = "";
|
let stdout = "";
|
||||||
|
|
||||||
|
logger.debug(`Executing: restic ${args.join(" ")}`);
|
||||||
const res = await safeSpawn({
|
const res = await safeSpawn({
|
||||||
command: "restic",
|
command: "restic",
|
||||||
args,
|
args,
|
||||||
|
|||||||
Reference in New Issue
Block a user