fix(prod): production startup fixes — health endpoint, serveStatic path, entrypoint, docker config
- Add /api/health endpoint for Docker healthchecks - Fix serveStatic path: dist/public instead of ../public - Fix entrypoint.sh: DB wait check, npx drizzle-kit migrate, add netcat - Fix Dockerfile: add bash/netcat, fix COPY order, add tsconfig.node.json - Fix docker-compose.yml: add OLLAMA/LLM env vars for Node.js fallback - Fix docker-stack.yml: remove template vars, use env vars instead of secrets - Fix drizzle.config.ts: add migrations prefix - Update .env.example with full LLM provider documentation
This commit is contained in:
@@ -34,6 +34,16 @@ async function startServer() {
|
||||
// Configure body parser with larger size limit for file uploads
|
||||
app.use(express.json({ limit: "50mb" }));
|
||||
app.use(express.urlencoded({ limit: "50mb", extended: true }));
|
||||
|
||||
// Health check endpoint for Docker HEALTHCHECK and load balancers
|
||||
app.get("/api/health", (_req, res) => {
|
||||
res.json({
|
||||
status: "ok",
|
||||
uptime: Math.floor(process.uptime()),
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
});
|
||||
|
||||
// OAuth callback under /api/oauth/callback
|
||||
registerOAuthRoutes(app);
|
||||
// tRPC API
|
||||
|
||||
@@ -48,10 +48,9 @@ export async function setupVite(app: Express, server: Server) {
|
||||
}
|
||||
|
||||
export function serveStatic(app: Express) {
|
||||
const distPath =
|
||||
process.env.NODE_ENV === "development"
|
||||
? path.resolve(import.meta.dirname, "../..", "dist", "public")
|
||||
: path.resolve(import.meta.dirname, "public");
|
||||
// dist/index.js is the server bundle, dist/public/ is the client build
|
||||
// import.meta.dirname = .../dist → public is at dist/public
|
||||
const distPath = path.resolve(import.meta.dirname, "public");
|
||||
if (!fs.existsSync(distPath)) {
|
||||
console.error(
|
||||
`Could not find the build directory: ${distPath}, make sure to build the client first`
|
||||
|
||||
Reference in New Issue
Block a user