Skip to content

Conversation

@MuhammadQadora
Copy link
Contributor

@MuhammadQadora MuhammadQadora commented Dec 21, 2025

fix #1312

Summary by CodeRabbit

  • Chores
    • Optimized application deployment infrastructure by streamlining the build process and consolidating configuration files.
    • Updated internal environment variable naming conventions for consistency across deployment pipeline.
    • Enhanced runtime image efficiency by removing unnecessary dependencies and adjusting directory structures.

✏️ Tip: You can customize this high-level summary in your review settings.

PR Summary by Typo

Overview

This PR refactors the Docker image and associated scripts to move the text-to-cypher application into its own dedicated directory (/text-to-cypher) for better organization and isolation.

Key Changes

  • Modified the Dockerfile to create and set permissions for the new /text-to-cypher directory and copy the application content into it.
  • Renamed the CYPHER environment variable to TEXT_TO_CYPHER across the Dockerfile, entrypoint.sh, and supervisord.conf for clarity.
  • Updated supervisord.conf to reflect the new directory structure and environment variable for starting the text-to-cypher program.

Work Breakdown

Category Lines Changed
New Work 2 (15.4%)
Churn 1 (7.7%)
Rework 10 (76.9%)
Total Changes 13
To turn off PR summary, please visit Notification settings.

@vercel
Copy link

vercel bot commented Dec 21, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
falkordb-browser Ready Ready Preview, Comment Dec 22, 2025 8:30am

@typo-app
Copy link

typo-app bot commented Dec 21, 2025

Static Code Review 📊

✅ All quality checks passed!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 21, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

The changes reorganize the text-to-cypher binary into a dedicated /text-to-cypher directory within the Docker runtime image, consolidate file copying operations, rename the CYPHER environment variable to TEXT_TO_CYPHER across configuration files, and streamline the supervisord process invocation logic.

Changes

Cohort / File(s) Summary
Container Configuration
Dockerfile, entrypoint.sh, supervisord.conf
Migrate text-to-cypher to dedicated directory: Updated Dockerfile to create /text-to-cypher, set proper ownership for nextjs user, and copy artifacts to the new location; renamed CYPHER environment variable to TEXT_TO_CYPHER in entrypoint.sh case statement and supervisord.conf environment references; simplified supervisord invocation to direct binary execution with inline timestamping; adjusted working directory from /app to /text-to-cypher in supervisord config.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Consistent variable naming convention change across three configuration files
  • Straightforward directory structure reorganization without logic changes
  • Simplified supervisord invocation is minor optimization

Poem

📦 A binary finds its home so neat,
In /text-to-cypher, a dedicated retreat,
CYPHER renamed to TEXT_TO_CYPHER bright,
Config files aligned—everything right! ✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: moving text-to-cypher to a dedicated directory, which aligns perfectly with the PR's primary objective.
Linked Issues check ✅ Passed The PR successfully addresses all coding requirements from issue #1312: text-to-cypher moved to dedicated /text-to-cypher directory, Docker image structure improved, environment variable renamed to TEXT_TO_CYPHER across all relevant files.
Out of Scope Changes check ✅ Passed All changes are in-scope and directly support the objective of moving text-to-cypher to a dedicated directory; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 1312-move-text-to-cypher-to-a-dedicated-directory

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the text-to-cypher service to use a dedicated directory structure, improving separation of concerns and Docker image organization. The changes also include security enhancements and environment variable renaming for clarity.

Key changes:

  • Relocated text-to-cypher service from /app to /text-to-cypher directory
  • Renamed CYPHER environment variable to TEXT_TO_CYPHER for clarity
  • Added Trivy vulnerability scanning to CI/CD workflows

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
supervisord.conf Updated text-to-cypher service directory and simplified command
package.json Changed Next.js version constraint from exact to caret
entrypoint.sh Updated environment variable check from CYPHER to TEXT_TO_CYPHER
Dockerfile Reorganized file structure, added npm removal for security, and created dedicated text-to-cypher directory
.github/workflows/release-image.yml Added Trivy security scanning step and upgraded build-push-action version
.github/workflows/nextjs.yml Added comprehensive security-scan job with Trivy integration and PR comments

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

entrypoint.sh Outdated
Comment on lines 4 to 6
case "${TEXT_TO_CYPHER:-}" in
1|true|True|TRUE)
export CYPHER="true"
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

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

The environment variable was renamed from CYPHER to TEXT_TO_CYPHER in the case statement (line 4), but the export statement (line 6) still uses the old CYPHER variable name. This inconsistency means supervisord won't recognize the new variable. Change 'export CYPHER' to 'export TEXT_TO_CYPHER' to maintain consistency.

Copilot uses AI. Check for mistakes.
supervisord.conf Outdated
[program:text-to-cypher]
command=sh -c '/app/text-to-cypher 2>&1 | while IFS= read -r line; do echo "[$(date "+%%Y-%%m-%%d %%H:%%M:%%S")] [TEXT-TO-CYPHER] $line"; done'
directory=/app
command=sh -c './text-to-cypher'
Copy link

Copilot AI Dec 21, 2025

Choose a reason for hiding this comment

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

The simplified command removes timestamp logging that was present in the original implementation. This makes debugging and monitoring more difficult. Consider restoring the logging wrapper or ensure that the text-to-cypher binary itself handles timestamped logging internally.

Suggested change
command=sh -c './text-to-cypher'
command=sh -c './text-to-cypher 2>&1 | awk '\''{ cmd="date -u +\"%Y-%m-%dT%H:%M:%SZ\""; cmd | getline ts; close(cmd); print ts, $0; fflush(); }'\'''

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link

@typo-app typo-app bot left a comment

Choose a reason for hiding this comment

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

AI Code Review 🤖

Files Reviewed: 3
Comments Added: 1
Lines of Code Analyzed: 23
Critical Issues: 0

PR Health: Excellent 🔥

Give 👍 or 👎 on each review comment to help us improve.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
supervisord.conf (1)

22-24: Directory and environment variable updates look correct.

The changes properly align with the Dockerfile's /text-to-cypher directory and the renamed TEXT_TO_CYPHER variable.

Regarding the simplified command: the timestamp logging wrapper was removed. If timestamped logs are needed for debugging, consider relying on the container runtime's logging driver (e.g., Docker's --log-opt t=true or fluentd/json-file with timestamps) rather than inline awk.

.github/workflows/release-image.yml (1)

63-63: Trivy scan will fail when TAGS contains multiple values.

When pushing tagged releases, env.TAGS will be falkordb/falkordb-browser:latest,falkordb/falkordb-browser:${{ github.ref_name }}. Trivy's image-ref expects a single reference.

Proposed fix: use the first tag

One approach is to set a dedicated scan tag:

      - name: Set tags
        run: |
          if ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}; then
            echo "TAGS=falkordb/falkordb-browser:latest,falkordb/falkordb-browser:${{ github.ref_name }}" >> $GITHUB_ENV
+           echo "SCAN_TAG=falkordb/falkordb-browser:latest" >> $GITHUB_ENV
          else
            echo "TAGS=falkordb/falkordb-browser:edge" >> $GITHUB_ENV
+           echo "SCAN_TAG=falkordb/falkordb-browser:edge" >> $GITHUB_ENV
          fi

      - name: Run Trivy vulnerability scanner
        uses: aquasecurity/[email protected]
        with:
-         image-ref: ${{ env.TAGS }}
+         image-ref: ${{ env.SCAN_TAG }}
🧹 Nitpick comments (3)
.github/workflows/nextjs.yml (2)

16-19: Consider scoping permissions to only the jobs that need them.

The build job doesn't appear to use pull-requests: write or security-events: write. These permissions are only needed by security-scan. You could move this permissions block to just the security-scan job, or use workflow-level defaults with job-level overrides.


21-22: Update actions/checkout to v4.

Both checkout steps use v3, which the static analyzer flags as outdated.

Proposed fix
       - name: Checkout
-        uses: actions/checkout@v3
+        uses: actions/checkout@v4

Apply to both line 22 and line 71.

Also applies to: 70-71

.github/workflows/release-image.yml (1)

70-78: Note: This rebuilds the image.

The push step rebuilds rather than pushing the previously scanned image. Consider using Docker's docker push command directly on the loaded image, or enable Docker layer caching to avoid redundant builds.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f96d046 and 74d9707.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • .github/workflows/nextjs.yml (2 hunks)
  • .github/workflows/release-image.yml (2 hunks)
  • Dockerfile (3 hunks)
  • entrypoint.sh (1 hunks)
  • supervisord.conf (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.9)
.github/workflows/nextjs.yml

71-71: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Setup and cache dependencies
  • GitHub Check: security-scan
🔇 Additional comments (7)
entrypoint.sh (1)

4-12: LGTM!

The environment variable rename from CYPHER to TEXT_TO_CYPHER is now consistent throughout the script. The boolean normalization for supervisord is correct.

Dockerfile (3)

48-50: Good security hardening.

Removing npm from the production image reduces the attack surface since Next.js standalone mode doesn't require it at runtime.


62-72: LGTM!

The /text-to-cypher directory setup with proper ownership and the updated copy target correctly isolate the text-to-cypher component.


86-86: Environment variable renamed correctly.

Consistent with entrypoint.sh and supervisord.conf.

.github/workflows/nextjs.yml (2)

87-99: Solid Trivy configuration.

The dual-output approach (SARIF for Security tab, table for PR comments) with continue-on-error: true and a separate failure step is a well-designed pattern.


118-161: PR comment handling looks good.

The logic correctly finds and updates existing bot comments to avoid spam, with proper fallback to create new comments.

.github/workflows/release-image.yml (1)

49-58: Good pattern: build locally, scan, then push.

Using load: true with push: false makes the image available for Trivy scanning before pushing to the registry.

@github-actions
Copy link

github-actions bot commented Dec 21, 2025

🔒 Trivy Security Scan Results


Report Summary

┌───────────────────────────────────────────────────────────────────────────┬──────────┬─────────────────┬─────────┐
│                                  Target                                   │   Type   │ Vulnerabilities │ Secrets │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ falkordb/falkordb-browser:test (alpine 3.23.2)                            │  alpine  │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/@img/colour/package.json                                 │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/@img/sharp-libvips-linux-x64/package.json                │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/@img/sharp-libvips-linuxmusl-x64/package.json            │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/@img/sharp-linux-x64/package.json                        │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/@img/sharp-linuxmusl-x64/package.json                    │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/@js-temporal/polyfill/package.json                       │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/@next/env/package.json                                   │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/@redis/client/package.json                               │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/@swc/helpers/package.json                                │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/client-only/package.json                                 │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/cluster-key-slot/package.json                            │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/detect-libc/package.json                                 │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/falkordb/node_modules/@redis/client/dist/package.json    │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/falkordb/node_modules/@redis/client/package.json         │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/falkordb/package.json                                    │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/generic-pool/package.json                                │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/jsbi/package.json                                        │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/lodash/package.json                                      │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/next/dist/compiled/@edge-runtime/cookies/package.json    │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/next/dist/compiled/@edge-runtime/ponyfill/package.json   │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/next/dist/compiled/@edge-runtime/primitives/package.json │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/next/dist/compiled/react-is/package.json                 │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/next/dist/compiled/regenerator-runtime/package.json      │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/next/package.json                                        │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/react-dom/package.json                                   │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/react/package.json                                       │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/redis/node_modules/@redis/bloom/package.json             │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/redis/node_modules/@redis/client/dist/package.json       │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/redis/node_modules/@redis/client/package.json            │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/redis/node_modules/@redis/graph/package.json             │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/redis/node_modules/@redis/json/package.json              │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/redis/node_modules/@redis/search/package.json            │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/redis/node_modules/@redis/time-series/package.json       │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/redis/package.json                                       │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/scheduler/package.json                                   │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/semver/package.json                                      │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/sharp/package.json                                       │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/styled-jsx/package.json                                  │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/typescript/package.json                                  │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/node_modules/yallist/package.json                                     │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ app/package.json                                                          │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ opt/yarn-v1.22.22/package.json                                            │ node-pkg │        0        │    -    │
├───────────────────────────────────────────────────────────────────────────┼──────────┼─────────────────┼─────────┤
│ usr/local/lib/node_modules/corepack/package.json                          │ node-pkg │        0        │    -    │
└───────────────────────────────────────────────────────────────────────────┴──────────┴─────────────────┴─────────┘
Legend:
- '-': Not scanned
- '0': Clean (no security findings detected)


command=sh -c '/app/text-to-cypher 2>&1 | while IFS= read -r line; do echo "[$(date "+%%Y-%%m-%%d %%H:%%M:%%S")] [TEXT-TO-CYPHER] $line"; done'
directory=/app
autostart=%(ENV_CYPHER)s
command=sh -c './text-to-cypher 2>&1 | awk '\''{cmd="date -u +\"%%Y-%%m-%%dT%%H:%%M:%%SZ\""; cmd | getline ts; close(cmd); print ts, $0; fflush()}'\'''
Copy link

Choose a reason for hiding this comment

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

performance: Inefficient logging command forks a process per log line. Use gawk's built-in strftime to avoid high CPU usage.

Suggested change
command=sh -c './text-to-cypher 2>&1 | awk '\''{cmd="date -u +\"%%Y-%%m-%%dT%%H:%%M:%%SZ\""; cmd | getline ts; close(cmd); print ts, $0; fflush()}'\'''
command=sh -c './text-to-cypher 2>&1 | gawk -W interactive '\''{print strftime("%%Y-%%m-%%dT%%H:%%M:%%SZ", systime(), 1), $0; fflush()}'\'\''

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants