mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
feat: docker-compose for production frontend (#664)
* docker-compose for production frontend * fix: Remove external Redis port mapping for Coolify compatibility Redis should only be accessible within the internal Docker network in Coolify deployments to avoid port conflicts with other applications. * fix: Remove external port mapping for web service in Coolify Coolify handles port exposure through its proxy (Traefik), so services should not expose ports directly in the docker-compose file. * server side client envs * missing vars * nextjs experimental * fix claude 'fix' * remove build env vars compose * docker * remove ports for coolify * review * cleanup --------- Co-authored-by: Igor Loskutov <igor.loskutoff@gmail.com>
This commit is contained in:
38
www/app/api/health/route.ts
Normal file
38
www/app/api/health/route.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET() {
|
||||
const health = {
|
||||
status: "healthy",
|
||||
timestamp: new Date().toISOString(),
|
||||
uptime: process.uptime(),
|
||||
environment: process.env.NODE_ENV,
|
||||
checks: {
|
||||
redis: await checkRedis(),
|
||||
},
|
||||
};
|
||||
|
||||
const allHealthy = Object.values(health.checks).every((check) => check);
|
||||
|
||||
return NextResponse.json(health, {
|
||||
status: allHealthy ? 200 : 503,
|
||||
});
|
||||
}
|
||||
|
||||
async function checkRedis(): Promise<boolean> {
|
||||
try {
|
||||
if (!process.env.KV_URL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { tokenCacheRedis } = await import("../../lib/redisClient");
|
||||
const testKey = `health:check:${Date.now()}`;
|
||||
await tokenCacheRedis.setex(testKey, 10, "OK");
|
||||
const value = await tokenCacheRedis.get(testKey);
|
||||
await tokenCacheRedis.del(testKey);
|
||||
|
||||
return value === "OK";
|
||||
} catch (error) {
|
||||
console.error("Redis health check failed:", error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user