[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot]
2026-03-30 22:49:52 +00:00
committed by GitHub
parent 450d591c1a
commit 9b108480a8
3 changed files with 103 additions and 106 deletions
@@ -1,105 +1,106 @@
import { import {
Body, Body,
Container, Container,
Head, Head,
Heading, Heading,
Html, Html,
Img, Img,
Preview, Preview,
Section, Section,
Tailwind, Tailwind,
Text, Text,
} from "@react-email/components"; } from "@react-email/components";
export type TemplateProps = { export type TemplateProps = {
type: "error" | "success"; type: "error" | "success";
errorMessage?: string; errorMessage?: string;
date: string; date: string;
backupSize?: string; backupSize?: string;
}; };
export const DokployBackupEmail = ({ export const DokployBackupEmail = ({
type = "success", type = "success",
errorMessage, errorMessage,
date = "2023-05-01T00:00:00.000Z", date = "2023-05-01T00:00:00.000Z",
backupSize, backupSize,
}: TemplateProps) => { }: TemplateProps) => {
const previewText = `Dokploy instance backup was ${type === "success" ? "successful ✅" : "failed ❌"}`; const previewText = `Dokploy instance backup was ${type === "success" ? "successful ✅" : "failed ❌"}`;
return ( return (
<Html> <Html>
<Preview>{previewText}</Preview> <Preview>{previewText}</Preview>
<Tailwind <Tailwind
config={{ config={{
theme: { theme: {
extend: { extend: {
colors: { colors: {
brand: "#007291", brand: "#007291",
}, },
}, },
}, },
}} }}
> >
<Head /> <Head />
<Body className="bg-white my-auto mx-auto font-sans px-2"> <Body className="bg-white my-auto mx-auto font-sans px-2">
<Container className="border border-solid border-[#eaeaea] rounded-lg my-[40px] mx-auto p-[20px] max-w-[465px]"> <Container className="border border-solid border-[#eaeaea] rounded-lg my-[40px] mx-auto p-[20px] max-w-[465px]">
<Section className="mt-[32px]"> <Section className="mt-[32px]">
<Img <Img
src={ src={
"https://raw.githubusercontent.com/Dokploy/dokploy/refs/heads/canary/apps/dokploy/logo.png" "https://raw.githubusercontent.com/Dokploy/dokploy/refs/heads/canary/apps/dokploy/logo.png"
} }
width="100" width="100"
height="50" height="50"
alt="Dokploy" alt="Dokploy"
className="my-0 mx-auto" className="my-0 mx-auto"
/> />
</Section> </Section>
<Heading className="text-black text-[24px] font-normal text-center p-0 my-[30px] mx-0"> <Heading className="text-black text-[24px] font-normal text-center p-0 my-[30px] mx-0">
Dokploy Instance Backup Dokploy Instance Backup
</Heading> </Heading>
<Text className="text-black text-[14px] leading-[24px]"> <Text className="text-black text-[14px] leading-[24px]">
Hello, Hello,
</Text> </Text>
<Text className="text-black text-[14px] leading-[24px]"> <Text className="text-black text-[14px] leading-[24px]">
Your Dokploy instance backup was{" "} Your Dokploy instance backup was{" "}
{type === "success" {type === "success"
? "successful ✅" ? "successful ✅"
: "failed. Please check the error message below. ❌"} : "failed. Please check the error message below. ❌"}
. .
</Text> </Text>
<Section className="flex text-black text-[14px] leading-[24px] bg-[#F4F4F5] rounded-lg p-2"> <Section className="flex text-black text-[14px] leading-[24px] bg-[#F4F4F5] rounded-lg p-2">
<Text className="!leading-3 font-bold">Details: </Text> <Text className="!leading-3 font-bold">Details: </Text>
<Text className="!leading-3"> <Text className="!leading-3">
Backup Type: <strong>Complete Dokploy Instance</strong> Backup Type: <strong>Complete Dokploy Instance</strong>
</Text> </Text>
<Text className="!leading-3"> <Text className="!leading-3">
Content: <strong>/etc/dokploy + PostgreSQL Database</strong> Content: <strong>/etc/dokploy + PostgreSQL Database</strong>
</Text> </Text>
{backupSize && ( {backupSize && (
<Text className="!leading-3"> <Text className="!leading-3">
Backup Size: <strong>{backupSize}</strong> Backup Size: <strong>{backupSize}</strong>
</Text> </Text>
)} )}
<Text className="!leading-3"> <Text className="!leading-3">
Date: <strong>{date}</strong> Date: <strong>{date}</strong>
</Text> </Text>
<Text className="!leading-3"> <Text className="!leading-3">
Status: <strong>{type === "success" ? "Successful" : "Failed"}</strong> Status:{" "}
</Text> <strong>{type === "success" ? "Successful" : "Failed"}</strong>
</Section> </Text>
{type === "error" && errorMessage ? ( </Section>
<Section className="flex text-black text-[14px] mt-4 leading-[24px] bg-[#F4F4F5] rounded-lg p-2"> {type === "error" && errorMessage ? (
<Text className="!leading-3 font-bold">Reason: </Text> <Section className="flex text-black text-[14px] mt-4 leading-[24px] bg-[#F4F4F5] rounded-lg p-2">
<Text className="text-[12px] leading-[24px]"> <Text className="!leading-3 font-bold">Reason: </Text>
{errorMessage || "Error message not provided"} <Text className="text-[12px] leading-[24px]">
</Text> {errorMessage || "Error message not provided"}
</Section> </Text>
) : null} </Section>
</Container> ) : null}
</Body> </Container>
</Tailwind> </Body>
</Html> </Tailwind>
); </Html>
);
}; };
export default DokployBackupEmail; export default DokployBackupEmail;
@@ -124,11 +124,11 @@ export const runWebServerBackup = async (backup: BackupSchedule) => {
); );
writeStream.end(); writeStream.end();
await sendDokployBackupNotifications({ await sendDokployBackupNotifications({
type: "error", type: "error",
// @ts-ignore // @ts-ignore
errorMessage: error?.message || "Error message not provided", errorMessage: error?.message || "Error message not provided",
backupSize: formatBytes(computedBackupSize), backupSize: formatBytes(computedBackupSize),
}); });
await updateDeploymentStatus(deployment.deploymentId, "error"); await updateDeploymentStatus(deployment.deploymentId, "error");
throw error; throw error;
} }
@@ -51,11 +51,7 @@ export const sendDokployBackupNotifications = async ({
backupSize, backupSize,
}), }),
).catch(); ).catch();
await sendEmailNotification( await sendEmailNotification(email, "Dokploy instance backup", template);
email,
"Dokploy instance backup",
template,
);
} }
if (discord) { if (discord) {
@@ -319,4 +315,4 @@ export const sendDokployBackupNotifications = async ({
}); });
} }
} }
}; };