mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-15 00:15:17 +00:00
Merge pull request #2705 from Dokploy/2670-bug-deployments-are-mark-as-running-when-they-never-ended-vps-shutdown
2670 bug deployments are mark as running when they never ended vps shutdown
This commit is contained in:
@@ -7,7 +7,14 @@ import {
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
status: "running" | "error" | "done" | "idle" | undefined | null;
|
status:
|
||||||
|
| "running"
|
||||||
|
| "error"
|
||||||
|
| "done"
|
||||||
|
| "idle"
|
||||||
|
| "cancelled"
|
||||||
|
| undefined
|
||||||
|
| null;
|
||||||
className?: string;
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,6 +41,14 @@ export const StatusTooltip = ({ status, className }: Props) => {
|
|||||||
className={cn("size-3.5 rounded-full bg-green-500", className)}
|
className={cn("size-3.5 rounded-full bg-green-500", className)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{status === "cancelled" && (
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
"size-3.5 rounded-full bg-muted-foreground",
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{status === "running" && (
|
{status === "running" && (
|
||||||
<div
|
<div
|
||||||
className={cn("size-3.5 rounded-full bg-yellow-500", className)}
|
className={cn("size-3.5 rounded-full bg-yellow-500", className)}
|
||||||
@@ -46,6 +61,7 @@ export const StatusTooltip = ({ status, className }: Props) => {
|
|||||||
{status === "error" && "Error"}
|
{status === "error" && "Error"}
|
||||||
{status === "done" && "Done"}
|
{status === "done" && "Done"}
|
||||||
{status === "running" && "Running"}
|
{status === "running" && "Running"}
|
||||||
|
{status === "cancelled" && "Cancelled"}
|
||||||
</span>
|
</span>
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
ALTER TYPE "public"."deploymentStatus" ADD VALUE 'cancelled';
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -792,6 +792,13 @@
|
|||||||
"when": 1758483520214,
|
"when": 1758483520214,
|
||||||
"tag": "0112_freezing_skrulls",
|
"tag": "0112_freezing_skrulls",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 113,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1758960816504,
|
||||||
|
"tag": "0113_complete_rafael_vega",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
initializeNetwork,
|
initializeNetwork,
|
||||||
initSchedules,
|
initSchedules,
|
||||||
initVolumeBackupsCronJobs,
|
initVolumeBackupsCronJobs,
|
||||||
|
initCancelDeployments,
|
||||||
sendDokployRestartNotifications,
|
sendDokployRestartNotifications,
|
||||||
setupDirectories,
|
setupDirectories,
|
||||||
} from "@dokploy/server";
|
} from "@dokploy/server";
|
||||||
@@ -52,6 +53,7 @@ void app.prepare().then(async () => {
|
|||||||
await migration();
|
await migration();
|
||||||
await initCronJobs();
|
await initCronJobs();
|
||||||
await initSchedules();
|
await initSchedules();
|
||||||
|
await initCancelDeployments();
|
||||||
await initVolumeBackupsCronJobs();
|
await initVolumeBackupsCronJobs();
|
||||||
await sendDokployRestartNotifications();
|
await sendDokployRestartNotifications();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export const deploymentStatus = pgEnum("deploymentStatus", [
|
|||||||
"running",
|
"running",
|
||||||
"done",
|
"done",
|
||||||
"error",
|
"error",
|
||||||
|
"cancelled",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
export const deployments = pgTable("deployment", {
|
export const deployments = pgTable("deployment", {
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ export * from "./utils/backups/postgres";
|
|||||||
export * from "./utils/backups/utils";
|
export * from "./utils/backups/utils";
|
||||||
export * from "./utils/backups/web-server";
|
export * from "./utils/backups/web-server";
|
||||||
export * from "./utils/builders/compose";
|
export * from "./utils/builders/compose";
|
||||||
|
export * from "./utils/startup/cancell-deployments";
|
||||||
export * from "./utils/builders/docker-file";
|
export * from "./utils/builders/docker-file";
|
||||||
export * from "./utils/builders/drop";
|
export * from "./utils/builders/drop";
|
||||||
export * from "./utils/builders/heroku";
|
export * from "./utils/builders/heroku";
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import { deployments } from "@dokploy/server/db/schema";
|
||||||
|
import { eq } from "drizzle-orm";
|
||||||
|
import { db } from "../../db/index";
|
||||||
|
|
||||||
|
export const initCancelDeployments = async () => {
|
||||||
|
try {
|
||||||
|
console.log("Setting up cancel deployments....");
|
||||||
|
|
||||||
|
const result = await db
|
||||||
|
.update(deployments)
|
||||||
|
.set({
|
||||||
|
status: "cancelled",
|
||||||
|
})
|
||||||
|
.where(eq(deployments.status, "running"))
|
||||||
|
.returning();
|
||||||
|
|
||||||
|
console.log(`Cancelled ${result.length} deployments`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user