healthcheck 방어코드

This commit is contained in:
2026-07-31 14:08:59 +09:00
parent 500f840e93
commit 37356cf774
3 changed files with 34 additions and 0 deletions
+6
View File
@@ -38,6 +38,9 @@ services:
restart: always
linkforty-prod:
build:
context: .
dockerfile: Dockerfile
image: linkforty-custom:latest
container_name: linkforty-core-prod
restart: always
@@ -69,6 +72,9 @@ services:
restart: always
linkforty-sandbox:
build:
context: .
dockerfile: Dockerfile
image: linkforty-custom:latest
container_name: linkforty-core-sandbox
restart: always
+18
View File
@@ -0,0 +1,18 @@
import { describe, it, expect } from 'vitest';
import Fastify from 'fastify';
import { wellKnownRoutes } from './well-known.js';
describe('health endpoints', () => {
it('returns 200 for GET /health', async () => {
const app = Fastify();
await app.register(wellKnownRoutes);
await app.ready();
const res = await app.inject({ method: 'GET', url: '/health' });
expect(res.statusCode).toBe(200);
expect(res.json()).toMatchObject({ status: 'ok' });
await app.close();
});
});
+10
View File
@@ -13,6 +13,16 @@
import { FastifyInstance } from 'fastify';
export async function wellKnownRoutes(fastify: FastifyInstance) {
/**
* Basic health endpoint for container orchestration and reverse proxies.
*/
fastify.get('/health', async (request, reply) => {
return reply.status(200).send({
status: 'ok',
timestamp: new Date().toISOString(),
});
});
/**
* Apple App Site Association (AASA)
* Used by iOS to verify Universal Links