From 37356cf77403b41adb39e1e67173bc79ba89c00c Mon Sep 17 00:00:00 2001 From: "Beomhee.Lee" Date: Fri, 31 Jul 2026 14:08:59 +0900 Subject: [PATCH] =?UTF-8?q?healthcheck=20=EB=B0=A9=EC=96=B4=EC=BD=94?= =?UTF-8?q?=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 6 ++++++ src/routes/well-known.test.ts | 18 ++++++++++++++++++ src/routes/well-known.ts | 10 ++++++++++ 3 files changed, 34 insertions(+) create mode 100644 src/routes/well-known.test.ts diff --git a/docker-compose.yml b/docker-compose.yml index 9be40eb..caeca19 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/src/routes/well-known.test.ts b/src/routes/well-known.test.ts new file mode 100644 index 0000000..8531d64 --- /dev/null +++ b/src/routes/well-known.test.ts @@ -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(); + }); +}); diff --git a/src/routes/well-known.ts b/src/routes/well-known.ts index 2c691ec..5972703 100644 --- a/src/routes/well-known.ts +++ b/src/routes/well-known.ts @@ -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