Skip to content

fix(compose): stop Marker PDF conversion failing with PermissionError#655

Open
Ahmath-Gadji wants to merge 1 commit into
developfrom
fix/marker-font-path
Open

fix(compose): stop Marker PDF conversion failing with PermissionError#655
Ahmath-Gadji wants to merge 1 commit into
developfrom
fix/marker-font-path

Conversation

@Ahmath-Gadji

@Ahmath-Gadji Ahmath-Gadji commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Problem

Every PDF ingestion fails in Marker with:

PermissionError: [Errno 13] Permission denied: '/app/.venv/lib/python3.12/site-packages/static'

Marker downloads its rendering font lazily on the first conversion, defaulting to a path inside the installed package (site-packages/static/fonts/). entrypoint.sh drops the app to a non-root user (APP_UID, GID 0), while the venv lives in the root-owned openrag_venv named volume whose site-packages is root:root drwxr-xr-x. So the app user cannot create static/.

Fix

Point FONT_PATH at /app/data/fonts/, a bind-mounted directory the app user already owns (entrypoint.sh grants GID-0 write on /app/data). The ~15MB download happens once and persists across restarts.

FONT_PATH is the only knob needed: marker's Settings is a pydantic BaseSettings with no env prefix, FONT_DIR is dead except as the default for FONT_PATH, and the two other readers (providers/__init__.py, processors/debug.py) both go through FONT_PATH.

Why the extra anchor

Adding environment: to x-openrag alone silently does nothing for the GPU service: a service's own environment: key replaces the merged one (YAML <<: is shallow), and openrag declares its own. The shared env is hoisted into x-openrag-env so both variants merge it explicitly, and the GPU service's list form is converted to mapping form to allow merging.

Verification

On a live stack, after recreating the container:

  • PDF ingested end-to-end reaches task_state: COMPLETED
  • marker logs Processed /tmp/tmpw2kxewk9.pdf in 33.75s
  • PermissionError count since restart: 0
  • docker compose config confirms FONT_PATH resolves for both openrag and openrag-cpu, and the NVIDIA_* vars survive the list->mapping conversion

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved deployment configuration to ensure consistent font availability across services.
    • Updated GPU-enabled deployments to apply NVIDIA runtime settings more reliably.
    • Improved environment configuration inheritance for services using the shared deployment template.

Marker downloads its rendering font lazily on the first PDF conversion,
and its default target is inside the installed package:

    site-packages/static/fonts/GoNotoCurrent-Regular.ttf

entrypoint.sh drops the app to a non-root user (APP_UID, GID 0) while
the venv lives in the root-owned `openrag_venv` named volume, whose
site-packages is `root:root drwxr-xr-x`. The font download therefore
cannot create `static/` and every PDF ingestion dies with:

    PermissionError: [Errno 13] Permission denied:
      '/app/.venv/lib/python3.12/site-packages/static'

Point FONT_PATH at /app/data/fonts/, a bind-mounted directory the app
user already owns (entrypoint.sh grants GID-0 write on /app/data). The
~15MB download then happens once and persists across restarts.

FONT_PATH is the only knob needed: marker's Settings is a pydantic
BaseSettings with no env prefix, FONT_DIR is dead except as the default
for FONT_PATH, and the two other readers (providers/__init__.py,
processors/debug.py) both go through FONT_PATH.

The shared env is hoisted into its own `x-openrag-env` anchor because a
service's own `environment:` key *replaces* the one merged in via `<<:`
(YAML merge is shallow). Adding it to `x-openrag` alone was silently
dropped by the GPU `openrag` service, which declares its own
`environment:`. Both variants now merge the anchor explicitly, and the
GPU service's list form is converted to mapping form to allow it.

Verified on a live stack: a PDF ingested end-to-end reaches
task_state=COMPLETED, marker logs "Processed ... in 33.75s", and the
PermissionError count since restart is zero.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Docker Compose now defines a shared FONT_PATH environment anchor and merges it into the OpenRAG template and GPU service, which also retains its NVIDIA environment settings in mapping form.

Changes

Compose environment configuration

Layer / File(s) Summary
Shared environment anchor and service merges
infra/compose/docker-compose.yaml
Adds the shared FONT_PATH anchor and merges it into the OpenRAG template and GPU service, alongside NVIDIA_VISIBLE_DEVICES and NVIDIA_DRIVER_CAPABILITIES.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: fix

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: a compose fix for Marker PDF conversion PermissionError.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/marker-font-path

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the fix Fix issue label Jul 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@infra/compose/docker-compose.yaml`:
- Around line 7-18: FONT_PATH is not consumed by Marker, so the font remains in
the package directory. Update the Marker configuration or conversion path used
by the PDF conversion service to pass the supported font-location override, and
adjust the shared `openrag_env` setting to that supported key.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 066f3af0-662a-4de7-a7da-b523ec651b66

📥 Commits

Reviewing files that changed from the base of the PR and between 760531e and 62ad6df.

📒 Files selected for processing (1)
  • infra/compose/docker-compose.yaml

Comment thread infra/compose/docker-compose.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Fix issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant