Skip to content

feat(standalone): configurable file-size limits + Postgres schema bootstrap - #301

Closed
ckbaker10 wants to merge 2 commits into
Euro-Office:mainfrom
ckbaker10:feat-file-size
Closed

feat(standalone): configurable file-size limits + Postgres schema bootstrap#301
ckbaker10 wants to merge 2 commits into
Euro-Office:mainfrom
ckbaker10:feat-file-size

Conversation

@ckbaker10

Copy link
Copy Markdown
Contributor

Problem

Two unrelated gaps in build/scripts/standalone/entrypoint.sh, bundled here because they touch
the same file:

  1. Upload/conversion size limits (limits_tempfile_upload, maxDownloadBytes, the two
    inputLimits[].zip.uncompressed values, nginx's client_max_body_size) are hardcoded. Raising
    them today means sed-patching files inside a running container, which isn't under any
    documented volume — the edit is gone on next docker run/recreate.
  2. A fresh Postgres volume leaves docservice failing with DB table "task_result" does not exist
    and never binding :8000, so nginx serves 502 on /healthcheck until someone applies the
    schema by hand.

Approach

Size limits — four new env vars, defaults match current shipped values (unset = no behavior
change):

Var Default Applies to
MAX_FILE_SIZE 104857600 services.CoAuthoring.server.limits_tempfile_upload, FileConverter.converter.maxDownloadBytes (local.json), example app's maxFileSize
MAX_ZIP_UNCOMPRESSED_DOC 50MB inputLimits[].zip.uncompressed for docx/pptx/vsdx
MAX_ZIP_UNCOMPRESSED_XLSX 300MB same, xlsx
NGINX_CLIENT_MAX_BODY_SIZE 100m client_max_body_size in ds-common.conf

inputLimits gets patched with sed directly on default.json rather than merged into
local.json — node-config replaces arrays wholesale instead of merging by element, which would
silently drop the template field from every entry. ds-example.conf needs no change, it has no
client_max_body_size of its own and inherits from ds-common.conf's scope.

Schema bootstrapensure_db_schema(), called after service postgresql start: waits for
Postgres, checks for the task_result table, applies server/schema/postgresql/createdb.sql if
missing. No-op on an already-initialized DB.

Testing

  • jq filter logic checked against a fixture matching server/Common/config/default.json's actual
    schema: numeric coercion and per-family zip-limit targeting both correct.
  • Verified on two live instances:
    • client_max_body_size in ds-common.conf actually gets patched and nginx accepts the larger
      body size.
    • Uploading a file larger than the old 100MB default through /example/ succeeds end-to-end.
    • Fresh Postgres volume: ensure_db_schema creates the schema on first boot, docservice comes
      up healthy instead of 502-ing on /healthcheck.
    • New env vars left unset: config/behavior matches what shipped before this change.

AI disclosure

Drafted with AI assistance (Claude Code / Sonnet 5) per the repo's AI Contribution Policy.

@ckbaker10
ckbaker10 requested a review from a team as a code owner July 27, 2026 14:33
@ckbaker10
ckbaker10 requested review from rikled and removed request for a team July 27, 2026 14:33
Signed-off-by: ckbkr <56784875+ckbaker10@users.noreply.github.com>
Assisted-by: ClaudeCode:claude-sonnet-5
Signed-off-by: ckbkr <56784875+ckbaker10@users.noreply.github.com>
Assisted-by: ClaudeCode:claude-sonnet-5
@chrip
chrip self-requested a review July 27, 2026 19:19

@chrip chrip left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @ckbaker10! Requesting changes — nothing wrong with the code itself: the schema-bootstrap half is genuinely good and approvable on its own, and I found no correctness bug in the paths I could verify statically. Two things before merge, though:

  • It collides with #237, which is still open and touches the same build/scripts/standalone/entrypoint.sh for the same settings (.FileConverter.converter.maxDownloadBytes and the zip inputLimits) under different env-var names and a different mechanism. Merging both would conflict and leave two competing controls for one setting.
  • It bundles an unrelated concern — the size limits and the Postgres schema bootstrap are two separate changes sharing a file.

Could you split out ensure_db_schema into its own PR (I'd merge that quickly), and reconcile the size-limit half with #237 — one env-var scheme and one mechanism per setting? Happy to help align the naming.

Assisted-by: ClaudeCode:claude-opus-4-8

@github-project-automation github-project-automation Bot moved this from 📄 To do to 🏗️ In progress in 📄 Euro-Office team Jul 27, 2026
@ckbaker10

Copy link
Copy Markdown
Contributor Author

closed in favour of

#304
#305

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ☑️ Done

Development

Successfully merging this pull request may close these issues.

2 participants