feat(dokploy): add wait-for-postgres script and update Dockerfile and package.json

- Introduced a new script to wait for PostgreSQL to be ready before starting the application.
- Updated the Dockerfile to include a health check for the application.
- Modified the start script in package.json to run the wait-for-postgres script prior to starting the server and migration processes.
- Added the wait-for-postgres TypeScript file to handle connection retries to the PostgreSQL database.
This commit is contained in:
Mauricio Siu
2026-02-08 15:43:58 -06:00
parent 08ba24c252
commit f2e4a96154
5 changed files with 106 additions and 11 deletions

View File

@@ -764,16 +764,13 @@ export const settingsRouter = createTRPCRouter({
return haveServers.length > 0 || haveProjects.length > 0;
}),
health: publicProcedure.query(async () => {
if (IS_CLOUD) {
try {
await db.execute(sql`SELECT 1`);
return { status: "ok" };
} catch (error) {
console.error("Database connection error:", error);
throw error;
}
try {
await db.execute(sql`SELECT 1`);
return { status: "ok" };
} catch (error) {
console.error("Database connection error:", error);
throw error;
}
return { status: "not_cloud" };
}),
setupGPU: adminProcedure
.input(