Repository navigation
feat: Implemented runtime basepath config - #2561
Conversation
* Implemented runtime basepath config * fixed makefile not showing base path * fixed picks * fix not working in kb pod * changed entrypoint to write at tmp * fixed picks * fix: validate runtime frontend base paths at startup (#2508) Co-authored-by: Edwin Jose <edwin.jose@ibm.com> --------- Co-authored-by: Edwin Jose <edwin.jose@datastax.com> Co-authored-by: Edwin Jose <edwin.jose@ibm.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Build configuration and path validation frontend/next.config.ts, frontend/next.config.test.ts, frontend/lib/frontend-base-path.ts, frontend/lib/frontend-base-path.test.ts |
The Next.js config factory selects a placeholder for production image builds when runtime base paths are enabled, and emits standalone output. Path validation uses an allowed-character set and rejects repeated slashes and dot segments. Tests cover configuration phases and path cases. |
Container startup and asset replacement Dockerfile.frontend, frontend/entrypoint.sh, frontend/entrypoint.test.ts |
The image packages standalone output and starts through entrypoint.sh. The entrypoint validates the base path, copies assets to a writable runtime directory, replaces the placeholder in the copied assets, and starts server.js. Tests cover normalization, rejection, and missing standalone output. |
Local and Kubernetes configuration Makefile, docker-compose.yml, kubernetes/helm/openrag/templates/frontend/deployment.yaml, kubernetes/helm/openrag/values.yaml, docs/docs/reference/configuration.mdx, .env.example |
Compose and Helm pass the base path at runtime. Helm mounts an emptyDir at /tmp and uses the normalized path for health probes. Makefile recipes omit the path build argument and display the configured local URL. Documentation describes path validation and writable runtime-directory requirements. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant NextConfig
participant DockerImage
participant entrypoint_sh
participant server_js
NextConfig->>DockerImage: build standalone output with a base-path placeholder
DockerImage->>entrypoint_sh: start with the runtime base-path environment
entrypoint_sh->>entrypoint_sh: validate path and copy assets to runtime directory
entrypoint_sh->>entrypoint_sh: replace placeholder in copied assets
entrypoint_sh->>server_js: execute from runtime directory
Merge Risk: 
Minimal · up to 4f639
-
The frontend path is configured at startup. No merge-blocking issue was identified.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 6 files. (7 skipped: 7 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 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.
Comment @coderabbitai help to get the list of available commands.
|
Build successful! ✅ |
Cherry-pick from #2505
This pull request refactors how the OpenRAG frontend's base path (
OPENRAG_FRONTEND_BASE_PATH) is configured and applied. The main improvement is that the base path can now be set at container runtime, rather than build time, allowing for more flexible deployments (especially on Kubernetes) without needing to rebuild the frontend image. This is accomplished by introducing a runtime entrypoint script that patches the base path in a writable copy of the frontend assets. The Makefile, Dockerfile, Helm chart, and documentation are updated to support and explain this new workflow.Key changes:
Frontend Runtime Base Path Refactor:
frontend/entrypoint.shscript that copies frontend assets to a writable directory and replaces a placeholder with the runtimeOPENRAG_FRONTEND_BASE_PATH. This enables changing the base path at container startup, not build time.Dockerfile.frontendto use the new entrypoint script and no longer require the base path as a build argument. The placeholder is now replaced at runtime. [1] [2]frontend/next.config.tsto use a placeholder for the base path during image build and to support runtime replacement. Added logic to distinguish between development, build, and runtime phases. [1] [2] [3] [4]frontend/next.config.test.ts.Build and Deployment Process Updates:
OPENRAG_FRONTEND_BASE_PATHas a build argument in the Makefile and Docker Compose, simplifying image builds and supporting runtime configuration instead. [1] [2] [3] [4]Kubernetes and Helm Improvements:
deployment.yaml) to set the base path as an environment variable and mount a writable volume for runtime asset patching. Liveness and readiness probes now respect the configured base path. [1] [2] [3]Documentation and Environment Configuration:
.env.exampleand documentation to clarify that the frontend base path is now a runtime setting and does not require rebuilding the image. Provided guidance for Kubernetes deployments. [1] [2]These changes make frontend deployments more flexible and robust, especially in containerized and orchestrated environments.
Summary by CodeRabbit