Prepare application for production deployment with Docker and PostgreSQL

Integrate PostgreSQL database support, add Docker deployment configurations, and implement health check endpoints.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: ceced2fc-aa46-458d-ba87-ddd4b7bb1518
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/659922a9-0087-461c-90dd-6d9a58b81d4d/ceced2fc-aa46-458d-ba87-ddd4b7bb1518/ahHWEFX
This commit is contained in:
paul-nothaft
2025-10-23 13:21:58 +00:00
parent 24aacb3787
commit 4133052165
10 changed files with 625 additions and 1 deletions
+11
View File
@@ -1,6 +1,7 @@
import express, { type Request, Response, NextFunction } from "express";
import { registerRoutes } from "./routes";
import { setupVite, serveStatic, log } from "./vite";
import { initializeDatabase } from "./db";
const app = express();
app.use(express.json());
@@ -37,6 +38,16 @@ app.use((req, res, next) => {
});
(async () => {
// Initialize database if using production mode or USE_DB is true
if (process.env.NODE_ENV === 'production' || process.env.USE_DB === 'true') {
try {
await initializeDatabase();
} catch (error) {
console.error('Failed to initialize database:', error);
process.exit(1);
}
}
const server = await registerRoutes(app);
app.use((err: any, _req: Request, res: Response, _next: NextFunction) => {