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:
¨NW¨
2026-04-08 23:09:28 +01:00
parent cee297b4db
commit 322cebf475
8 changed files with 119 additions and 67 deletions

View File

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

View File

@@ -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`