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:
@@ -1,6 +1,7 @@
|
||||
FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
COPY scripts/ ./scripts/
|
||||
RUN npm install
|
||||
COPY tsconfig.json ./
|
||||
COPY src/ ./src/
|
||||
@@ -9,7 +10,9 @@ RUN npx tsc
|
||||
FROM node:20-alpine
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
COPY scripts/ ./scripts/
|
||||
RUN npm install --omit=dev
|
||||
COPY --from=builder /app/dist ./dist
|
||||
COPY product/ ./product/
|
||||
EXPOSE 3456
|
||||
CMD ["node", "dist/index.js"]
|
||||
|
||||
@@ -22,7 +22,7 @@ spec:
|
||||
fsGroup: 1000
|
||||
containers:
|
||||
- name: hermes-mcp
|
||||
image: localhost:32000/hermes-mcp@sha256:e169dccdb2a4e670036391658c5718a2244b3e16b7ffb1f71946a9aae10ba151
|
||||
image: localhost:32000/hermes-mcp@sha256:17f1f7ce059f0f87d9c34c39e2ea0fb1f25cf72f9279341c5912e6c35690f43a
|
||||
imagePullPolicy: Always
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
@@ -125,6 +125,8 @@ spec:
|
||||
value: "761c17a9a49670489ccf93ccffd344dbfc642ae994ac2ee991dbb42de3f6c3af"
|
||||
- name: SLACK_PILOT_WEBHOOK_URL
|
||||
value: "https://hooks.slack.com/services/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"
|
||||
- name: ANTHROPIC_API_KEY
|
||||
value: "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"
|
||||
volumeMounts:
|
||||
- name: vaults
|
||||
mountPath: /vaults
|
||||
|
||||
18
src/index.ts
18
src/index.ts
@@ -38,6 +38,22 @@ import { notifyNewPilotRequest } from './notifications/index.js';
|
||||
import redis from './redis.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();
|
||||
app.use(cookieParser());
|
||||
app.use(cors({
|
||||
@@ -58,7 +74,7 @@ app.use(express.urlencoded({ extended: true }));
|
||||
|
||||
// ── Static files (videos, assets) ──────────────────────────────────────────
|
||||
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 ─────────────────────────────────────────────────────────────────
|
||||
const PORT = process.env.PORT ?? 3456;
|
||||
|
||||
Reference in New Issue
Block a user