diff --git a/compute/core/src/platform/docstore.ts b/compute/core/src/platform/docstore.ts index 7d7dd6b..6681f37 100644 --- a/compute/core/src/platform/docstore.ts +++ b/compute/core/src/platform/docstore.ts @@ -1,6 +1,24 @@ +import fs from 'fs'; import path from 'path'; -export const DOCSTORE_DIR = path.join(process.cwd(), 'docstore'); +function findMonorepoRoot(startDir: string): string | null { + let current = path.resolve(startDir); + for (;;) { + const marker = path.join(current, 'pnpm-workspace.yaml'); + if (fs.existsSync(marker)) return current; + const parent = path.dirname(current); + if (parent === current) return null; + current = parent; + } +} + +function resolveDocstoreDir(): string { + const repoRoot = findMonorepoRoot(process.cwd()); + if (repoRoot) return path.join(repoRoot, 'docstore'); + return path.join(process.cwd(), 'docstore'); +} + +export const DOCSTORE_DIR = resolveDocstoreDir(); export function getDocstoreDir(): string { return DOCSTORE_DIR; diff --git a/scripts/openreader-entrypoint.mjs b/scripts/openreader-entrypoint.mjs index f21feb7..9223bf6 100644 --- a/scripts/openreader-entrypoint.mjs +++ b/scripts/openreader-entrypoint.mjs @@ -345,7 +345,7 @@ async function main() { shutdownPromise = (async () => { await Promise.all([ terminateChild(appProc, signal, 4000), - terminateChild(workerProc, 'SIGTERM', 4000, true), + terminateChild(workerProc, 'SIGTERM', 4000), terminateChild(natsProc, 'SIGTERM', 4000), terminateChild(weedProc, 'SIGTERM', 4000), ]); @@ -397,7 +397,12 @@ async function main() { const waitTimeout = Number.isFinite(waitSec) ? waitSec : 20; const launchWeed = (endpointUrl) => { const parsedEndpoint = parseS3Endpoint(endpointUrl); - const weedArgs = ['mini', `-dir=${runtimeEnv.WEED_MINI_DIR}`]; + const weedArgs = [ + '-alsologtostderr=false', + '-stderrthreshold=WARNING', + 'mini', + `-dir=${runtimeEnv.WEED_MINI_DIR}`, + ]; weedArgs.push(`-s3.port=${parsedEndpoint.port}`); if (runningInDocker) { weedArgs.push('-ip.bind=0.0.0.0'); @@ -512,7 +517,6 @@ async function main() { env: workerEnv, stdio: ['ignore', 'pipe', 'pipe'], shell: process.platform === 'win32', - detached: process.platform !== 'win32', }, ); stopWorkerStdoutForward = forwardChildStream(workerProc.stdout, process.stdout);