docs: add Multiple Applications on One Cluster guide#586
Conversation
Add a guide covering how to run multiple applications on a single Harper cluster: how components coexist, how to isolate them via routes, data, and roles, and how to deploy across every node. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request adds a new documentation guide on running multiple applications on a single Harper cluster. The reviewer feedback correctly identifies several naming errors in the documentation, specifically pointing out that the configuration file should be named 'harper-config.yaml' instead of 'harperdb-config.yaml', and that the CLI command is 'harper' rather than 'harperdb'. Additionally, the reviewer suggested using a Docusaurus note admonition instead of a standard markdown blockquote for consistency.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Rename config file references to harper-config.yaml (was harperdb-config.yaml) - Use the harper CLI consistently (was harperdb) - Convert the restart note to a :::note admonition - Fix broken doc links to resolve to /reference/v5/ targets Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-586 This preview will update automatically when you push new commits. |
kriszyp
left a comment
There was a problem hiding this comment.
Thanks for putting this together — the mechanics that are here (config.yaml precedence, ports, deploy_component replicated=true) are accurate, and the broken cross-references from the first pass are fixed.
Requesting changes on scope/completeness, though — for a "multiple applications on one cluster" guide, the routing story is the crux and it's currently thin:
Significant — routing is incomplete. The guide only covers static assets / Fastify. It doesn't explain middleware routing by URL path, which is the primary mechanism for fronting multiple apps on one instance (how a request path maps to a given application). That should be the backbone of this guide, not an aside.
Significant — virtual hosts are missing. Hostname-based routing (virtual hosts) is arguably the feature for hosting multiple apps on one cluster — routing by host, not just path. A multi-app guide that omits it leaves out the main pattern users will reach for.
Significant — module loader context isolation. When several apps run in one instance, how their module loader contexts are isolated (or shared) is a real correctness/operational concern and belongs in this guide — at minimum a section explaining the isolation model so users understand what is and isn't shared between co-located apps.
Happy to point at the canonical references for each of these if that helps. The foundation is good; it just needs the routing + isolation story filled in before it's the guide people should follow for this topic.
— review via KrAIs (Claude) on Kris's behalf
Address maintainer review requesting fuller routing and isolation coverage: - Make routing the backbone: new "Routing requests to each application" section covering path-based routing (urlPath), the server.http() middleware chain, and host-based routing via request.host - Add "What co-located applications share" section documenting the module loader context isolation model (isolated module caches, shared process-wide data/APIs, shared process lifecycle) - Note SNI certificate configuration for serving multiple domains Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks @kriszyp — good call on scope. Pushed changes addressing all three:
Verified with a full |
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-586 This preview will update automatically when you push new commits. |
kriszyp
left a comment
There was a problem hiding this comment.
Requesting changes, but narrower than the automated review suggested — checked the two API-shape claims against Harper's actual Request implementation before posting, and they don't hold up:
request.hostandrequest.pathnameare real, documented HarperRequestproperties (server/serverHelpers/Request.ts), not something that needsrequest.headers.get(...)instead — no change needed there.- Marking the handlers
asyncisn't required for crash-safety either:requestHandlerinserver/http.tsalready wraps the whole chain call in atry/catch(await httpChain[port](request)), which catches a synchronous throw from a non-async middleware just as reliably as an async one.
The one thing genuinely worth fixing: the first example's prose says "dispatch on a custom header" but the code shows a path-prefix check (request.pathname.startsWith('/listings')) — text and code don't match each other. Worth making the example match the text (a header check, since that's the case path-prefix routing doesn't already cover) so the doc isn't demonstrating the wrong tool for the job it describes. Not a correctness or performance bug, just an internal consistency fix.
The middleware-chain example described dispatching on a custom header but showed a path-prefix check — a case path-based routing already covers. Switch the example to a custom-header check so it demonstrates what the surrounding text actually recommends the chain for. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks for checking the API shapes against the source, @kriszyp — agreed on all counts ( Fixed the one genuine issue: the middleware-chain example now dispatches on a custom header ( |
🚀 Preview DeploymentYour preview deployment is ready! 🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-586 This preview will update automatically when you push new commits. |
kriszyp
left a comment
There was a problem hiding this comment.
Thanks for adding the hostname-routing section. One significant correction is still needed: the current example manually branches on request.host, but Harper 5.2 has first-class virtual-host routing.
Components can declare host in config.yaml; the scoped server API automatically carries that value into the component’s HTTP, WebSocket, and upgrade registrations. Custom code can register the same routed chain directly with server.http(handler, { host: "admin.example.com" }). Harper then matches the request Host header and selects the corresponding isolated middleware chain.
Please make that declarative host configuration the primary application-routing pattern, show the direct { host } option as the programmatic equivalent, and reserve branching on request.host for genuinely custom dispatch. The SNI material should remain separate: SNI selects the certificate, while host selects the application middleware chain.
I opened Document middleware host and path routing (#595) to add the missing canonical references for both host and urlPath; this guide can link to those sections once it lands.
— review via KrAIs (GPT-5) on Kris’s behalf
Summary
Adds a new developer guide, Multiple Applications on One Cluster, covering how to run multiple applications on a single Harper cluster:
config.yamlharperdb-config.yaml) and imperatively (CLI)replicated=trueWritten in the platform's technical-documentation tone, consistent with the sibling
harper-applications-in-depth.mdxguide.🤖 Generated with Claude Code