mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-09 07:55:25 +02:00
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:
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ export const findVolumeBackupById = async (volumeBackupId: string) => {
|
||||
mongo: true,
|
||||
redis: true,
|
||||
compose: true,
|
||||
destination: true,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user