mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Update deployment and backup components for improved handling and user experience
- Refined the `ShowDeployments` component to conditionally render `CancelQueues` and `RefreshToken` based on deployment type, enhancing flexibility. - Removed unnecessary console logging in `RestoreBackup` and updated input field to disable when the database type is "web-server", improving user guidance. - Enhanced logging in `runWebServerBackup` to provide clearer output during backup operations, ensuring better traceability of actions.
This commit is contained in:
@@ -42,35 +42,35 @@ export const runWebServerBackup = async (backup: BackupSchedule) => {
|
||||
);
|
||||
|
||||
if (!containerId) {
|
||||
writeStream.write("PostgreSQL container not found❌");
|
||||
writeStream.write("Dokploy postgres container not found❌\n");
|
||||
writeStream.end();
|
||||
throw new Error("PostgreSQL container not found");
|
||||
throw new Error("Dokploy postgres container not found");
|
||||
}
|
||||
|
||||
writeStream.write(`PostgreSQL container ID: ${containerId}`);
|
||||
writeStream.write(`Dokploy postgres container ID: ${containerId}\n`);
|
||||
|
||||
const postgresContainerId = containerId.trim();
|
||||
|
||||
const postgresCommand = `docker exec ${postgresContainerId} pg_dump -v -Fc -U dokploy -d dokploy > '${tempDir}/database.sql'`;
|
||||
|
||||
writeStream.write(`Running command: ${postgresCommand}`);
|
||||
writeStream.write(`Running command: ${postgresCommand}\n`);
|
||||
await execAsync(postgresCommand);
|
||||
|
||||
await execAsync(`cp -r ${BASE_PATH}/* ${tempDir}/filesystem/`);
|
||||
|
||||
writeStream.write("Copied filesystem to temp directory");
|
||||
writeStream.write("Copied filesystem to temp directory\n");
|
||||
|
||||
await execAsync(
|
||||
// Zip all .sql files since we created more than one
|
||||
`cd ${tempDir} && zip -r ${backupFileName} *.sql filesystem/ > /dev/null 2>&1`,
|
||||
);
|
||||
|
||||
writeStream.write("Zipped database and filesystem");
|
||||
writeStream.write("Zipped database and filesystem\n");
|
||||
|
||||
const uploadCommand = `rclone copyto ${rcloneFlags.join(" ")} "${tempDir}/${backupFileName}" "${s3Path}"`;
|
||||
writeStream.write(`Running command: ${uploadCommand}`);
|
||||
writeStream.write(`Running command: ${uploadCommand}\n`);
|
||||
await execAsync(uploadCommand);
|
||||
writeStream.write("Uploaded backup to S3 ✅");
|
||||
writeStream.write("Uploaded backup to S3 ✅\n");
|
||||
writeStream.end();
|
||||
await updateDeploymentStatus(deployment.deploymentId, "done");
|
||||
return true;
|
||||
@@ -80,7 +80,9 @@ export const runWebServerBackup = async (backup: BackupSchedule) => {
|
||||
} catch (error) {
|
||||
console.error("Backup error:", error);
|
||||
writeStream.write("Backup error❌\n");
|
||||
writeStream.write(error instanceof Error ? error.message : "Unknown error");
|
||||
writeStream.write(
|
||||
error instanceof Error ? error.message : "Unknown error\n",
|
||||
);
|
||||
writeStream.end();
|
||||
await updateDeploymentStatus(deployment.deploymentId, "error");
|
||||
throw error;
|
||||
|
||||
Reference in New Issue
Block a user