fix: serve chat-widget.js correctly in production

- Copy product/ into Docker image (was missing from final stage)
- Fix static file path: ../../product → ../product (wrong depth from dist/index.js)
- Add ANTHROPIC_API_KEY to K8s manifest (chat endpoint was returning 500)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Garfield
2026-05-15 18:45:43 -04:00
parent c7eae2c735
commit 1f8d97b6bd
3 changed files with 23 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
FROM node:20-alpine AS builder FROM node:20-alpine AS builder
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package*.json ./
COPY scripts/ ./scripts/
RUN npm install RUN npm install
COPY tsconfig.json ./ COPY tsconfig.json ./
COPY src/ ./src/ COPY src/ ./src/
@@ -9,7 +10,9 @@ RUN npx tsc
FROM node:20-alpine FROM node:20-alpine
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package*.json ./
COPY scripts/ ./scripts/
RUN npm install --omit=dev RUN npm install --omit=dev
COPY --from=builder /app/dist ./dist COPY --from=builder /app/dist ./dist
COPY product/ ./product/
EXPOSE 3456 EXPOSE 3456
CMD ["node", "dist/index.js"] CMD ["node", "dist/index.js"]

View File

@@ -22,7 +22,7 @@ spec:
fsGroup: 1000 fsGroup: 1000
containers: containers:
- name: hermes-mcp - name: hermes-mcp
image: localhost:32000/hermes-mcp@sha256:e169dccdb2a4e670036391658c5718a2244b3e16b7ffb1f71946a9aae10ba151 image: localhost:32000/hermes-mcp@sha256:17f1f7ce059f0f87d9c34c39e2ea0fb1f25cf72f9279341c5912e6c35690f43a
imagePullPolicy: Always imagePullPolicy: Always
securityContext: securityContext:
allowPrivilegeEscalation: false allowPrivilegeEscalation: false
@@ -125,6 +125,8 @@ spec:
value: "761c17a9a49670489ccf93ccffd344dbfc642ae994ac2ee991dbb42de3f6c3af" value: "761c17a9a49670489ccf93ccffd344dbfc642ae994ac2ee991dbb42de3f6c3af"
- name: SLACK_PILOT_WEBHOOK_URL - name: SLACK_PILOT_WEBHOOK_URL
value: "https://hooks.slack.com/services/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" value: "https://hooks.slack.com/services/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"
- name: ANTHROPIC_API_KEY
value: "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"
volumeMounts: volumeMounts:
- name: vaults - name: vaults
mountPath: /vaults mountPath: /vaults

View File

@@ -38,6 +38,22 @@ import { notifyNewPilotRequest } from './notifications/index.js';
import redis from './redis.js'; import redis from './redis.js';
import { handleChat, type ChatMessage } from './chat.js'; import { handleChat, type ChatMessage } from './chat.js';
process.on('uncaughtException', (err) => {
console.error('FATAL uncaughtException:', err);
if (err && typeof err === 'object') {
console.error('Stack:', (err as Error).stack);
}
process.exit(1);
});
process.on('unhandledRejection', (reason, promise) => {
console.error('FATAL unhandledRejection at:', promise, 'reason:', reason);
if (reason && typeof reason === 'object') {
console.error('Stack:', (reason as Error).stack);
}
process.exit(1);
});
const app = express(); const app = express();
app.use(cookieParser()); app.use(cookieParser());
app.use(cors({ app.use(cors({
@@ -58,7 +74,7 @@ app.use(express.urlencoded({ extended: true }));
// ── Static files (videos, assets) ────────────────────────────────────────── // ── Static files (videos, assets) ──────────────────────────────────────────
app.use('/public', express.static('/vaults/public')); app.use('/public', express.static('/vaults/public'));
app.use(express.static(new URL('../../product', import.meta.url).pathname)); app.use(express.static(new URL('../product', import.meta.url).pathname));
// ── Config ───────────────────────────────────────────────────────────────── // ── Config ─────────────────────────────────────────────────────────────────
const PORT = process.env.PORT ?? 3456; const PORT = process.env.PORT ?? 3456;