Skip to content

prm: production Dockerfile; trace PGlite assets into .output - #49

Merged
jherr merged 3 commits into
mainfrom
prm-docker-deploy
Dec 3, 2026
Merged

jherr merged 3 commits into
mainfrom
prm-docker-deploy

Conversation

@jherr

@jherr jherr commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • app/prm/Dockerfile: a production image for the PRM, built from the repo root.
    • Installs only the PRM's workspace dependencies (pnpm install --filter 'prm...').
    • The runtime stage contains only .output, runs as non-root, and keeps its data on a /data volume (PRM_DATA_DIR).
    • A HEALTHCHECK hits /api/cms/v1/health.
    • Nothing secret is used at build time; every key is runtime env.
  • app/prm/vite.config.ts: makes Nitro trace @electric-sql/pglite instead of bundling it, the same pattern app/base uses for QuickJS.
    • Bundling dropped pglite.data and the pg_trgm extension bundle, so the embedded store never opened in a production build.
    • The symptom was every health check returning 503 with CMS Postgres connection acquisition timed out.
  • app/prm/src/events.ts: imports systemContext from @tanstack/cms-core/server lazily inside the handlers.
    • The static import pulled the server runtime (new AsyncLocalStorage) into the client bundle.
    • In production builds, hydration crashed (L.AsyncLocalStorage is not a constructor) and /setup stayed stuck on "Loading setup…".
    • This also affects plain main.
  • app/prm/src/routes/prm-settings.tsx: moves PageHeader inside PageMain. It was the only route rendering the header outside the max-width column, so the Settings title sat flush against the left edge of the viewport.

Why

This lets the PRM deploy to Jack's Mac Studio through Komodo for the AI Coding Summit.

  • A Komodo Action polls main and builds prm:<sha> from this Dockerfile.
  • It then health-checks /api/cms/v1/health and rolls back to the last good image if that check fails.
  • The deploy config (compose, poller) lives in Komodo, not in this repo.

Testing

  • Ran the first-run flow in headless Chromium against the production image: /setup, then create the owner, then /, /people, /groups, /stale, /ask and /prm-settings. There were no page errors and no 5xx responses.
  • Built from a fresh clone (about 26s). The container became healthy ({"ok":true,"schema":{"current":9,"latest":9}}), and / redirected to /setup.
  • Created an owner via /api/prm-auth/setup, recreated the container, and logged in again. The data persisted on the volume.
  • The same commit has been running in production on the Studio through the Komodo pipeline. The good-deploy, failed-build, failed-health rollback and manual rollback drills all passed.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Added a production Docker image for PRM with a health check and runtime configuration.
  • Bug Fixes
    • Improved production packaging for database assets.
  • Style
    • Adjusted the settings page layout.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The PRM changes configure PGlite dependency handling, add a two-stage production Docker image, and defer systemContext imports in both event handlers. The settings page now places PageHeader inside PageMain.

Changes: PRM runtime and deployment

Layer / File(s) Summary
Runtime dependency handling
app/prm/vite.config.ts, app/prm/src/events.ts
Nitro traces PGlite dependencies, and the SSR external list includes @electric-sql/pglite. Both event handlers dynamically import systemContext inside run; the static import is removed.
Production Docker image
app/prm/Dockerfile
The Dockerfile builds PRM and configures a runtime image that runs as node, uses /data, exposes port 3000, and checks the health endpoint.

Settings page layout

Layer / File(s) Summary
Settings header placement
app/prm/src/routes/prm-settings.tsx
PageHeader now appears inside PageMain. The header content is unchanged.

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

Change: Bug fix

Merge Risk: Minimal · up to 4cc1d

This change adds a production Docker image, packages the PGlite assets, fixes client hydration by deferring a server-only import, and moves the settings header. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "prm: production Dockerfile; trace PGlite assets into .output" names the two main changes in the PR: a production Docker image for PRM and Nitro tracing of PGlite assets. It is specific and …
Description check Passed The description follows the repository's template in its main structure. It has a Summary section that covers the four changed files, with the purpose, the root cause, and the testing done. The templa…
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.
Full details: Title check

Explanation

The title "prm: production Dockerfile; trace PGlite assets into .output" names the two main changes in the PR: a production Docker image for PRM and Nitro tracing of PGlite assets. It is specific and matches the changeset. It does not mention the lazy systemContext import or the Settings header move, which the description says are also included, but the task does not require full coverage.

Full details: Description check

Explanation

The description follows the repository's template in its main structure. It has a Summary section that covers the four changed files, with the purpose, the root cause, and the testing done. The template's Starter & Documentation Checklist is not present. That checklist applies only when a starter, a banner app (app/prm, app/base), or starter documentation changes. This PR changes app/prm, so the checklist applies, and the description does not address it. Most of the required content is present, so the check passes, but the author should confirm the checklist items or mark them not applicable.

Resolution

Add the Starter & Documentation Checklist from the template, or state why each item does not apply. This PR changes files under app/prm, which is a banner app named in the checklist.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 441fd67 and 4cc1d8f.

Files selected for processing: 4

  • app/prm/Dockerfile
  • app/prm/src/events.ts
  • app/prm/src/routes/prm-settings.tsx
  • app/prm/vite.config.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@changeset-bot

changeset-bot Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4cc1d8f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Jack Herrington and others added 3 commits December 3, 2026 08:01
Adds app/prm/Dockerfile (build from repo root, filtered pnpm install of the
PRM's workspace closure, runtime = .output only, non-root, /data volume,
HEALTHCHECK on /api/cms/v1/health). No secrets at build time.

Nitro was bundling @electric-sql/pglite, dropping pglite.data and the
pg_trgm extension bundle, so the default embedded store never opened in a
production build (health 503: connection acquisition timed out). Trace it
as a dependency instead, same pattern as app/base does for QuickJS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
events.ts is reachable from the client (router.tsx -> cms.config.ts) and
statically imported systemContext from @tanstack/cms-core/server, which
pulled the server runtime (new AsyncLocalStorage from node:async_hooks)
into the browser chunk. In a production build hydration crashed with
'L.AsyncLocalStorage is not a constructor', leaving /setup stuck on
'Loading setup…'. Import it lazily inside the handlers, alongside the
existing dynamic import of @tanstack/cms-api (same pattern as app/base).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Settings route rendered PageHeader outside PageMain, so the header
escaped the centred max-width column and sat flush against the viewport edge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jherr
jherr force-pushed the prm-docker-deploy branch from de7c3ae to 4cc1d8f Compare December 3, 2026 16:02
@pkg-pr-new

pkg-pr-new Bot commented Dec 3, 2026

Copy link
Copy Markdown

Open in StackBlitz

@tanstack/cms-api

npm i https://pkg.pr.new/TanStack/cms/@tanstack/cms-api@49

@tanstack/cms-cli

npm i https://pkg.pr.new/TanStack/cms/@tanstack/cms-cli@49

@tanstack/cms-client

npm i https://pkg.pr.new/TanStack/cms/@tanstack/cms-client@49

@tanstack/cms-compat-wp

npm i https://pkg.pr.new/TanStack/cms/@tanstack/cms-compat-wp@49

@tanstack/cms-connect-atproto

npm i https://pkg.pr.new/TanStack/cms/@tanstack/cms-connect-atproto@49

@tanstack/cms-migrate-wp

npm i https://pkg.pr.new/TanStack/cms/@tanstack/cms-migrate-wp@49

@tanstack/cms-skills

npm i https://pkg.pr.new/TanStack/cms/@tanstack/cms-skills@49

@tanstack/cms-core

npm i https://pkg.pr.new/TanStack/cms/@tanstack/cms-core@49

@tanstack/cms-media-s3

npm i https://pkg.pr.new/TanStack/cms/@tanstack/cms-media-s3@49

@tanstack/search-ai

npm i https://pkg.pr.new/TanStack/cms/@tanstack/search-ai@49

@tanstack/search-cms

npm i https://pkg.pr.new/TanStack/cms/@tanstack/search-cms@49

@tanstack/search-core

npm i https://pkg.pr.new/TanStack/cms/@tanstack/search-core@49

@tanstack/search-headless

npm i https://pkg.pr.new/TanStack/cms/@tanstack/search-headless@49

@tanstack/search-ui-react

npm i https://pkg.pr.new/TanStack/cms/@tanstack/search-ui-react@49

@tanstack/cms-store-postgres

npm i https://pkg.pr.new/TanStack/cms/@tanstack/cms-store-postgres@49

@tanstack/cms-ui-dom

npm i https://pkg.pr.new/TanStack/cms/@tanstack/cms-ui-dom@49

@tanstack/cms-ui-react

npm i https://pkg.pr.new/TanStack/cms/@tanstack/cms-ui-react@49

commit: 4cc1d8f

@jherr
jherr merged commit 187b97f into main Dec 3, 2026
11 of 12 checks passed
@jherr
jherr deleted the prm-docker-deploy branch December 3, 2026 20:02
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