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.
This commit is contained in:
Mauricio Siu
2026-02-08 03:18:44 -06:00
parent 7ad09c0d0d
commit f25ed46dbc
3 changed files with 2 additions and 7 deletions

View File

@@ -24,6 +24,7 @@ try {
.build({
entryPoints: {
server: "server/server.ts",
migration: "migration.ts",
"reset-password": "reset-password.ts",
"reset-2fa": "reset-2fa.ts",
},

View File

@@ -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",

View File

@@ -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();