Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ WORKDIR /app
ENV NODE_ENV=production
ENV HOSTNAME=0.0.0.0

# ARGs don't cross stage boundaries; redeclare so /health reads real provenance
# at runtime instead of the kit's 0.0.0-dev/dev fallback.
ARG COMMIT_SHA="" BUILD_TIME=""
ENV COMMIT_SHA=$COMMIT_SHA
ENV BUILD_TIME=$BUILD_TIME

COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ services:
memory: 128M

healthcheck:
test: ['CMD', 'wget', '--quiet', '--tries=1', '--spider', 'http://127.0.0.1:3000/']
test: ['CMD', 'wget', '--quiet', '--tries=1', '--spider', 'http://127.0.0.1:3000/health']
interval: 30s
timeout: 10s
retries: 3
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"test:e2e:ui": "npx playwright test --ui"
},
"dependencies": {
"@agentage/observability": "^0.6.1",
"@agentage/observability": "^0.8.0",
"@chemistry/crystalview": "^3.0.0",
"@chemistry/molpad": "^3.1.0",
"@vercel/otel": "^2.1.3",
Expand Down
24 changes: 24 additions & 0 deletions src/app/health/route.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { GET } from './route';

describe('GET /health', () => {
// Mirrors deploy.yml's runtime .env, so the kit's default service resolution
// (OTEL_SERVICE_NAME) is exercised the same way it is in production.
beforeEach(() => {
process.env.OTEL_SERVICE_NAME = 'vreshch-web';
});

afterEach(() => {
delete process.env.OTEL_SERVICE_NAME;
});

it('returns the v1 health envelope for vreshch-web', async () => {
const res = await GET();
const body = await res.json();

expect(res.status).toBe(200);
expect(body.success).toBe(true);
expect(body.data.service).toBe('vreshch-web');
expect(body.data.status).toBe('ok');
});
});
10 changes: 10 additions & 0 deletions src/app/health/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { healthResponse } from '@agentage/observability/health';

// Never prerender, or commit/buildTime are baked at build instead of read from the
// running container.
export const dynamic = 'force-dynamic';

// No explicit `service`: deploy.yml writes OTEL_SERVICE_NAME=vreshch-web to the
// runtime .env (consumed via docker-compose's env_file), so the kit's default
// keeps this route and telemetry service.name equal by construction.
export const GET = () => healthResponse();