feat: add runVolumeBackup functionality and update volume backup paths

- Implemented the runVolumeBackup function to facilitate manual execution of volume backups, enhancing user control over backup processes.
- Updated various components to utilize the new VOLUME_BACKUPS_PATH for improved organization and clarity in backup file management.
- Enhanced error handling in the runManually mutation to ensure robust execution and logging of backup operations.
This commit is contained in:
Mauricio Siu
2025-06-30 22:15:45 -06:00
parent e21605030a
commit d15ccfe505
7 changed files with 102 additions and 22 deletions

View File

@@ -476,11 +476,11 @@ export const createDeploymentVolumeBackup = async (
"volumeBackup",
serverId,
);
const { SCHEDULES_PATH } = paths(!!serverId);
const { VOLUME_BACKUPS_PATH } = paths(!!serverId);
const formattedDateTime = format(new Date(), "yyyy-MM-dd:HH:mm:ss");
const fileName = `${volumeBackup.appName}-${formattedDateTime}.log`;
const logFilePath = path.join(
SCHEDULES_PATH,
VOLUME_BACKUPS_PATH,
volumeBackup.appName,
fileName,
);
@@ -489,15 +489,18 @@ export const createDeploymentVolumeBackup = async (
const server = await findServerById(serverId);
const command = `
mkdir -p ${SCHEDULES_PATH}/${volumeBackup.appName};
mkdir -p ${VOLUME_BACKUPS_PATH}/${volumeBackup.appName};
echo "Initializing volume backup" >> ${logFilePath};
`;
await execAsyncRemote(server.serverId, command);
} else {
await fsPromises.mkdir(path.join(SCHEDULES_PATH, volumeBackup.appName), {
recursive: true,
});
await fsPromises.mkdir(
path.join(VOLUME_BACKUPS_PATH, volumeBackup.appName),
{
recursive: true,
},
);
await fsPromises.writeFile(logFilePath, "Initializing volume backup\n");
}

View File

@@ -19,6 +19,7 @@ export const findVolumeBackupById = async (volumeBackupId: string) => {
mongo: true,
redis: true,
compose: true,
destination: true,
},
});