Skip to content

Add compose v5 compatibility, legacy-field warnings, UI error fixes#2094

Open
SohamKukreti wants to merge 1 commit into
developfrom
fix/docker-deploy-0.9-gaps
Open

Add compose v5 compatibility, legacy-field warnings, UI error fixes#2094
SohamKukreti wants to merge 1 commit into
developfrom
fix/docker-deploy-0.9-gaps

Conversation

@SohamKukreti

Copy link
Copy Markdown
Collaborator

Summary

Companion to the self-hosting docs update; all changes verified against a built 0.9.2 image.

docker-compose.yml:

  • Express the PID cap as deploy.resources.limits.pids instead of pids_limit: Compose v5 normalizes the two together and rejected the file ("can't set distinct values on 'pids_limit' and 'deploy.resources.limits.pids'"), which also broke compose down. Identical behavior on Compose v2.x.

entrypoint.sh:

  • When no CRAWL4AI_API_TOKEN is set, explain that the loopback bind is the container's own (published ports reset connections) and how to fix it. The old one-line notice read as "available at 127.0.0.1:11235" and sent users debugging the wrong thing.

server.py / schemas.py:

  • /screenshot and /pdf: output_path (removed in 0.9.0) was silently dropped; requests still succeed but now return a warning that no file was written and results are fetched via GET /artifacts/{artifact_id}.
  • Legacy hooks.code (removed in 0.9.0) parsed as an empty hook list and reported {"status": "success", "attached": []} with hooks enabled. The field is now captured (never executed) and the response reports status "ignored" plus a warning; /crawl/stream sends X-Hooks-Warning. With hooks disabled, any hooks payload still returns 403 (unchanged).
  • Add "/" to the auth gate's exact-match public paths so the existing root -> /playground redirect is reachable; previously the middleware returned a bare 401 before the route ran. /monitor and all data routes remain gated.

static/playground/index.html:

  • The streaming branch never checked response.ok and showed a green "Success" banner for 401 bodies; it now errors before reading the stream. All branches surface the server's detail message instead of a generic "Request failed", and 401s hint at the token bar (distinguishing "no token set" from "token rejected").

tests:

  • Add deploy/docker/tests/test_legacy_compat.py covering the root redirect, output_path warning, legacy-hooks handling, and the compose PID-cap placement (13 behavioral tests, TestClient-based).

Fixes #2091

List of files changed and why

  • deploy/docker/entrypoint.sh
  • deploy/docker/schemas.py
  • docker/server.py
  • docker/static/playground/index.html
  • deploy/docker/tests/test_legacy_compat.py
  • docker-compose.yml

How Has This Been Tested?

Ran old tests and also created a new test file to test the changes. Manually verified as well.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added/updated unit tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

…und error handling

- docker-compose.yml: move the PID cap to deploy.resources.limits.pids
  (Compose v5 rejects pids_limit alongside a limits block; same behavior
  on v2.x).
- entrypoint.sh: explain the loopback-only bind when no CRAWL4AI_API_TOKEN
  is set and how to fix it.
- server.py: warn when the removed output_path (screenshot/pdf) or legacy
  hooks.code is sent - fields are ignored, never executed; hooks status
  reads "ignored" and /crawl/stream sends X-Hooks-Warning. Make "/"
  public so the /playground redirect works; data routes stay gated.
- schemas.py: capture legacy hooks.code so it can be reported (never run).
- playground: check response.ok on the streaming branch, surface server
  error details, hint at the token bar on 401.
- tests: add deploy/docker/tests/test_legacy_compat.py (13 tests).
@SohamKukreti
SohamKukreti force-pushed the fix/docker-deploy-0.9-gaps branch from 614593c to 12d138b Compare July 22, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant