mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: update migrations
This commit is contained in:
@@ -133,7 +133,9 @@ export const AddTemplate = ({ projectId }: Props) => {
|
|||||||
<PopoverTrigger asChild>
|
<PopoverTrigger asChild>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
className={cn("w-full sm:w-[200px] justify-between !bg-input")}
|
className={cn(
|
||||||
|
"w-full sm:w-[200px] justify-between !bg-input",
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
{isLoadingTags
|
{isLoadingTags
|
||||||
? "Loading...."
|
? "Loading...."
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import { CodeEditor } from "@/components/shared/code-editor";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { ScrollArea } from "@/components/ui/scroll-area";
|
import { ScrollArea } from "@/components/ui/scroll-area";
|
||||||
import ReactMarkdown from "react-markdown";
|
import ReactMarkdown from "react-markdown";
|
||||||
import {CodeEditor} from "@/components/shared/code-editor";
|
|
||||||
|
|
||||||
export const StepFour = ({
|
export const StepFour = ({
|
||||||
prevStep,
|
prevStep,
|
||||||
@@ -76,4 +76,4 @@ export const StepFour = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -66,4 +66,4 @@ export const StepOne = ({ nextStep, setTemplateInfo, templateInfo }: any) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -81,4 +81,4 @@ export const StepThree = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { CodeEditor } from "@/components/shared/code-editor";
|
||||||
import {
|
import {
|
||||||
Accordion,
|
Accordion,
|
||||||
AccordionContent,
|
AccordionContent,
|
||||||
@@ -14,7 +15,6 @@ import { Bot, Eye, EyeOff, PlusCircle, Trash2 } from "lucide-react";
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import ReactMarkdown from "react-markdown";
|
import ReactMarkdown from "react-markdown";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import {CodeEditor} from "@/components/shared/code-editor";
|
|
||||||
|
|
||||||
interface EnvVariable {
|
interface EnvVariable {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -304,4 +304,4 @@ export const StepTwo = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -156,4 +156,4 @@ export const TemplateGenerator = ({ projectId }: Props) => {
|
|||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ interface Model {
|
|||||||
owned_by: string;
|
owned_by: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AiForm = ()=> {
|
export const AiForm = () => {
|
||||||
const [models, setModels] = useState<Model[]>([]);
|
const [models, setModels] = useState<Model[]>([]);
|
||||||
const [isLoadingModels, setIsLoadingModels] = useState(false);
|
const [isLoadingModels, setIsLoadingModels] = useState(false);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
@@ -273,4 +273,4 @@ export const AiForm = ()=> {
|
|||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|||||||
4355
apps/dokploy/drizzle/meta/0057_snapshot.json
Normal file
4355
apps/dokploy/drizzle/meta/0057_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -400,6 +400,13 @@
|
|||||||
"when": 1736789918294,
|
"when": 1736789918294,
|
||||||
"tag": "0056_majestic_skaar",
|
"tag": "0056_majestic_skaar",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 57,
|
||||||
|
"version": "6",
|
||||||
|
"when": 1737246538368,
|
||||||
|
"tag": "0057_mature_thaddeus_ross",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -168,8 +168,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"commitlint": {
|
"commitlint": {
|
||||||
"extends": [
|
"extends": ["@commitlint/config-conventional"]
|
||||||
"@commitlint/config-conventional"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,7 +239,10 @@ export const projectRouter = createTRPCRouter({
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
function buildServiceFilter(fieldName: AnyPgColumn, accessedServices: string[]) {
|
function buildServiceFilter(
|
||||||
|
fieldName: AnyPgColumn,
|
||||||
|
accessedServices: string[],
|
||||||
|
) {
|
||||||
return accessedServices.length > 0
|
return accessedServices.length > 0
|
||||||
? sql`${fieldName} IN (${sql.join(
|
? sql`${fieldName} IN (${sql.join(
|
||||||
accessedServices.map((serviceId) => sql`${serviceId}`),
|
accessedServices.map((serviceId) => sql`${serviceId}`),
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
* {
|
* {
|
||||||
@apply border-border;
|
@apply border-border;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
@apply bg-background text-foreground;
|
@apply bg-background text-foreground;
|
||||||
}
|
}
|
||||||
@@ -110,16 +110,16 @@
|
|||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
width: 0.3125rem;
|
width: 0.3125rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-track {
|
::-webkit-scrollbar-track {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb {
|
::-webkit-scrollbar-thumb {
|
||||||
background: hsl(var(--border));
|
background: hsl(var(--border));
|
||||||
border-radius: 0.3125rem;
|
border-radius: 0.3125rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
scrollbar-width: thin;
|
scrollbar-width: thin;
|
||||||
scrollbar-color: hsl(var(--border)) transparent;
|
scrollbar-color: hsl(var(--border)) transparent;
|
||||||
|
|||||||
@@ -1269,7 +1269,8 @@ export const templates: TemplateData[] = [
|
|||||||
},
|
},
|
||||||
tags: ["cloud", "networking", "security", "tunnel"],
|
tags: ["cloud", "networking", "security", "tunnel"],
|
||||||
load: () => import("./cloudflared/index").then((m) => m.generate),
|
load: () => import("./cloudflared/index").then((m) => m.generate),
|
||||||
},{
|
},
|
||||||
|
{
|
||||||
id: "couchdb",
|
id: "couchdb",
|
||||||
name: "CouchDB",
|
name: "CouchDB",
|
||||||
version: "latest",
|
version: "latest",
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ export const deployApplication = async ({
|
|||||||
applicationType: "application",
|
applicationType: "application",
|
||||||
buildLink,
|
buildLink,
|
||||||
adminId: application.project.adminId,
|
adminId: application.project.adminId,
|
||||||
domains: application.domains
|
domains: application.domains,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await updateDeploymentStatus(deployment.deploymentId, "error");
|
await updateDeploymentStatus(deployment.deploymentId, "error");
|
||||||
@@ -333,7 +333,7 @@ export const deployRemoteApplication = async ({
|
|||||||
applicationType: "application",
|
applicationType: "application",
|
||||||
buildLink,
|
buildLink,
|
||||||
adminId: application.project.adminId,
|
adminId: application.project.adminId,
|
||||||
domains: application.domains
|
domains: application.domains,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|||||||
@@ -73,7 +73,8 @@ export const canPerformCreationService = async (
|
|||||||
userId: string,
|
userId: string,
|
||||||
projectId: string,
|
projectId: string,
|
||||||
) => {
|
) => {
|
||||||
const { accessedProjects, canCreateServices } = await findUserByAuthId(userId);
|
const { accessedProjects, canCreateServices } =
|
||||||
|
await findUserByAuthId(userId);
|
||||||
const haveAccessToProject = accessedProjects.includes(projectId);
|
const haveAccessToProject = accessedProjects.includes(projectId);
|
||||||
|
|
||||||
if (canCreateServices && haveAccessToProject) {
|
if (canCreateServices && haveAccessToProject) {
|
||||||
@@ -101,7 +102,8 @@ export const canPeformDeleteService = async (
|
|||||||
authId: string,
|
authId: string,
|
||||||
serviceId: string,
|
serviceId: string,
|
||||||
) => {
|
) => {
|
||||||
const { accessedServices, canDeleteServices } = await findUserByAuthId(authId);
|
const { accessedServices, canDeleteServices } =
|
||||||
|
await findUserByAuthId(authId);
|
||||||
const haveAccessToService = accessedServices.includes(serviceId);
|
const haveAccessToService = accessedServices.includes(serviceId);
|
||||||
|
|
||||||
if (canDeleteServices && haveAccessToService) {
|
if (canDeleteServices && haveAccessToService) {
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import { db } from "@dokploy/server/db";
|
|||||||
import { notifications } from "@dokploy/server/db/schema";
|
import { notifications } from "@dokploy/server/db/schema";
|
||||||
import BuildFailedEmail from "@dokploy/server/emails/emails/build-failed";
|
import BuildFailedEmail from "@dokploy/server/emails/emails/build-failed";
|
||||||
import { renderAsync } from "@react-email/components";
|
import { renderAsync } from "@react-email/components";
|
||||||
import { and, eq } from "drizzle-orm";
|
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
|
import { and, eq } from "drizzle-orm";
|
||||||
import {
|
import {
|
||||||
sendDiscordNotification,
|
sendDiscordNotification,
|
||||||
sendEmailNotification,
|
sendEmailNotification,
|
||||||
@@ -139,11 +139,11 @@ export const sendBuildErrorNotifications = async ({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
await sendTelegramNotification(
|
await sendTelegramNotification(
|
||||||
telegram,
|
telegram,
|
||||||
`<b>⚠️ Build Failed</b>\n\n<b>Project:</b> ${projectName}\n<b>Application:</b> ${applicationName}\n<b>Type:</b> ${applicationType}\n<b>Date:</b> ${format(date, "PP")}\n<b>Time:</b> ${format(date, "pp")}\n\n<b>Error:</b>\n<pre>${errorMessage}</pre>`,
|
`<b>⚠️ Build Failed</b>\n\n<b>Project:</b> ${projectName}\n<b>Application:</b> ${applicationName}\n<b>Type:</b> ${applicationType}\n<b>Date:</b> ${format(date, "PP")}\n<b>Time:</b> ${format(date, "pp")}\n\n<b>Error:</b>\n<pre>${errorMessage}</pre>`,
|
||||||
inlineButton
|
inlineButton,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { db } from "@dokploy/server/db";
|
import { db } from "@dokploy/server/db";
|
||||||
import { notifications } from "@dokploy/server/db/schema";
|
import { notifications } from "@dokploy/server/db/schema";
|
||||||
import BuildSuccessEmail from "@dokploy/server/emails/emails/build-success";
|
import BuildSuccessEmail from "@dokploy/server/emails/emails/build-success";
|
||||||
import { Domain } from "@dokploy/server/services/domain";
|
import type { Domain } from "@dokploy/server/services/domain";
|
||||||
import { renderAsync } from "@react-email/components";
|
import { renderAsync } from "@react-email/components";
|
||||||
import { and, eq } from "drizzle-orm";
|
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
|
import { and, eq } from "drizzle-orm";
|
||||||
import {
|
import {
|
||||||
sendDiscordNotification,
|
sendDiscordNotification,
|
||||||
sendEmailNotification,
|
sendEmailNotification,
|
||||||
@@ -28,7 +28,7 @@ export const sendBuildSuccessNotifications = async ({
|
|||||||
applicationType,
|
applicationType,
|
||||||
buildLink,
|
buildLink,
|
||||||
adminId,
|
adminId,
|
||||||
domains
|
domains,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
const unixDate = ~~(Number(date) / 1000);
|
const unixDate = ~~(Number(date) / 1000);
|
||||||
@@ -128,9 +128,10 @@ export const sendBuildSuccessNotifications = async ({
|
|||||||
|
|
||||||
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.slice(i * chunkSize, i * chunkSize + chunkSize)
|
Array.from({ length: Math.ceil(array.length / chunkSize) }, (_, i) =>
|
||||||
);
|
array.slice(i * chunkSize, i * chunkSize + chunkSize),
|
||||||
|
);
|
||||||
|
|
||||||
const inlineButton = [
|
const inlineButton = [
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@@ -142,14 +143,14 @@ export const sendBuildSuccessNotifications = async ({
|
|||||||
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(date, "PP")}\n<b>Time:</b> ${format(date, "pp")}`,
|
`<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, "PP")}\n<b>Time:</b> ${format(date, "pp")}`,
|
||||||
inlineButton
|
inlineButton,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import { db } from "@dokploy/server/db";
|
|||||||
import { notifications } from "@dokploy/server/db/schema";
|
import { notifications } from "@dokploy/server/db/schema";
|
||||||
import DatabaseBackupEmail from "@dokploy/server/emails/emails/database-backup";
|
import DatabaseBackupEmail from "@dokploy/server/emails/emails/database-backup";
|
||||||
import { renderAsync } from "@react-email/components";
|
import { renderAsync } from "@react-email/components";
|
||||||
import { and, eq } from "drizzle-orm";
|
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
|
import { and, eq } from "drizzle-orm";
|
||||||
import {
|
import {
|
||||||
sendDiscordNotification,
|
sendDiscordNotification,
|
||||||
sendEmailNotification,
|
sendEmailNotification,
|
||||||
@@ -144,13 +144,15 @@ export const sendDatabaseBackupNotifications = async ({
|
|||||||
|
|
||||||
if (telegram) {
|
if (telegram) {
|
||||||
const isError = type === "error" && errorMessage;
|
const isError = type === "error" && errorMessage;
|
||||||
|
|
||||||
const statusEmoji = type === "success" ? "✅" : "❌";
|
const statusEmoji = type === "success" ? "✅" : "❌";
|
||||||
const typeStatus = type === "success" ? "Successful" : "Failed";
|
const typeStatus = type === "success" ? "Successful" : "Failed";
|
||||||
const errorMsg = isError ? `\n\n<b>Error:</b>\n<pre>${errorMessage}</pre>` : "";
|
const errorMsg = isError
|
||||||
|
? `\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>Date:</b> ${format(date, "PP")}\n<b>Time:</b> ${format(date, "pp")}${isError ? errorMsg : ""}`;
|
||||||
|
|
||||||
await sendTelegramNotification(telegram, messageText);
|
await sendTelegramNotification(telegram, messageText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import { db } from "@dokploy/server/db";
|
|||||||
import { notifications } from "@dokploy/server/db/schema";
|
import { notifications } from "@dokploy/server/db/schema";
|
||||||
import DockerCleanupEmail from "@dokploy/server/emails/emails/docker-cleanup";
|
import DockerCleanupEmail from "@dokploy/server/emails/emails/docker-cleanup";
|
||||||
import { renderAsync } from "@react-email/components";
|
import { renderAsync } from "@react-email/components";
|
||||||
import { and, eq } from "drizzle-orm";
|
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
|
import { and, eq } from "drizzle-orm";
|
||||||
import {
|
import {
|
||||||
sendDiscordNotification,
|
sendDiscordNotification,
|
||||||
sendEmailNotification,
|
sendEmailNotification,
|
||||||
@@ -96,7 +96,7 @@ export const sendDockerCleanupNotifications = async (
|
|||||||
if (telegram) {
|
if (telegram) {
|
||||||
await sendTelegramNotification(
|
await sendTelegramNotification(
|
||||||
telegram,
|
telegram,
|
||||||
`<b>✅ Docker Cleanup</b>\n\n<b>Message:</b> ${message}\n<b>Date:</b> ${format(date, "PP")}\n<b>Time:</b> ${format(date, "pp")}`
|
`<b>✅ Docker Cleanup</b>\n\n<b>Message:</b> ${message}\n<b>Date:</b> ${format(date, "PP")}\n<b>Time:</b> ${format(date, "pp")}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { db } from "@dokploy/server/db";
|
|||||||
import { notifications } from "@dokploy/server/db/schema";
|
import { notifications } from "@dokploy/server/db/schema";
|
||||||
import DokployRestartEmail from "@dokploy/server/emails/emails/dokploy-restart";
|
import DokployRestartEmail from "@dokploy/server/emails/emails/dokploy-restart";
|
||||||
import { renderAsync } from "@react-email/components";
|
import { renderAsync } from "@react-email/components";
|
||||||
|
import { format } from "date-fns";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import {
|
import {
|
||||||
sendDiscordNotification,
|
sendDiscordNotification,
|
||||||
@@ -10,7 +11,6 @@ import {
|
|||||||
sendSlackNotification,
|
sendSlackNotification,
|
||||||
sendTelegramNotification,
|
sendTelegramNotification,
|
||||||
} from "./utils";
|
} from "./utils";
|
||||||
import { format } from "date-fns";
|
|
||||||
|
|
||||||
export const sendDokployRestartNotifications = async () => {
|
export const sendDokployRestartNotifications = async () => {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
@@ -80,7 +80,7 @@ export const sendDokployRestartNotifications = async () => {
|
|||||||
if (telegram) {
|
if (telegram) {
|
||||||
await sendTelegramNotification(
|
await sendTelegramNotification(
|
||||||
telegram,
|
telegram,
|
||||||
`<b>✅ Dokploy Server Restarted</b>\n\n<b>Date:</b> ${format(date, "PP")}\n<b>Time:</b> ${format(date, "pp")}`
|
`<b>✅ Dokploy Server Restarted</b>\n\n<b>Date:</b> ${format(date, "PP")}\n<b>Time:</b> ${format(date, "pp")}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export const sendTelegramNotification = async (
|
|||||||
inlineButton?: {
|
inlineButton?: {
|
||||||
text: string;
|
text: string;
|
||||||
url: string;
|
url: string;
|
||||||
}[][]
|
}[][],
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
const url = `https://api.telegram.org/bot${connection.botToken}/sendMessage`;
|
const url = `https://api.telegram.org/bot${connection.botToken}/sendMessage`;
|
||||||
|
|||||||
Reference in New Issue
Block a user