mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Merge 499022a328 into 2a89be6efc
This commit is contained in:
@@ -49,6 +49,7 @@ export const runComposeBackup = async (
|
|||||||
databaseType: "mongodb",
|
databaseType: "mongodb",
|
||||||
type: "success",
|
type: "success",
|
||||||
organizationId: project.organizationId,
|
organizationId: project.organizationId,
|
||||||
|
databaseName: backup.database
|
||||||
});
|
});
|
||||||
|
|
||||||
await updateDeploymentStatus(deployment.deploymentId, "done");
|
await updateDeploymentStatus(deployment.deploymentId, "done");
|
||||||
@@ -62,6 +63,7 @@ export const runComposeBackup = async (
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
errorMessage: error?.message || "Error message not provided",
|
errorMessage: error?.message || "Error message not provided",
|
||||||
organizationId: project.organizationId,
|
organizationId: project.organizationId,
|
||||||
|
databaseName: backup.database
|
||||||
});
|
});
|
||||||
|
|
||||||
await updateDeploymentStatus(deployment.deploymentId, "error");
|
await updateDeploymentStatus(deployment.deploymentId, "error");
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ export const runMariadbBackup = async (
|
|||||||
databaseType: "mariadb",
|
databaseType: "mariadb",
|
||||||
type: "success",
|
type: "success",
|
||||||
organizationId: project.organizationId,
|
organizationId: project.organizationId,
|
||||||
|
databaseName: backup.database
|
||||||
});
|
});
|
||||||
await updateDeploymentStatus(deployment.deploymentId, "done");
|
await updateDeploymentStatus(deployment.deploymentId, "done");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -60,6 +61,7 @@ export const runMariadbBackup = async (
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
errorMessage: error?.message || "Error message not provided",
|
errorMessage: error?.message || "Error message not provided",
|
||||||
organizationId: project.organizationId,
|
organizationId: project.organizationId,
|
||||||
|
databaseName: backup.database
|
||||||
});
|
});
|
||||||
await updateDeploymentStatus(deployment.deploymentId, "error");
|
await updateDeploymentStatus(deployment.deploymentId, "error");
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ export const runMongoBackup = async (mongo: Mongo, backup: BackupSchedule) => {
|
|||||||
databaseType: "mongodb",
|
databaseType: "mongodb",
|
||||||
type: "success",
|
type: "success",
|
||||||
organizationId: project.organizationId,
|
organizationId: project.organizationId,
|
||||||
|
databaseName: backup.database
|
||||||
});
|
});
|
||||||
await updateDeploymentStatus(deployment.deploymentId, "done");
|
await updateDeploymentStatus(deployment.deploymentId, "done");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -58,6 +59,7 @@ export const runMongoBackup = async (mongo: Mongo, backup: BackupSchedule) => {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
errorMessage: error?.message || "Error message not provided",
|
errorMessage: error?.message || "Error message not provided",
|
||||||
organizationId: project.organizationId,
|
organizationId: project.organizationId,
|
||||||
|
databaseName: backup.database
|
||||||
});
|
});
|
||||||
await updateDeploymentStatus(deployment.deploymentId, "error");
|
await updateDeploymentStatus(deployment.deploymentId, "error");
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ export const runMySqlBackup = async (mysql: MySql, backup: BackupSchedule) => {
|
|||||||
databaseType: "mysql",
|
databaseType: "mysql",
|
||||||
type: "success",
|
type: "success",
|
||||||
organizationId: project.organizationId,
|
organizationId: project.organizationId,
|
||||||
|
databaseName: backup.database
|
||||||
});
|
});
|
||||||
await updateDeploymentStatus(deployment.deploymentId, "done");
|
await updateDeploymentStatus(deployment.deploymentId, "done");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -59,6 +60,7 @@ export const runMySqlBackup = async (mysql: MySql, backup: BackupSchedule) => {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
errorMessage: error?.message || "Error message not provided",
|
errorMessage: error?.message || "Error message not provided",
|
||||||
organizationId: project.organizationId,
|
organizationId: project.organizationId,
|
||||||
|
databaseName: backup.database
|
||||||
});
|
});
|
||||||
await updateDeploymentStatus(deployment.deploymentId, "error");
|
await updateDeploymentStatus(deployment.deploymentId, "error");
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ export const runPostgresBackup = async (
|
|||||||
databaseType: "postgres",
|
databaseType: "postgres",
|
||||||
type: "success",
|
type: "success",
|
||||||
organizationId: project.organizationId,
|
organizationId: project.organizationId,
|
||||||
|
databaseName: backup.database
|
||||||
});
|
});
|
||||||
|
|
||||||
await updateDeploymentStatus(deployment.deploymentId, "done");
|
await updateDeploymentStatus(deployment.deploymentId, "done");
|
||||||
@@ -62,6 +63,7 @@ export const runPostgresBackup = async (
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
errorMessage: error?.message || "Error message not provided",
|
errorMessage: error?.message || "Error message not provided",
|
||||||
organizationId: project.organizationId,
|
organizationId: project.organizationId,
|
||||||
|
databaseName: backup.database
|
||||||
});
|
});
|
||||||
|
|
||||||
await updateDeploymentStatus(deployment.deploymentId, "error");
|
await updateDeploymentStatus(deployment.deploymentId, "error");
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ export const sendDatabaseBackupNotifications = async ({
|
|||||||
type,
|
type,
|
||||||
errorMessage,
|
errorMessage,
|
||||||
organizationId,
|
organizationId,
|
||||||
|
databaseName
|
||||||
}: {
|
}: {
|
||||||
projectName: string;
|
projectName: string;
|
||||||
applicationName: string;
|
applicationName: string;
|
||||||
@@ -26,6 +27,7 @@ export const sendDatabaseBackupNotifications = async ({
|
|||||||
type: "error" | "success";
|
type: "error" | "success";
|
||||||
organizationId: string;
|
organizationId: string;
|
||||||
errorMessage?: string;
|
errorMessage?: string;
|
||||||
|
databaseName: string;
|
||||||
}) => {
|
}) => {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
const unixDate = ~~(Number(date) / 1000);
|
const unixDate = ~~(Number(date) / 1000);
|
||||||
@@ -90,6 +92,11 @@ export const sendDatabaseBackupNotifications = async ({
|
|||||||
value: databaseType,
|
value: databaseType,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: decorate("`📂`", "Database Name"),
|
||||||
|
value: databaseName,
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: decorate("`📅`", "Date"),
|
name: decorate("`📅`", "Date"),
|
||||||
value: `<t:${unixDate}:D>`,
|
value: `<t:${unixDate}:D>`,
|
||||||
@@ -136,6 +143,7 @@ export const sendDatabaseBackupNotifications = async ({
|
|||||||
`${decorate("🛠️", `Project: ${projectName}`)}` +
|
`${decorate("🛠️", `Project: ${projectName}`)}` +
|
||||||
`${decorate("⚙️", `Application: ${applicationName}`)}` +
|
`${decorate("⚙️", `Application: ${applicationName}`)}` +
|
||||||
`${decorate("❔", `Type: ${databaseType}`)}` +
|
`${decorate("❔", `Type: ${databaseType}`)}` +
|
||||||
|
`${decorate("📂", `Database Name: ${databaseName}`)}` +
|
||||||
`${decorate("🕒", `Date: ${date.toLocaleString()}`)}` +
|
`${decorate("🕒", `Date: ${date.toLocaleString()}`)}` +
|
||||||
`${type === "error" && errorMessage ? decorate("❌", `Error:\n${errorMessage}`) : ""}`,
|
`${type === "error" && errorMessage ? decorate("❌", `Error:\n${errorMessage}`) : ""}`,
|
||||||
);
|
);
|
||||||
@@ -150,7 +158,7 @@ export const sendDatabaseBackupNotifications = async ({
|
|||||||
? `\n\n<b>Error:</b>\n<pre>${errorMessage}</pre>`
|
? `\n\n<b>Error:</b>\n<pre>${errorMessage}</pre>`
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
const messageText = `<b>${statusEmoji} Database Backup ${typeStatus}</b>\n\n<b>Project:</b> ${projectName}\n<b>Application:</b> ${applicationName}\n<b>Type:</b> ${databaseType}\n<b>Date:</b> ${format(date, "PP")}\n<b>Time:</b> ${format(date, "pp")}${isError ? errorMsg : ""}`;
|
const messageText = `<b>${statusEmoji} Database Backup ${typeStatus}</b>\n\n<b>Project:</b> ${projectName}\n<b>Application:</b> ${applicationName}\n<b>Type:</b> ${databaseType}\n<b>Database Name:</b> ${databaseName}\n<b>Date:</b> ${format(date, "PP")}\n<b>Time:</b> ${format(date, "pp")}${isError ? errorMsg : ""}`;
|
||||||
|
|
||||||
await sendTelegramNotification(telegram, messageText);
|
await sendTelegramNotification(telegram, messageText);
|
||||||
}
|
}
|
||||||
@@ -191,6 +199,10 @@ export const sendDatabaseBackupNotifications = async ({
|
|||||||
value: databaseType,
|
value: databaseType,
|
||||||
short: true,
|
short: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "Database Name",
|
||||||
|
value: databaseName
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: "Time",
|
title: "Time",
|
||||||
value: date.toLocaleString(),
|
value: date.toLocaleString(),
|
||||||
|
|||||||
Reference in New Issue
Block a user