wip #2283

Merged
mfreeman451 merged 1 commit from refs/pull/2283/head into main 2025-10-05 19:44:42 +00:00
mfreeman451 commented 2025-10-05 19:44:17 +00:00 (Migrated from github.com)
Owner

Imported from GitHub pull request.

Original GitHub pull request: #1711
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/1711
Original created: 2025-10-05T19:44:17Z
Original updated: 2025-10-05T19:45:18Z
Original head: carverauto/serviceradar:updates/k8s-fixes
Original base: main
Original merged: 2025-10-05T19:44:42Z by @mfreeman451

PR Type

Enhancement


Description

  • Add Next.js static file symlink setup for web container

  • Configure proper directory structure for standalone deployment

  • Implement startup script for serviceradar-web application


Diagram Walkthrough

flowchart LR
  A["Container Start"] --> B["Create .next/standalone/.next directory"]
  B --> C["Check static symlink exists"]
  C --> D["Create symlink if missing"]
  D --> E["Start Node.js server"]

File Walkthrough

Relevant files
Configuration changes
serviceradar-web.yaml
Configure Next.js standalone deployment setup                       

k8s/demo/base/serviceradar-web.yaml

  • Add startup script with directory creation and symlink setup
  • Configure Next.js standalone deployment structure
  • Implement proper static file linking for web application
+9/-0     

Imported from GitHub pull request. Original GitHub pull request: #1711 Original author: @mfreeman451 Original URL: https://github.com/carverauto/serviceradar/pull/1711 Original created: 2025-10-05T19:44:17Z Original updated: 2025-10-05T19:45:18Z Original head: carverauto/serviceradar:updates/k8s-fixes Original base: main Original merged: 2025-10-05T19:44:42Z by @mfreeman451 --- ### **PR Type** Enhancement ___ ### **Description** - Add Next.js static file symlink setup for web container - Configure proper directory structure for standalone deployment - Implement startup script for serviceradar-web application ___ ### Diagram Walkthrough ```mermaid flowchart LR A["Container Start"] --> B["Create .next/standalone/.next directory"] B --> C["Check static symlink exists"] C --> D["Create symlink if missing"] D --> E["Start Node.js server"] ``` <details> <summary><h3> File Walkthrough</h3></summary> <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Configuration changes</strong></td><td><table> <tr> <td> <details> <summary><strong>serviceradar-web.yaml</strong><dd><code>Configure Next.js standalone deployment setup</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary> <hr> k8s/demo/base/serviceradar-web.yaml <ul><li>Add startup script with directory creation and symlink setup<br> <li> Configure Next.js standalone deployment structure<br> <li> Implement proper static file linking for web application</ul> </details> </td> <td><a href="https://github.com/carverauto/serviceradar/pull/1711/files#diff-38e9af448fa50de08128d5acfd59f72c662a2a89c2da2bd418dc1eedcd6b4679">+9/-0</a>&nbsp; &nbsp; &nbsp; </td> </tr> </table></td></tr></tr></tbody></table> </details> ___
qodo-code-review[bot] commented 2025-10-05 19:44:35 +00:00 (Migrated from github.com)
Author
Owner

Imported GitHub PR comment.

Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1711#issuecomment-3369281322
Original created: 2025-10-05T19:44:35Z

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
Symlink/path tampering

Description: The container executes a shell inline script that creates and follows symlinks, which
could be abused if the application directory is writable at runtime; ensure the container
filesystem is read-only or /app is not writable to prevent symlink or path tampering.
serviceradar-web.yaml [26-34]

Referred Code
args:
- /bin/sh
- -c
- |
  mkdir -p /app/.next/standalone/.next
  if [ ! -e /app/.next/standalone/.next/static ]; then
    ln -sfn /app/.next/static /app/.next/standalone/.next/static
  fi
  exec node .next/standalone/server.js
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
No custom compliance provided

Follow the guide to enable custom compliance check.

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
- Requires Further Human Verification
🏷️ - Compliance label
Imported GitHub PR comment. Original author: @qodo-code-review[bot] Original URL: https://github.com/carverauto/serviceradar/pull/1711#issuecomment-3369281322 Original created: 2025-10-05T19:44:35Z --- ## PR Compliance Guide 🔍 <!-- https://github.com/carverauto/serviceradar/commit/7bfbe576682e0e9df823a3d1c190e628b079b03d --> Below is a summary of compliance checks for this PR:<br> <table><tbody><tr><td colspan='2'><strong>Security Compliance</strong></td></tr> <tr><td rowspan=1>⚪</td> <td><details><summary><strong>Symlink/path tampering </strong></summary><br> <b>Description:</b> The container executes a shell inline script that creates and follows symlinks, which <br>could be abused if the application directory is writable at runtime; ensure the container <br>filesystem is read-only or /app is not writable to prevent symlink or path tampering.<br> <strong><a href='https://github.com/carverauto/serviceradar/pull/1711/files#diff-38e9af448fa50de08128d5acfd59f72c662a2a89c2da2bd418dc1eedcd6b4679R26-R34'>serviceradar-web.yaml [26-34]</a></strong><br> <details open><summary>Referred Code</summary> ```yaml args: - /bin/sh - -c - | mkdir -p /app/.next/standalone/.next if [ ! -e /app/.next/standalone/.next/static ]; then ln -sfn /app/.next/static /app/.next/standalone/.next/static fi exec node .next/standalone/server.js ``` </details></details></td></tr> <tr><td colspan='2'><strong>Ticket Compliance</strong></td></tr> <tr><td>⚪</td><td><details><summary>🎫 <strong>No ticket provided </summary></strong> - [ ] Create ticket/issue <!-- /create_ticket --create_ticket=true --> </details></td></tr> <tr><td colspan='2'><strong>Codebase Duplication Compliance</strong></td></tr> <tr><td>⚪</td><td><details><summary><strong>Codebase context is not defined </strong></summary> Follow the <a href='https://qodo-merge-docs.qodo.ai/core-abilities/rag_context_enrichment/'>guide</a> to enable codebase context checks. </details></td></tr> <tr><td colspan='2'><strong>Custom Compliance</strong></td></tr> <tr><td>⚪</td><td><details><summary><strong>No custom compliance provided</strong></summary> Follow the <a href='https://qodo-merge-docs.qodo.ai/tools/compliance/'>guide</a> to enable custom compliance check. </details></td></tr> <tr><td align="center" colspan="2"> <!-- placeholder --> <!-- /compliance --update_compliance=true --> </td></tr></tbody></table> <details><summary>Compliance status legend</summary> 🟢 - Fully Compliant<br> 🟡 - Partial Compliant<br> 🔴 - Not Compliant<br> ⚪ - Requires Further Human Verification<br> 🏷️ - Compliance label<br> </details>
qodo-code-review[bot] commented 2025-10-05 19:45:18 +00:00 (Migrated from github.com)
Author
Owner

Imported GitHub PR comment.

Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/1711#issuecomment-3369281678
Original created: 2025-10-05T19:45:18Z

PR Code Suggestions

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Make symlink creation idempotent for robustness

To improve robustness, remove the conditional check for the static assets'
symbolic link. Rely on ln -sfn to make the link creation idempotent, ensuring
it's correctly configured on every container start.

k8s/demo/base/serviceradar-web.yaml [31-33]

-if [ ! -e /app/.next/standalone/.next/static ]; then
-  ln -sfn /app/.next/static /app/.next/standalone/.next/static
-fi
+ln -sfn /app/.next/static /app/.next/standalone/.next/static
  • Apply / Chat
Suggestion importance[1-10]: 6

__

Why: The suggestion correctly points out that the if condition is unnecessary and potentially harmful, as ln -sfn is already idempotent and will ensure the symlink is correct on every start, making the script more robust.

Low
  • More
Imported GitHub PR comment. Original author: @qodo-code-review[bot] Original URL: https://github.com/carverauto/serviceradar/pull/1711#issuecomment-3369281678 Original created: 2025-10-05T19:45:18Z --- ## PR Code Suggestions ✨ <!-- 7bfbe57 --> Explore these optional code suggestions: <table><thead><tr><td><strong>Category</strong></td><td align=left><strong>Suggestion&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </strong></td><td align=center><strong>Impact</strong></td></tr><tbody><tr><td rowspan=1>Possible issue</td> <td> <details><summary>Make symlink creation idempotent for robustness</summary> ___ **To improve robustness, remove the conditional check for the static assets' <br>symbolic link. Rely on <code>ln -sfn</code> to make the link creation idempotent, ensuring <br>it's correctly configured on every container start.** [k8s/demo/base/serviceradar-web.yaml [31-33]](https://github.com/carverauto/serviceradar/pull/1711/files#diff-38e9af448fa50de08128d5acfd59f72c662a2a89c2da2bd418dc1eedcd6b4679R31-R33) ```diff -if [ ! -e /app/.next/standalone/.next/static ]; then - ln -sfn /app/.next/static /app/.next/standalone/.next/static -fi +ln -sfn /app/.next/static /app/.next/standalone/.next/static ``` - [ ] **Apply / Chat** <!-- /improve --apply_suggestion=0 --> <details><summary>Suggestion importance[1-10]: 6</summary> __ Why: The suggestion correctly points out that the `if` condition is unnecessary and potentially harmful, as `ln -sfn` is already idempotent and will ensure the symlink is correct on every start, making the script more robust. </details></details></td><td align=center>Low </td></tr> <tr><td align="center" colspan="2"> - [ ] More <!-- /improve --more_suggestions=true --> </td><td></td></tr></tbody></table>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
carverauto/serviceradar!2283
No description provided.