fix(worker): default COMPUTE_PREWARM_MODELS to false and update docs, env, and compose

Set COMPUTE_PREWARM_MODELS to false by default in runtime, docker-compose,
and .env.example to avoid pre-downloading ONNX models during worker startup.
Update Dockerfile and deployment documentation to reflect this change and
clarify configuration for model prewarming.
This commit is contained in:
Richard R 2026-06-02 20:40:48 -06:00
parent 0a9fbc87f3
commit 3214080afc
5 changed files with 4 additions and 9 deletions

View file

@ -78,11 +78,6 @@ RUN chmod +x /usr/local/bin/nats-server
# Include OpenAI Whisper license text for runtime-downloaded ONNX artifacts. # Include OpenAI Whisper license text for runtime-downloaded ONNX artifacts.
COPY --from=app-builder /app/compute/core/src/whisper/assets/LICENSE.txt /licenses/openai-whisper-LICENSE.txt COPY --from=app-builder /app/compute/core/src/whisper/assets/LICENSE.txt /licenses/openai-whisper-LICENSE.txt
# Bind the worker's health endpoint before downloading ONNX models, so cold
# starts don't exceed the entrypoint's 30s /health/ready gate. Models load
# lazily on first job instead.
ENV COMPUTE_PREWARM_MODELS=false
# Expose the port the app runs on # Expose the port the app runs on
EXPOSE 3003 EXPOSE 3003

View file

@ -39,7 +39,7 @@ S3_ENDPOINT=http://host.docker.internal:8333
S3_FORCE_PATH_STYLE=true S3_FORCE_PATH_STYLE=true
# Optional tuning # Optional tuning
# COMPUTE_PREWARM_MODELS=true # COMPUTE_PREWARM_MODELS=false
# COMPUTE_JOB_CONCURRENCY=1 # COMPUTE_JOB_CONCURRENCY=1
# COMPUTE_WHISPER_TIMEOUT_MS=30000 # COMPUTE_WHISPER_TIMEOUT_MS=30000
# COMPUTE_PDF_TIMEOUT_MS=300000 # COMPUTE_PDF_TIMEOUT_MS=300000

View file

@ -24,7 +24,7 @@ services:
PORT: ${PORT:-8081} PORT: ${PORT:-8081}
COMPUTE_WORKER_TOKEN: ${COMPUTE_WORKER_TOKEN:-local-compute-token} COMPUTE_WORKER_TOKEN: ${COMPUTE_WORKER_TOKEN:-local-compute-token}
S3_PREFIX: ${S3_PREFIX:-openreader} S3_PREFIX: ${S3_PREFIX:-openreader}
COMPUTE_PREWARM_MODELS: ${COMPUTE_PREWARM_MODELS:-true} COMPUTE_PREWARM_MODELS: ${COMPUTE_PREWARM_MODELS:-false}
ports: ports:
- "8081:8081" - "8081:8081"
develop: develop:

View file

@ -510,7 +510,7 @@ export async function createComputeWorkerApp(options: CreateComputeWorkerAppOpti
const pdfTimeoutMs = timeoutConfig.pdfTimeoutMs; const pdfTimeoutMs = timeoutConfig.pdfTimeoutMs;
const pdfHardCapMs = timeoutConfig.pdfHardCapMs; const pdfHardCapMs = timeoutConfig.pdfHardCapMs;
const pdfAttempts = readIntEnv('COMPUTE_PDF_JOB_ATTEMPTS', 1); const pdfAttempts = readIntEnv('COMPUTE_PDF_JOB_ATTEMPTS', 1);
const prewarmModels = parseBoolEnv('COMPUTE_PREWARM_MODELS', true); const prewarmModels = parseBoolEnv('COMPUTE_PREWARM_MODELS', false);
const jobsStreamMaxBytes = readIntEnv('COMPUTE_JOBS_STREAM_MAX_BYTES', 256 * 1024 * 1024); const jobsStreamMaxBytes = readIntEnv('COMPUTE_JOBS_STREAM_MAX_BYTES', 256 * 1024 * 1024);
const eventsStreamMaxBytes = readIntEnv('COMPUTE_EVENTS_STREAM_MAX_BYTES', 128 * 1024 * 1024); const eventsStreamMaxBytes = readIntEnv('COMPUTE_EVENTS_STREAM_MAX_BYTES', 128 * 1024 * 1024);
const jobStatesMaxBytes = readIntEnv('COMPUTE_JOB_STATES_MAX_BYTES', 64 * 1024 * 1024); const jobStatesMaxBytes = readIntEnv('COMPUTE_JOB_STATES_MAX_BYTES', 64 * 1024 * 1024);

View file

@ -51,7 +51,7 @@ Common optional variables:
- `COMPUTE_WORKER_HOST=0.0.0.0` - `COMPUTE_WORKER_HOST=0.0.0.0`
- `PORT=8081` for local/manual runs. Platforms like Railway usually inject `PORT`. - `PORT=8081` for local/manual runs. Platforms like Railway usually inject `PORT`.
- `LOG_FORMAT=json` and `COMPUTE_LOG_LEVEL=info` - `LOG_FORMAT=json` and `COMPUTE_LOG_LEVEL=info`
- `COMPUTE_PREWARM_MODELS=true` - `COMPUTE_PREWARM_MODELS=false` by default. Set it to `true` to pre-download ONNX models during worker startup.
- `COMPUTE_JOB_CONCURRENCY=1` - `COMPUTE_JOB_CONCURRENCY=1`
- `COMPUTE_WHISPER_TIMEOUT_MS=30000` - `COMPUTE_WHISPER_TIMEOUT_MS=30000`
- `COMPUTE_PDF_TIMEOUT_MS=300000` - `COMPUTE_PDF_TIMEOUT_MS=300000`