mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-17 17:35:17 +00:00
chore: run format-and-lint:fix
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
||||||
|
|
||||||
import type { ApplicationNested } from "@dokploy/server/utils/builders";
|
import type { ApplicationNested } from "@dokploy/server/utils/builders";
|
||||||
import { mechanizeDockerContainer } from "@dokploy/server/utils/builders";
|
import { mechanizeDockerContainer } from "@dokploy/server/utils/builders";
|
||||||
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
type MockCreateServiceOptions = {
|
type MockCreateServiceOptions = {
|
||||||
StopGracePeriod?: number;
|
StopGracePeriod?: number;
|
||||||
|
|||||||
@@ -1,15 +1,8 @@
|
|||||||
import type { findEnvironmentsByProjectId } from "@dokploy/server";
|
import type { findEnvironmentsByProjectId } from "@dokploy/server";
|
||||||
import {
|
import { ChevronDownIcon, PencilIcon, PlusIcon, TrashIcon } from "lucide-react";
|
||||||
ChevronDownIcon,
|
|
||||||
PencilIcon,
|
|
||||||
PlusIcon,
|
|
||||||
Terminal,
|
|
||||||
TrashIcon,
|
|
||||||
} from "lucide-react";
|
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { EnvironmentVariables } from "@/components/dashboard/project/environment-variables";
|
|
||||||
import { AlertBlock } from "@/components/shared/alert-block";
|
import { AlertBlock } from "@/components/shared/alert-block";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
@@ -246,20 +239,6 @@ export const AdvancedEnvironmentSelector = ({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
|
|
||||||
{/* Action buttons for non-production environments */}
|
|
||||||
{/* <EnvironmentVariables environmentId={environment.environmentId}>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
className="h-6 w-6 p-0"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Terminal className="h-3 w-3" />
|
|
||||||
</Button>
|
|
||||||
</EnvironmentVariables> */}
|
|
||||||
{environment.name !== "production" && (
|
{environment.name !== "production" && (
|
||||||
<div className="flex items-center gap-1 px-2">
|
<div className="flex items-center gap-1 px-2">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { useEffect, useMemo, useState } from "react";
|
|||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { BreadcrumbSidebar } from "@/components/shared/breadcrumb-sidebar";
|
import { BreadcrumbSidebar } from "@/components/shared/breadcrumb-sidebar";
|
||||||
import { DateTooltip } from "@/components/shared/date-tooltip";
|
import { DateTooltip } from "@/components/shared/date-tooltip";
|
||||||
|
import { FocusShortcutInput } from "@/components/shared/focus-shortcut-input";
|
||||||
import { StatusTooltip } from "@/components/shared/status-tooltip";
|
import { StatusTooltip } from "@/components/shared/status-tooltip";
|
||||||
import {
|
import {
|
||||||
AlertDialog,
|
AlertDialog,
|
||||||
@@ -44,7 +45,6 @@ import {
|
|||||||
DropdownMenuSeparator,
|
DropdownMenuSeparator,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from "@/components/ui/dropdown-menu";
|
} from "@/components/ui/dropdown-menu";
|
||||||
import { FocusShortcutInput } from "@/components/shared/focus-shortcut-input";
|
|
||||||
import {
|
import {
|
||||||
Select,
|
Select,
|
||||||
SelectContent,
|
SelectContent,
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
import {
|
import { Bell, Loader2, Mail, PenBoxIcon, Trash2 } from "lucide-react";
|
||||||
Bell,
|
|
||||||
Loader2,
|
|
||||||
Mail,
|
|
||||||
PenBoxIcon,
|
|
||||||
Trash2,
|
|
||||||
} from "lucide-react";
|
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import {
|
import {
|
||||||
DiscordIcon,
|
DiscordIcon,
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import {
|
|||||||
createMount,
|
createMount,
|
||||||
deployMariadb,
|
deployMariadb,
|
||||||
findBackupsByDbId,
|
findBackupsByDbId,
|
||||||
findMariadbById,
|
|
||||||
findEnvironmentById,
|
findEnvironmentById,
|
||||||
|
findMariadbById,
|
||||||
findProjectById,
|
findProjectById,
|
||||||
IS_CLOUD,
|
IS_CLOUD,
|
||||||
rebuildDatabase,
|
rebuildDatabase,
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import {
|
|||||||
createMount,
|
createMount,
|
||||||
deployMongo,
|
deployMongo,
|
||||||
findBackupsByDbId,
|
findBackupsByDbId,
|
||||||
findMongoById,
|
|
||||||
findEnvironmentById,
|
findEnvironmentById,
|
||||||
|
findMongoById,
|
||||||
findProjectById,
|
findProjectById,
|
||||||
IS_CLOUD,
|
IS_CLOUD,
|
||||||
rebuildDatabase,
|
rebuildDatabase,
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import {
|
|||||||
createCustomNotification,
|
createCustomNotification,
|
||||||
createDiscordNotification,
|
createDiscordNotification,
|
||||||
createEmailNotification,
|
createEmailNotification,
|
||||||
createLarkNotification,
|
|
||||||
createGotifyNotification,
|
createGotifyNotification,
|
||||||
|
createLarkNotification,
|
||||||
createNtfyNotification,
|
createNtfyNotification,
|
||||||
createSlackNotification,
|
createSlackNotification,
|
||||||
createTelegramNotification,
|
createTelegramNotification,
|
||||||
@@ -13,8 +13,8 @@ import {
|
|||||||
sendCustomNotification,
|
sendCustomNotification,
|
||||||
sendDiscordNotification,
|
sendDiscordNotification,
|
||||||
sendEmailNotification,
|
sendEmailNotification,
|
||||||
sendLarkNotification,
|
|
||||||
sendGotifyNotification,
|
sendGotifyNotification,
|
||||||
|
sendLarkNotification,
|
||||||
sendNtfyNotification,
|
sendNtfyNotification,
|
||||||
sendServerThresholdNotifications,
|
sendServerThresholdNotifications,
|
||||||
sendSlackNotification,
|
sendSlackNotification,
|
||||||
@@ -22,8 +22,8 @@ import {
|
|||||||
updateCustomNotification,
|
updateCustomNotification,
|
||||||
updateDiscordNotification,
|
updateDiscordNotification,
|
||||||
updateEmailNotification,
|
updateEmailNotification,
|
||||||
updateLarkNotification,
|
|
||||||
updateGotifyNotification,
|
updateGotifyNotification,
|
||||||
|
updateLarkNotification,
|
||||||
updateNtfyNotification,
|
updateNtfyNotification,
|
||||||
updateSlackNotification,
|
updateSlackNotification,
|
||||||
updateTelegramNotification,
|
updateTelegramNotification,
|
||||||
@@ -42,8 +42,8 @@ import {
|
|||||||
apiCreateCustom,
|
apiCreateCustom,
|
||||||
apiCreateDiscord,
|
apiCreateDiscord,
|
||||||
apiCreateEmail,
|
apiCreateEmail,
|
||||||
apiCreateLark,
|
|
||||||
apiCreateGotify,
|
apiCreateGotify,
|
||||||
|
apiCreateLark,
|
||||||
apiCreateNtfy,
|
apiCreateNtfy,
|
||||||
apiCreateSlack,
|
apiCreateSlack,
|
||||||
apiCreateTelegram,
|
apiCreateTelegram,
|
||||||
@@ -51,16 +51,16 @@ import {
|
|||||||
apiTestCustomConnection,
|
apiTestCustomConnection,
|
||||||
apiTestDiscordConnection,
|
apiTestDiscordConnection,
|
||||||
apiTestEmailConnection,
|
apiTestEmailConnection,
|
||||||
apiTestLarkConnection,
|
|
||||||
apiTestGotifyConnection,
|
apiTestGotifyConnection,
|
||||||
|
apiTestLarkConnection,
|
||||||
apiTestNtfyConnection,
|
apiTestNtfyConnection,
|
||||||
apiTestSlackConnection,
|
apiTestSlackConnection,
|
||||||
apiTestTelegramConnection,
|
apiTestTelegramConnection,
|
||||||
apiUpdateCustom,
|
apiUpdateCustom,
|
||||||
apiUpdateDiscord,
|
apiUpdateDiscord,
|
||||||
apiUpdateEmail,
|
apiUpdateEmail,
|
||||||
apiUpdateLark,
|
|
||||||
apiUpdateGotify,
|
apiUpdateGotify,
|
||||||
|
apiUpdateLark,
|
||||||
apiUpdateNtfy,
|
apiUpdateNtfy,
|
||||||
apiUpdateSlack,
|
apiUpdateSlack,
|
||||||
apiUpdateTelegram,
|
apiUpdateTelegram,
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ import {
|
|||||||
createDefaultServerTraefikConfig,
|
createDefaultServerTraefikConfig,
|
||||||
createDefaultTraefikConfig,
|
createDefaultTraefikConfig,
|
||||||
IS_CLOUD,
|
IS_CLOUD,
|
||||||
|
initCancelDeployments,
|
||||||
initCronJobs,
|
initCronJobs,
|
||||||
initializeNetwork,
|
initializeNetwork,
|
||||||
initSchedules,
|
initSchedules,
|
||||||
initVolumeBackupsCronJobs,
|
initVolumeBackupsCronJobs,
|
||||||
initCancelDeployments,
|
|
||||||
sendDokployRestartNotifications,
|
sendDokployRestartNotifications,
|
||||||
setupDirectories,
|
setupDirectories,
|
||||||
} from "@dokploy/server";
|
} from "@dokploy/server";
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { nanoid } from "nanoid";
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { environments } from "./environment";
|
import { environments } from "./environment";
|
||||||
import { mounts } from "./mount";
|
import { mounts } from "./mount";
|
||||||
import { projects } from "./project";
|
|
||||||
import { server } from "./server";
|
import { server } from "./server";
|
||||||
import {
|
import {
|
||||||
applicationStatus,
|
applicationStatus,
|
||||||
|
|||||||
@@ -3,24 +3,24 @@ import {
|
|||||||
type apiCreateCustom,
|
type apiCreateCustom,
|
||||||
type apiCreateDiscord,
|
type apiCreateDiscord,
|
||||||
type apiCreateEmail,
|
type apiCreateEmail,
|
||||||
type apiCreateLark,
|
|
||||||
type apiCreateGotify,
|
type apiCreateGotify,
|
||||||
|
type apiCreateLark,
|
||||||
type apiCreateNtfy,
|
type apiCreateNtfy,
|
||||||
type apiCreateSlack,
|
type apiCreateSlack,
|
||||||
type apiCreateTelegram,
|
type apiCreateTelegram,
|
||||||
type apiUpdateCustom,
|
type apiUpdateCustom,
|
||||||
type apiUpdateDiscord,
|
type apiUpdateDiscord,
|
||||||
type apiUpdateEmail,
|
type apiUpdateEmail,
|
||||||
type apiUpdateLark,
|
|
||||||
type apiUpdateGotify,
|
type apiUpdateGotify,
|
||||||
|
type apiUpdateLark,
|
||||||
type apiUpdateNtfy,
|
type apiUpdateNtfy,
|
||||||
type apiUpdateSlack,
|
type apiUpdateSlack,
|
||||||
type apiUpdateTelegram,
|
type apiUpdateTelegram,
|
||||||
custom,
|
custom,
|
||||||
discord,
|
discord,
|
||||||
email,
|
email,
|
||||||
lark,
|
|
||||||
gotify,
|
gotify,
|
||||||
|
lark,
|
||||||
notifications,
|
notifications,
|
||||||
ntfy,
|
ntfy,
|
||||||
slack,
|
slack,
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import {
|
|||||||
createDeploymentBackup,
|
createDeploymentBackup,
|
||||||
updateDeploymentStatus,
|
updateDeploymentStatus,
|
||||||
} from "@dokploy/server/services/deployment";
|
} from "@dokploy/server/services/deployment";
|
||||||
import type { Mariadb } from "@dokploy/server/services/mariadb";
|
|
||||||
import { findEnvironmentById } from "@dokploy/server/services/environment";
|
import { findEnvironmentById } from "@dokploy/server/services/environment";
|
||||||
|
import type { Mariadb } from "@dokploy/server/services/mariadb";
|
||||||
import { findProjectById } from "@dokploy/server/services/project";
|
import { findProjectById } from "@dokploy/server/services/project";
|
||||||
import { sendDatabaseBackupNotifications } from "../notifications/database-backup";
|
import { sendDatabaseBackupNotifications } from "../notifications/database-backup";
|
||||||
import { execAsync, execAsyncRemote } from "../process/execAsync";
|
import { execAsync, execAsyncRemote } from "../process/execAsync";
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import {
|
|||||||
createDeploymentBackup,
|
createDeploymentBackup,
|
||||||
updateDeploymentStatus,
|
updateDeploymentStatus,
|
||||||
} from "@dokploy/server/services/deployment";
|
} from "@dokploy/server/services/deployment";
|
||||||
import type { Mongo } from "@dokploy/server/services/mongo";
|
|
||||||
import { findEnvironmentById } from "@dokploy/server/services/environment";
|
import { findEnvironmentById } from "@dokploy/server/services/environment";
|
||||||
|
import type { Mongo } from "@dokploy/server/services/mongo";
|
||||||
import { findProjectById } from "@dokploy/server/services/project";
|
import { findProjectById } from "@dokploy/server/services/project";
|
||||||
import { sendDatabaseBackupNotifications } from "../notifications/database-backup";
|
import { sendDatabaseBackupNotifications } from "../notifications/database-backup";
|
||||||
import { execAsync, execAsyncRemote } from "../process/execAsync";
|
import { execAsync, execAsyncRemote } from "../process/execAsync";
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import {
|
|||||||
createDeploymentBackup,
|
createDeploymentBackup,
|
||||||
updateDeploymentStatus,
|
updateDeploymentStatus,
|
||||||
} from "@dokploy/server/services/deployment";
|
} from "@dokploy/server/services/deployment";
|
||||||
import type { MySql } from "@dokploy/server/services/mysql";
|
|
||||||
import { findEnvironmentById } from "@dokploy/server/services/environment";
|
import { findEnvironmentById } from "@dokploy/server/services/environment";
|
||||||
|
import type { MySql } from "@dokploy/server/services/mysql";
|
||||||
import { findProjectById } from "@dokploy/server/services/project";
|
import { findProjectById } from "@dokploy/server/services/project";
|
||||||
import { sendDatabaseBackupNotifications } from "../notifications/database-backup";
|
import { sendDatabaseBackupNotifications } from "../notifications/database-backup";
|
||||||
import { execAsync, execAsyncRemote } from "../process/execAsync";
|
import { execAsync, execAsyncRemote } from "../process/execAsync";
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import {
|
|||||||
createDeploymentBackup,
|
createDeploymentBackup,
|
||||||
updateDeploymentStatus,
|
updateDeploymentStatus,
|
||||||
} from "@dokploy/server/services/deployment";
|
} from "@dokploy/server/services/deployment";
|
||||||
import type { Postgres } from "@dokploy/server/services/postgres";
|
|
||||||
import { findEnvironmentById } from "@dokploy/server/services/environment";
|
import { findEnvironmentById } from "@dokploy/server/services/environment";
|
||||||
|
import type { Postgres } from "@dokploy/server/services/postgres";
|
||||||
import { findProjectById } from "@dokploy/server/services/project";
|
import { findProjectById } from "@dokploy/server/services/project";
|
||||||
import { sendDatabaseBackupNotifications } from "../notifications/database-backup";
|
import { sendDatabaseBackupNotifications } from "../notifications/database-backup";
|
||||||
import { execAsync, execAsyncRemote } from "../process/execAsync";
|
import { execAsync, execAsyncRemote } from "../process/execAsync";
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import {
|
|||||||
sendCustomNotification,
|
sendCustomNotification,
|
||||||
sendDiscordNotification,
|
sendDiscordNotification,
|
||||||
sendEmailNotification,
|
sendEmailNotification,
|
||||||
sendLarkNotification,
|
|
||||||
sendGotifyNotification,
|
sendGotifyNotification,
|
||||||
|
sendLarkNotification,
|
||||||
sendNtfyNotification,
|
sendNtfyNotification,
|
||||||
sendSlackNotification,
|
sendSlackNotification,
|
||||||
sendTelegramNotification,
|
sendTelegramNotification,
|
||||||
|
|||||||
@@ -6,337 +6,337 @@ import { renderAsync } from "@react-email/components";
|
|||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
import { and, eq } from "drizzle-orm";
|
import { and, eq } from "drizzle-orm";
|
||||||
import {
|
import {
|
||||||
sendCustomNotification,
|
sendCustomNotification,
|
||||||
sendDiscordNotification,
|
sendDiscordNotification,
|
||||||
sendEmailNotification,
|
sendEmailNotification,
|
||||||
sendLarkNotification,
|
sendGotifyNotification,
|
||||||
sendGotifyNotification,
|
sendLarkNotification,
|
||||||
sendNtfyNotification,
|
sendNtfyNotification,
|
||||||
sendSlackNotification,
|
sendSlackNotification,
|
||||||
sendTelegramNotification,
|
sendTelegramNotification,
|
||||||
} from "./utils";
|
} from "./utils";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
projectName: string;
|
projectName: string;
|
||||||
applicationName: string;
|
applicationName: string;
|
||||||
applicationType: string;
|
applicationType: string;
|
||||||
buildLink: string;
|
buildLink: string;
|
||||||
organizationId: string;
|
organizationId: string;
|
||||||
domains: Domain[];
|
domains: Domain[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const sendBuildSuccessNotifications = async ({
|
export const sendBuildSuccessNotifications = async ({
|
||||||
projectName,
|
projectName,
|
||||||
applicationName,
|
applicationName,
|
||||||
applicationType,
|
applicationType,
|
||||||
buildLink,
|
buildLink,
|
||||||
organizationId,
|
organizationId,
|
||||||
domains,
|
domains,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
const unixDate = ~~(Number(date) / 1000);
|
const unixDate = ~~(Number(date) / 1000);
|
||||||
const notificationList = await db.query.notifications.findMany({
|
const notificationList = await db.query.notifications.findMany({
|
||||||
where: and(
|
where: and(
|
||||||
eq(notifications.appDeploy, true),
|
eq(notifications.appDeploy, true),
|
||||||
eq(notifications.organizationId, organizationId)
|
eq(notifications.organizationId, organizationId),
|
||||||
),
|
),
|
||||||
with: {
|
with: {
|
||||||
email: true,
|
email: true,
|
||||||
discord: true,
|
discord: true,
|
||||||
telegram: true,
|
telegram: true,
|
||||||
slack: true,
|
slack: true,
|
||||||
gotify: true,
|
gotify: true,
|
||||||
ntfy: true,
|
ntfy: true,
|
||||||
custom: true,
|
custom: true,
|
||||||
lark: true,
|
lark: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const notification of notificationList) {
|
for (const notification of notificationList) {
|
||||||
const { email, discord, telegram, slack, gotify, ntfy, custom, lark } =
|
const { email, discord, telegram, slack, gotify, ntfy, custom, lark } =
|
||||||
notification;
|
notification;
|
||||||
|
|
||||||
if (email) {
|
if (email) {
|
||||||
const template = await renderAsync(
|
const template = await renderAsync(
|
||||||
BuildSuccessEmail({
|
BuildSuccessEmail({
|
||||||
projectName,
|
projectName,
|
||||||
applicationName,
|
applicationName,
|
||||||
applicationType,
|
applicationType,
|
||||||
buildLink,
|
buildLink,
|
||||||
date: date.toLocaleString(),
|
date: date.toLocaleString(),
|
||||||
})
|
}),
|
||||||
).catch();
|
).catch();
|
||||||
await sendEmailNotification(email, "Build success for dokploy", template);
|
await sendEmailNotification(email, "Build success for dokploy", template);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (discord) {
|
if (discord) {
|
||||||
const decorate = (decoration: string, text: string) =>
|
const decorate = (decoration: string, text: string) =>
|
||||||
`${discord.decoration ? decoration : ""} ${text}`.trim();
|
`${discord.decoration ? decoration : ""} ${text}`.trim();
|
||||||
|
|
||||||
await sendDiscordNotification(discord, {
|
await sendDiscordNotification(discord, {
|
||||||
title: decorate(">", "`✅` Build Success"),
|
title: decorate(">", "`✅` Build Success"),
|
||||||
color: 0x57f287,
|
color: 0x57f287,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: decorate("`🛠️`", "Project"),
|
name: decorate("`🛠️`", "Project"),
|
||||||
value: projectName,
|
value: projectName,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: decorate("`⚙️`", "Application"),
|
name: decorate("`⚙️`", "Application"),
|
||||||
value: applicationName,
|
value: applicationName,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: decorate("`❔`", "Type"),
|
name: decorate("`❔`", "Type"),
|
||||||
value: applicationType,
|
value: applicationType,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: decorate("`📅`", "Date"),
|
name: decorate("`📅`", "Date"),
|
||||||
value: `<t:${unixDate}:D>`,
|
value: `<t:${unixDate}:D>`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: decorate("`⌚`", "Time"),
|
name: decorate("`⌚`", "Time"),
|
||||||
value: `<t:${unixDate}:t>`,
|
value: `<t:${unixDate}:t>`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: decorate("`❓`", "Type"),
|
name: decorate("`❓`", "Type"),
|
||||||
value: "Successful",
|
value: "Successful",
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: decorate("`🧷`", "Build Link"),
|
name: decorate("`🧷`", "Build Link"),
|
||||||
value: `[Click here to access build link](${buildLink})`,
|
value: `[Click here to access build link](${buildLink})`,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
timestamp: date.toISOString(),
|
timestamp: date.toISOString(),
|
||||||
footer: {
|
footer: {
|
||||||
text: "Dokploy Build Notification",
|
text: "Dokploy Build Notification",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gotify) {
|
if (gotify) {
|
||||||
const decorate = (decoration: string, text: string) =>
|
const decorate = (decoration: string, text: string) =>
|
||||||
`${gotify.decoration ? decoration : ""} ${text}\n`;
|
`${gotify.decoration ? decoration : ""} ${text}\n`;
|
||||||
await sendGotifyNotification(
|
await sendGotifyNotification(
|
||||||
gotify,
|
gotify,
|
||||||
decorate("✅", "Build Success"),
|
decorate("✅", "Build Success"),
|
||||||
`${decorate("🛠️", `Project: ${projectName}`)}` +
|
`${decorate("🛠️", `Project: ${projectName}`)}` +
|
||||||
`${decorate("⚙️", `Application: ${applicationName}`)}` +
|
`${decorate("⚙️", `Application: ${applicationName}`)}` +
|
||||||
`${decorate("❔", `Type: ${applicationType}`)}` +
|
`${decorate("❔", `Type: ${applicationType}`)}` +
|
||||||
`${decorate("🕒", `Date: ${date.toLocaleString()}`)}` +
|
`${decorate("🕒", `Date: ${date.toLocaleString()}`)}` +
|
||||||
`${decorate("🔗", `Build details:\n${buildLink}`)}`
|
`${decorate("🔗", `Build details:\n${buildLink}`)}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ntfy) {
|
if (ntfy) {
|
||||||
await sendNtfyNotification(
|
await sendNtfyNotification(
|
||||||
ntfy,
|
ntfy,
|
||||||
"Build Success",
|
"Build Success",
|
||||||
"white_check_mark",
|
"white_check_mark",
|
||||||
`view, Build details, ${buildLink}, clear=true;`,
|
`view, Build details, ${buildLink}, clear=true;`,
|
||||||
`🛠Project: ${projectName}\n` +
|
`🛠Project: ${projectName}\n` +
|
||||||
`⚙️Application: ${applicationName}\n` +
|
`⚙️Application: ${applicationName}\n` +
|
||||||
`❔Type: ${applicationType}\n` +
|
`❔Type: ${applicationType}\n` +
|
||||||
`🕒Date: ${date.toLocaleString()}`
|
`🕒Date: ${date.toLocaleString()}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (telegram) {
|
if (telegram) {
|
||||||
const chunkArray = <T>(array: T[], chunkSize: number): T[][] =>
|
const chunkArray = <T>(array: T[], chunkSize: number): T[][] =>
|
||||||
Array.from({ length: Math.ceil(array.length / chunkSize) }, (_, i) =>
|
Array.from({ length: Math.ceil(array.length / chunkSize) }, (_, i) =>
|
||||||
array.slice(i * chunkSize, i * chunkSize + chunkSize)
|
array.slice(i * chunkSize, i * chunkSize + chunkSize),
|
||||||
);
|
);
|
||||||
|
|
||||||
const inlineButton = [
|
const inlineButton = [
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
text: "Deployment Logs",
|
text: "Deployment Logs",
|
||||||
url: buildLink,
|
url: buildLink,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
...chunkArray(domains, 2).map((chunk) =>
|
...chunkArray(domains, 2).map((chunk) =>
|
||||||
chunk.map((data) => ({
|
chunk.map((data) => ({
|
||||||
text: data.host,
|
text: data.host,
|
||||||
url: `${data.https ? "https" : "http"}://${data.host}`,
|
url: `${data.https ? "https" : "http"}://${data.host}`,
|
||||||
}))
|
})),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
await sendTelegramNotification(
|
await sendTelegramNotification(
|
||||||
telegram,
|
telegram,
|
||||||
`<b>✅ Build Success</b>\n\n<b>Project:</b> ${projectName}\n<b>Application:</b> ${applicationName}\n<b>Type:</b> ${applicationType}\n<b>Date:</b> ${format(
|
`<b>✅ Build Success</b>\n\n<b>Project:</b> ${projectName}\n<b>Application:</b> ${applicationName}\n<b>Type:</b> ${applicationType}\n<b>Date:</b> ${format(
|
||||||
date,
|
date,
|
||||||
"PP"
|
"PP",
|
||||||
)}\n<b>Time:</b> ${format(date, "pp")}`,
|
)}\n<b>Time:</b> ${format(date, "pp")}`,
|
||||||
inlineButton
|
inlineButton,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slack) {
|
if (slack) {
|
||||||
const { channel } = slack;
|
const { channel } = slack;
|
||||||
await sendSlackNotification(slack, {
|
await sendSlackNotification(slack, {
|
||||||
channel: channel,
|
channel: channel,
|
||||||
attachments: [
|
attachments: [
|
||||||
{
|
{
|
||||||
color: "#00FF00",
|
color: "#00FF00",
|
||||||
pretext: ":white_check_mark: *Build Success*",
|
pretext: ":white_check_mark: *Build Success*",
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
title: "Project",
|
title: "Project",
|
||||||
value: projectName,
|
value: projectName,
|
||||||
short: true,
|
short: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Application",
|
title: "Application",
|
||||||
value: applicationName,
|
value: applicationName,
|
||||||
short: true,
|
short: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Type",
|
title: "Type",
|
||||||
value: applicationType,
|
value: applicationType,
|
||||||
short: true,
|
short: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Time",
|
title: "Time",
|
||||||
value: date.toLocaleString(),
|
value: date.toLocaleString(),
|
||||||
short: true,
|
short: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
actions: [
|
actions: [
|
||||||
{
|
{
|
||||||
type: "button",
|
type: "button",
|
||||||
text: "View Build Details",
|
text: "View Build Details",
|
||||||
url: buildLink,
|
url: buildLink,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (custom) {
|
if (custom) {
|
||||||
await sendCustomNotification(custom, {
|
await sendCustomNotification(custom, {
|
||||||
title: "Build Success",
|
title: "Build Success",
|
||||||
message: "Build completed successfully",
|
message: "Build completed successfully",
|
||||||
projectName,
|
projectName,
|
||||||
applicationName,
|
applicationName,
|
||||||
applicationType,
|
applicationType,
|
||||||
buildLink,
|
buildLink,
|
||||||
timestamp: date.toISOString(),
|
timestamp: date.toISOString(),
|
||||||
date: date.toLocaleString(),
|
date: date.toLocaleString(),
|
||||||
domains: domains.map((domain) => domain.host).join(", "),
|
domains: domains.map((domain) => domain.host).join(", "),
|
||||||
status: "success",
|
status: "success",
|
||||||
type: "build",
|
type: "build",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lark) {
|
if (lark) {
|
||||||
await sendLarkNotification(lark, {
|
await sendLarkNotification(lark, {
|
||||||
msg_type: "interactive",
|
msg_type: "interactive",
|
||||||
card: {
|
card: {
|
||||||
schema: "2.0",
|
schema: "2.0",
|
||||||
config: {
|
config: {
|
||||||
update_multi: true,
|
update_multi: true,
|
||||||
style: {
|
style: {
|
||||||
text_size: {
|
text_size: {
|
||||||
normal_v2: {
|
normal_v2: {
|
||||||
default: "normal",
|
default: "normal",
|
||||||
pc: "normal",
|
pc: "normal",
|
||||||
mobile: "heading",
|
mobile: "heading",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
title: {
|
title: {
|
||||||
tag: "plain_text",
|
tag: "plain_text",
|
||||||
content: "✅ Build Success",
|
content: "✅ Build Success",
|
||||||
},
|
},
|
||||||
subtitle: {
|
subtitle: {
|
||||||
tag: "plain_text",
|
tag: "plain_text",
|
||||||
content: "",
|
content: "",
|
||||||
},
|
},
|
||||||
template: "green",
|
template: "green",
|
||||||
padding: "12px 12px 12px 12px",
|
padding: "12px 12px 12px 12px",
|
||||||
},
|
},
|
||||||
body: {
|
body: {
|
||||||
direction: "vertical",
|
direction: "vertical",
|
||||||
padding: "12px 12px 12px 12px",
|
padding: "12px 12px 12px 12px",
|
||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
tag: "column_set",
|
tag: "column_set",
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
tag: "column",
|
tag: "column",
|
||||||
width: "weighted",
|
width: "weighted",
|
||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
tag: "markdown",
|
tag: "markdown",
|
||||||
content: `**Project:**\n${projectName}`,
|
content: `**Project:**\n${projectName}`,
|
||||||
text_align: "left",
|
text_align: "left",
|
||||||
text_size: "normal_v2",
|
text_size: "normal_v2",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
tag: "markdown",
|
tag: "markdown",
|
||||||
content: `**Type:**\n${applicationType}`,
|
content: `**Type:**\n${applicationType}`,
|
||||||
text_align: "left",
|
text_align: "left",
|
||||||
text_size: "normal_v2",
|
text_size: "normal_v2",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
vertical_align: "top",
|
vertical_align: "top",
|
||||||
weight: 1,
|
weight: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
tag: "column",
|
tag: "column",
|
||||||
width: "weighted",
|
width: "weighted",
|
||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
tag: "markdown",
|
tag: "markdown",
|
||||||
content: `**Application:**\n${applicationName}`,
|
content: `**Application:**\n${applicationName}`,
|
||||||
text_align: "left",
|
text_align: "left",
|
||||||
text_size: "normal_v2",
|
text_size: "normal_v2",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
tag: "markdown",
|
tag: "markdown",
|
||||||
content: `**Date:**\n${format(date, "PP pp")}`,
|
content: `**Date:**\n${format(date, "PP pp")}`,
|
||||||
text_align: "left",
|
text_align: "left",
|
||||||
text_size: "normal_v2",
|
text_size: "normal_v2",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
vertical_align: "top",
|
vertical_align: "top",
|
||||||
weight: 1,
|
weight: 1,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
tag: "button",
|
tag: "button",
|
||||||
text: {
|
text: {
|
||||||
tag: "plain_text",
|
tag: "plain_text",
|
||||||
content: "View Build Details",
|
content: "View Build Details",
|
||||||
},
|
},
|
||||||
type: "primary",
|
type: "primary",
|
||||||
width: "default",
|
width: "default",
|
||||||
size: "medium",
|
size: "medium",
|
||||||
behaviors: [
|
behaviors: [
|
||||||
{
|
{
|
||||||
type: "open_url",
|
type: "open_url",
|
||||||
default_url: buildLink,
|
default_url: buildLink,
|
||||||
pc_url: "",
|
pc_url: "",
|
||||||
ios_url: "",
|
ios_url: "",
|
||||||
android_url: "",
|
android_url: "",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
margin: "0px 0px 0px 0px",
|
margin: "0px 0px 0px 0px",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import {
|
|||||||
sendCustomNotification,
|
sendCustomNotification,
|
||||||
sendDiscordNotification,
|
sendDiscordNotification,
|
||||||
sendEmailNotification,
|
sendEmailNotification,
|
||||||
sendLarkNotification,
|
|
||||||
sendGotifyNotification,
|
sendGotifyNotification,
|
||||||
|
sendLarkNotification,
|
||||||
sendNtfyNotification,
|
sendNtfyNotification,
|
||||||
sendSlackNotification,
|
sendSlackNotification,
|
||||||
sendTelegramNotification,
|
sendTelegramNotification,
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import {
|
|||||||
sendCustomNotification,
|
sendCustomNotification,
|
||||||
sendDiscordNotification,
|
sendDiscordNotification,
|
||||||
sendEmailNotification,
|
sendEmailNotification,
|
||||||
sendLarkNotification,
|
|
||||||
sendGotifyNotification,
|
sendGotifyNotification,
|
||||||
|
sendLarkNotification,
|
||||||
sendNtfyNotification,
|
sendNtfyNotification,
|
||||||
sendSlackNotification,
|
sendSlackNotification,
|
||||||
sendTelegramNotification,
|
sendTelegramNotification,
|
||||||
@@ -195,7 +195,7 @@ export const sendDockerCleanupNotifications = async (
|
|||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
tag: "markdown",
|
tag: "markdown",
|
||||||
content: `**Status:**\nSuccessful`,
|
content: "**Status:**\nSuccessful",
|
||||||
text_align: "left",
|
text_align: "left",
|
||||||
text_size: "normal_v2",
|
text_size: "normal_v2",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import {
|
|||||||
sendCustomNotification,
|
sendCustomNotification,
|
||||||
sendDiscordNotification,
|
sendDiscordNotification,
|
||||||
sendEmailNotification,
|
sendEmailNotification,
|
||||||
sendLarkNotification,
|
|
||||||
sendGotifyNotification,
|
sendGotifyNotification,
|
||||||
|
sendLarkNotification,
|
||||||
sendNtfyNotification,
|
sendNtfyNotification,
|
||||||
sendSlackNotification,
|
sendSlackNotification,
|
||||||
sendTelegramNotification,
|
sendTelegramNotification,
|
||||||
@@ -199,7 +199,7 @@ export const sendDokployRestartNotifications = async () => {
|
|||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
tag: "markdown",
|
tag: "markdown",
|
||||||
content: `**Status:**\nSuccessful`,
|
content: "**Status:**\nSuccessful",
|
||||||
text_align: "left",
|
text_align: "left",
|
||||||
text_size: "normal_v2",
|
text_size: "normal_v2",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import type {
|
|||||||
custom,
|
custom,
|
||||||
discord,
|
discord,
|
||||||
email,
|
email,
|
||||||
lark,
|
|
||||||
gotify,
|
gotify,
|
||||||
|
lark,
|
||||||
ntfy,
|
ntfy,
|
||||||
slack,
|
slack,
|
||||||
telegram,
|
telegram,
|
||||||
|
|||||||
Reference in New Issue
Block a user