feat: enable restic cache

This commit is contained in:
Nicolas Meienberger
2025-10-23 21:10:36 +02:00
parent f7718055eb
commit d58c4f793d
6 changed files with 5 additions and 14 deletions

View File

@@ -2,7 +2,7 @@ ARG BUN_VERSION="1.3.1"
FROM oven/bun:${BUN_VERSION}-alpine AS base 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" ENV NODE_ENV="production"
# RUN bun i ssh2
RUN apk add --no-cache davfs2=1.6.1-r2
WORKDIR /app WORKDIR /app
COPY --from=deps /deps/restic /usr/local/bin/restic COPY --from=deps /deps/restic /usr/local/bin/restic

View File

@@ -42,7 +42,6 @@ export const VolumeInfoTabContent = ({ volume, statfs }: Props) => {
const [pendingValues, setPendingValues] = useState<FormValues | null>(null); const [pendingValues, setPendingValues] = useState<FormValues | null>(null);
const handleSubmit = (values: FormValues) => { const handleSubmit = (values: FormValues) => {
console.log({ values });
setPendingValues(values); setPendingValues(values);
setOpen(true); setOpen(true);
}; };

View File

@@ -41,10 +41,6 @@ export const RepositorySnapshotsTabContent = ({ repository }: Props) => {
const hasNoSnapshots = snapshots.length === 0; const hasNoSnapshots = snapshots.length === 0;
const hasNoFilteredSnapshots = filteredSnapshots.length === 0 && !hasNoSnapshots; const hasNoFilteredSnapshots = filteredSnapshots.length === 0 && !hasNoSnapshots;
const formatDate = (timestamp: number) => {
return new Date(timestamp * 1000).toLocaleString();
};
const formatSnapshotDuration = (seconds: number) => { const formatSnapshotDuration = (seconds: number) => {
const duration = intervalToDuration({ start: 0, end: seconds * 1000 }); const duration = intervalToDuration({ start: 0, end: seconds * 1000 });
const parts: string[] = []; const parts: string[] = [];
@@ -176,7 +172,7 @@ export const RepositorySnapshotsTabContent = ({ repository }: Props) => {
<TableCell> <TableCell>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Calendar className="h-4 w-4 text-muted-foreground" /> <Calendar className="h-4 w-4 text-muted-foreground" />
<span className="text-sm">{formatDate(snapshot.time / 1000)}</span> <span className="text-sm">{new Date(snapshot.time).toLocaleString()}</span>
</div> </div>
</TableCell> </TableCell>
<TableCell> <TableCell>

View File

@@ -139,8 +139,6 @@ const checkHealth = async (path: string) => {
const mount = await getMountForPath(path); const mount = await getMountForPath(path);
console.log(mount);
if (!mount || mount.fstype !== "fuse") { if (!mount || mount.fstype !== "fuse") {
throw new Error(`Path ${path} is not mounted as WebDAV.`); throw new Error(`Path ${path} is not mounted as WebDAV.`);
} }

View File

@@ -14,6 +14,7 @@ import { getStatFs, type StatFs } from "../../utils/mountinfo";
import { createVolumeBackend } from "../backends/backend"; import { createVolumeBackend } from "../backends/backend";
import type { UpdateVolumeBody } from "./volume.dto"; import type { UpdateVolumeBody } from "./volume.dto";
import { getVolumePath } from "./helpers"; import { getVolumePath } from "./helpers";
import { logger } from "../../utils/logger";
const listVolumes = async () => { const listVolumes = async () => {
const volumes = await db.query.volumesTable.findMany({}); 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; JSON.stringify(existing.config) !== JSON.stringify(volumeData.config) && volumeData.config !== undefined;
if (configChanged) { if (configChanged) {
console.log("Unmounting existing volume before applying new config"); logger.debug("Unmounting existing volume before applying new config");
const backend = createVolumeBackend(existing); const backend = createVolumeBackend(existing);
await backend.unmount(); await backend.unmount();
} }

View File

@@ -79,6 +79,7 @@ const buildRepoUrl = (config: RepositoryConfig): string => {
const buildEnv = async (config: RepositoryConfig) => { const buildEnv = async (config: RepositoryConfig) => {
const env: Record<string, string> = { const env: Record<string, string> = {
RESTIC_CACHE_DIR: "/tmp/restic-cache",
RESTIC_PASSWORD_FILE: RESTIC_PASS_FILE, RESTIC_PASSWORD_FILE: RESTIC_PASS_FILE,
}; };