From b473498baf2384d0d628f47385237971cf6ec17c Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 4 Sep 2026 15:28:29 +0100 Subject: [PATCH] fix(setup,docs): rebuild locally built images, name OCR_DEEPSEEK_URL Both setup scripts start with `compose pull && compose up -d`. In the local compose file backend and worker are build-only services, so `up -d` builds only when no image exists yet: a rerun that switches OCR on wrote INSTALL_TESSERACT=true to .env and then reused the image built without it, leaving OCR_ENABLED=true with no engine. Build explicitly on the local compose path; the hub path stays pull-only, its services have no build stage. The OCR message named OCR_ENGINE=deepseek but not OCR_DEEPSEEK_URL, whose default (localhost:11434) resolves to the container, not the host. deployment/sandbox/README.md still described Docling as already present in application/requirements.txt. --- deployment/sandbox/README.md | 6 ++++-- setup.ps1 | 11 +++++++++-- setup.sh | 11 +++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/deployment/sandbox/README.md b/deployment/sandbox/README.md index b4dd0765..cf25088e 100644 --- a/deployment/sandbox/README.md +++ b/deployment/sandbox/README.md @@ -188,8 +188,10 @@ Daytona render output matches the Jupyter-backend output. Document reading no longer runs in this sandbox. The `read_document` tool and the workflow native-file extract branch enqueue a `parse_document` Celery task that -parses the document **in the backend** (Docling, already in -`application/requirements.txt`) and awaits the result. The task is routed to a +parses the document **in the backend** (the `DOC_PARSER_ENGINE` parser — anydoc +by default; Docling only when the optional +`application/requirements-docling.txt` extra is installed) and awaits the +result. The task is routed to a dedicated **`parsing` queue** (`settings.DOCUMENT_PARSE_QUEUE`, default `"parsing"`) so a parse enqueued from inside a Celery worker (headless/scheduled agent) is served by a separate worker and never self-deadlocks the awaiting one. diff --git a/setup.ps1 b/setup.ps1 index 318f04fe..d1385de8 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -523,7 +523,7 @@ function Configure-DocProcessing { # Bakes tesseract into the locally built images (docker compose # --env-file .env build). "INSTALL_TESSERACT=true" | Add-Content -Path $ENV_FILE -Encoding utf8 - Write-ColorText "OCR enabled. tesseract will be built into the images (INSTALL_TESSERACT=true); set OCR_ENGINE=deepseek in .env for a DeepSeek-OCR endpoint instead." -ForegroundColor "Green" + Write-ColorText "OCR enabled. tesseract will be built into the images (INSTALL_TESSERACT=true); for a DeepSeek-OCR endpoint instead, set OCR_ENGINE=deepseek and OCR_DEEPSEEK_URL= in .env." -ForegroundColor "Green" $docling_ocr = Read-Host "Also install the Docling layout engine for OCR (better tables/reading order, several GB heavier)? (y/N)" if ($docling_ocr -eq "y" -or $docling_ocr -eq "Y") { # Locally built images include docling via this build arg; it becomes @@ -647,7 +647,14 @@ function Use-DocsPublicAPIEndpoint { throw "Docker compose pull failed with exit code $LASTEXITCODE" } - & docker compose --env-file "$ENV_FILE" -f "$COMPOSE_FILE" up -d + # Locally built images must be rebuilt rather than reused: + # INSTALL_TESSERACT and INSTALL_DOCLING are build args, so a rerun that + # switches OCR on would otherwise keep the image built without them. + $up_args = @("up", "-d") + if ($COMPOSE_FILE -eq $COMPOSE_FILE_LOCAL) { + $up_args = @("up", "--build", "-d") + } + & docker compose --env-file "$ENV_FILE" -f "$COMPOSE_FILE" @up_args if ($LASTEXITCODE -ne 0) { throw "Docker compose up failed with exit code $LASTEXITCODE" } diff --git a/setup.sh b/setup.sh index a7fc8a78..e2a5884e 100755 --- a/setup.sh +++ b/setup.sh @@ -377,7 +377,7 @@ configure_doc_processing() { # Bakes tesseract into the locally built images (docker compose # --env-file .env build). echo "INSTALL_TESSERACT=true" >> "$ENV_FILE" - echo -e "${GREEN}OCR enabled. tesseract will be built into the images (INSTALL_TESSERACT=true); set OCR_ENGINE=deepseek in .env for a DeepSeek-OCR endpoint instead.${NC}" + echo -e "${GREEN}OCR enabled. tesseract will be built into the images (INSTALL_TESSERACT=true); for a DeepSeek-OCR endpoint instead, set OCR_ENGINE=deepseek and OCR_DEEPSEEK_URL= in .env.${NC}" read -p "$(echo -e "${DEFAULT_FG}Also install the Docling layout engine for OCR (better tables/reading order, several GB heavier)? (y/N): ${NC}")" docling_ocr if [[ "$docling_ocr" =~ ^[yY]$ ]]; then # Locally built images include docling via this build arg; it becomes @@ -469,7 +469,14 @@ use_docs_public_api_endpoint() { check_and_start_docker echo -e "\n${NC}Starting Docker Compose...${NC}" - docker compose --env-file "${ENV_FILE}" -f "${COMPOSE_FILE}" pull && docker compose --env-file "${ENV_FILE}" -f "${COMPOSE_FILE}" up -d + # Locally built images must be rebuilt rather than reused: INSTALL_TESSERACT + # and INSTALL_DOCLING are build args, so a rerun that switches OCR on would + # otherwise keep the image that was built without them. + up_args=(up -d) + if [ "$COMPOSE_FILE" = "$COMPOSE_FILE_LOCAL" ]; then + up_args=(up --build -d) + fi + docker compose --env-file "${ENV_FILE}" -f "${COMPOSE_FILE}" pull && docker compose --env-file "${ENV_FILE}" -f "${COMPOSE_FILE}" "${up_args[@]}" docker_compose_status=$? # Capture exit status of docker compose echo "Docker Compose Exit Status: $docker_compose_status"