From d58c4f793d7789d582c1fd79b0749e4d0b526107 Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Thu, 23 Oct 2025 21:10:36 +0200 Subject: [PATCH] feat: enable restic cache --- Dockerfile | 6 +----- apps/client/app/modules/details/tabs/info.tsx | 1 - apps/client/app/modules/repositories/tabs/snapshots.tsx | 6 +----- apps/server/src/modules/backends/webdav/webdav-backend.ts | 2 -- apps/server/src/modules/volumes/volume.service.ts | 3 ++- apps/server/src/utils/restic.ts | 1 + 6 files changed, 5 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index f334073..c1ffe9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ ARG BUN_VERSION="1.3.1" FROM oven/bun:${BUN_VERSION}-alpine AS base -RUN apk add --no-cache davfs2 +RUN apk add --no-cache davfs2=1.6.1-r2 # ------------------------------ @@ -73,10 +73,6 @@ FROM base AS production ENV NODE_ENV="production" -# RUN bun i ssh2 - -RUN apk add --no-cache davfs2=1.6.1-r2 - WORKDIR /app COPY --from=deps /deps/restic /usr/local/bin/restic diff --git a/apps/client/app/modules/details/tabs/info.tsx b/apps/client/app/modules/details/tabs/info.tsx index 2b64056..d012b64 100644 --- a/apps/client/app/modules/details/tabs/info.tsx +++ b/apps/client/app/modules/details/tabs/info.tsx @@ -42,7 +42,6 @@ export const VolumeInfoTabContent = ({ volume, statfs }: Props) => { const [pendingValues, setPendingValues] = useState(null); const handleSubmit = (values: FormValues) => { - console.log({ values }); setPendingValues(values); setOpen(true); }; diff --git a/apps/client/app/modules/repositories/tabs/snapshots.tsx b/apps/client/app/modules/repositories/tabs/snapshots.tsx index 5d6803f..bd0d09f 100644 --- a/apps/client/app/modules/repositories/tabs/snapshots.tsx +++ b/apps/client/app/modules/repositories/tabs/snapshots.tsx @@ -41,10 +41,6 @@ export const RepositorySnapshotsTabContent = ({ repository }: Props) => { const hasNoSnapshots = snapshots.length === 0; const hasNoFilteredSnapshots = filteredSnapshots.length === 0 && !hasNoSnapshots; - const formatDate = (timestamp: number) => { - return new Date(timestamp * 1000).toLocaleString(); - }; - const formatSnapshotDuration = (seconds: number) => { const duration = intervalToDuration({ start: 0, end: seconds * 1000 }); const parts: string[] = []; @@ -176,7 +172,7 @@ export const RepositorySnapshotsTabContent = ({ repository }: Props) => {
- {formatDate(snapshot.time / 1000)} + {new Date(snapshot.time).toLocaleString()}
diff --git a/apps/server/src/modules/backends/webdav/webdav-backend.ts b/apps/server/src/modules/backends/webdav/webdav-backend.ts index 5f6d5fc..50ee458 100644 --- a/apps/server/src/modules/backends/webdav/webdav-backend.ts +++ b/apps/server/src/modules/backends/webdav/webdav-backend.ts @@ -139,8 +139,6 @@ const checkHealth = async (path: string) => { const mount = await getMountForPath(path); - console.log(mount); - if (!mount || mount.fstype !== "fuse") { throw new Error(`Path ${path} is not mounted as WebDAV.`); } diff --git a/apps/server/src/modules/volumes/volume.service.ts b/apps/server/src/modules/volumes/volume.service.ts index bf28e1a..b1ea1b0 100644 --- a/apps/server/src/modules/volumes/volume.service.ts +++ b/apps/server/src/modules/volumes/volume.service.ts @@ -14,6 +14,7 @@ import { getStatFs, type StatFs } from "../../utils/mountinfo"; import { createVolumeBackend } from "../backends/backend"; import type { UpdateVolumeBody } from "./volume.dto"; import { getVolumePath } from "./helpers"; +import { logger } from "../../utils/logger"; const listVolumes = async () => { const volumes = await db.query.volumesTable.findMany({}); @@ -137,7 +138,7 @@ const updateVolume = async (name: string, volumeData: UpdateVolumeBody) => { JSON.stringify(existing.config) !== JSON.stringify(volumeData.config) && volumeData.config !== undefined; if (configChanged) { - console.log("Unmounting existing volume before applying new config"); + logger.debug("Unmounting existing volume before applying new config"); const backend = createVolumeBackend(existing); await backend.unmount(); } diff --git a/apps/server/src/utils/restic.ts b/apps/server/src/utils/restic.ts index 9377a89..52c7bff 100644 --- a/apps/server/src/utils/restic.ts +++ b/apps/server/src/utils/restic.ts @@ -79,6 +79,7 @@ const buildRepoUrl = (config: RepositoryConfig): string => { const buildEnv = async (config: RepositoryConfig) => { const env: Record = { + RESTIC_CACHE_DIR: "/tmp/restic-cache", RESTIC_PASSWORD_FILE: RESTIC_PASS_FILE, };