From f25ed46dbcc608a7e95256c1a4a048ac6e5e041a Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Sun, 8 Feb 2026 03:18:44 -0600 Subject: [PATCH] feat(migration): add migration entry point and update start script - Added a new entry point for migration in the esbuild configuration. - Updated the start script in package.json to run the migration before starting the server. - Removed the direct migration call from the server initialization process to streamline the workflow. --- apps/dokploy/esbuild.config.ts | 1 + apps/dokploy/package.json | 2 +- apps/dokploy/server/server.ts | 6 ------ 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/apps/dokploy/esbuild.config.ts b/apps/dokploy/esbuild.config.ts index a1747ac55..d2f434255 100644 --- a/apps/dokploy/esbuild.config.ts +++ b/apps/dokploy/esbuild.config.ts @@ -24,6 +24,7 @@ try { .build({ entryPoints: { server: "server/server.ts", + migration: "migration.ts", "reset-password": "reset-password.ts", "reset-2fa": "reset-2fa.ts", }, diff --git a/apps/dokploy/package.json b/apps/dokploy/package.json index c1d00d67c..43b1c5ff1 100644 --- a/apps/dokploy/package.json +++ b/apps/dokploy/package.json @@ -6,7 +6,7 @@ "type": "module", "scripts": { "build": "npm run build-server && npm run build-next", - "start": "node -r dotenv/config dist/server.mjs", + "start": "node -r dotenv/config dist/migration.mjs && node -r dotenv/config dist/server.mjs", "build-server": "tsx esbuild.config.ts", "build-next": "next build --webpack", "setup": "tsx -r dotenv/config setup.ts && sleep 5 && pnpm run migration:run", diff --git a/apps/dokploy/server/server.ts b/apps/dokploy/server/server.ts index dbd7c2638..5d6d703fa 100644 --- a/apps/dokploy/server/server.ts +++ b/apps/dokploy/server/server.ts @@ -15,7 +15,6 @@ import { } from "@dokploy/server"; import { config } from "dotenv"; import next from "next"; -import { migration } from "@/server/db/migration"; import packageInfo from "../package.json"; import { setupDockerContainerLogsWebSocketServer } from "./wss/docker-container-logs"; import { setupDockerContainerTerminalWebSocketServer } from "./wss/docker-container-terminal"; @@ -60,7 +59,6 @@ void app.prepare().then(async () => { if (process.env.NODE_ENV === "production" && !IS_CLOUD) { createDefaultMiddlewares(); await initializeNetwork(); - await migration(); await initCronJobs(); await initSchedules(); await initCancelDeployments(); @@ -68,10 +66,6 @@ void app.prepare().then(async () => { await sendDokployRestartNotifications(); } - if (IS_CLOUD && process.env.NODE_ENV === "production") { - await migration(); - } - server.listen(PORT, HOST); console.log(`Server Started on: http://${HOST}:${PORT}`); await initEnterpriseBackupCronJobs();