mirror of
https://github.com/karakeep-app/karakeep.git
synced 2025-12-12 20:35:52 +01:00
fix: Run workers in prod without tsx. Fixes #1673
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -16,6 +16,7 @@ out/
|
||||
|
||||
# production
|
||||
build
|
||||
dist
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"http-proxy-agent": "^7.0.2",
|
||||
"https-proxy-agent": "^7.0.6",
|
||||
"jsdom": "^24.0.0",
|
||||
"liteque": "^0.4.1",
|
||||
"liteque": "^0.5.0",
|
||||
"metascraper": "^5.46.18",
|
||||
"metascraper-amazon": "^5.46.18",
|
||||
"metascraper-author": "5.46.18",
|
||||
@@ -50,11 +50,14 @@
|
||||
"devDependencies": {
|
||||
"@karakeep/prettier-config": "workspace:^0.1.0",
|
||||
"@types/jsdom": "^21.1.6",
|
||||
"@types/node-cron": "^3.0.11"
|
||||
"@types/node-cron": "^3.0.11",
|
||||
"tsdown": "^0.12.9"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "tsx watch index.ts",
|
||||
"start:prod": "tsx index.ts",
|
||||
"build": "tsdown",
|
||||
"build:watch": "tsdown --watch",
|
||||
"lint": "oxlint .",
|
||||
"lint:fix": "oxlint . --fix",
|
||||
"format": "prettier . --ignore-path ../../.prettierignore",
|
||||
|
||||
21
apps/workers/tsdown.config.ts
Normal file
21
apps/workers/tsdown.config.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { defineConfig } from "tsdown";
|
||||
|
||||
export default defineConfig({
|
||||
entry: ["index.ts"],
|
||||
format: ["esm"],
|
||||
target: "node22",
|
||||
outDir: "dist",
|
||||
clean: true,
|
||||
minify: false,
|
||||
sourcemap: true,
|
||||
platform: "node",
|
||||
shims: true,
|
||||
external: [
|
||||
// Keep native binaries external (transitive deps of bundled workspace packages)
|
||||
"better-sqlite3",
|
||||
],
|
||||
noExternal: [
|
||||
// Bundle workspace packages (since they're not published to npm)
|
||||
/^@karakeep\//,
|
||||
],
|
||||
});
|
||||
@@ -26,6 +26,7 @@ RUN cd packages/db && \
|
||||
RUN (cd apps/web && pnpm exec next build --experimental-build-mode compile)
|
||||
|
||||
# Build the worker code
|
||||
RUN (cd apps/workers && pnpm build)
|
||||
RUN pnpm deploy --node-linker=isolated --filter @karakeep/workers --prod /prod/workers
|
||||
|
||||
# Build the cli
|
||||
@@ -96,8 +97,6 @@ COPY --from=base --chown=node:node /app/apps/web/.next/static ./apps/web/.next/s
|
||||
######################
|
||||
COPY --from=base /prod/workers /app/apps/workers
|
||||
|
||||
RUN npm install -g tsx
|
||||
|
||||
ENTRYPOINT ["/init"]
|
||||
|
||||
################# The AIO ##############
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
# shellcheck shell=bash
|
||||
|
||||
cd /app/apps/workers;
|
||||
exec tsx index.ts
|
||||
exec node dist/index.mjs
|
||||
|
||||
@@ -229,6 +229,7 @@ install_karakeep() {
|
||||
$shh pnpm build
|
||||
cd "$APP_DIR"/workers
|
||||
$shh pnpm i --frozen-lockfile
|
||||
$shh pnpm build
|
||||
cd "$APP_DIR"/cli
|
||||
$shh pnpm i --frozen-lockfile
|
||||
$shh pnpm build
|
||||
@@ -342,7 +343,7 @@ Group=karakeep
|
||||
Restart=always
|
||||
EnvironmentFile=${ENV_FILE}
|
||||
WorkingDirectory=${APP_DIR}/workers
|
||||
ExecStart=/usr/bin/pnpm run start:prod
|
||||
ExecStart=/usr/bin/node dist/index.mjs
|
||||
StandardOutput=append:${LOG_DIR}/karakeep-workers.log
|
||||
StandardError=append:${LOG_DIR}/karakeep-workers.log
|
||||
TimeoutStopSec=5
|
||||
@@ -438,6 +439,7 @@ update_karakeep() {
|
||||
cd "$APP_DIR"/web && $shh pnpm i --frozen-lockfile
|
||||
$shh pnpm build
|
||||
cd "$APP_DIR"/workers && $shh pnpm i --frozen-lockfile
|
||||
$shh pnpm build
|
||||
cd "$APP_DIR"/cli && $shh pnpm i --frozen-lockfile
|
||||
$shh pnpm build
|
||||
cd "$INSTALL_DIR"/packages/db && $shh pnpm migrate
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"glob": "^11.0.0",
|
||||
"html-to-text": "^9.0.5",
|
||||
"js-tiktoken": "^1.0.20",
|
||||
"liteque": "^0.4.1",
|
||||
"liteque": "^0.5.0",
|
||||
"meilisearch": "^0.37.0",
|
||||
"nodemailer": "^7.0.4",
|
||||
"ollama": "^0.5.14",
|
||||
|
||||
524
pnpm-lock.yaml
generated
524
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user