Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker-compose FalkorDB, Backend, Frontend #367

Merged
merged 29 commits into from
Feb 5, 2025
Merged

Add docker-compose FalkorDB, Backend, Frontend #367

merged 29 commits into from
Feb 5, 2025

Conversation

gkorland
Copy link
Contributor

@gkorland gkorland commented Jan 24, 2025

User description

Fix #366 366


PR Type

Enhancement, Configuration changes


Description

  • Introduced a docker-compose.yml file for service orchestration.

  • Added configurations for falkordb, code-graph-frontend, and code-graph-backend.

  • Defined environment variables and dependencies between services.

  • Exposed necessary ports for all services.


Changes walkthrough 📝

Relevant files
Configuration changes
docker-compose.yml
Add docker-compose configuration for multi-service setup 

docker-compose.yml

  • Added a docker-compose.yml file for service orchestration.
  • Configured falkordb service with ports, volumes, and TTY settings.
  • Configured code-graph-frontend service with environment variables and
    dependencies.
  • Configured code-graph-backend service with environment variables and
    dependencies.
  • +36/-0   

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Summary by CodeRabbit

    • New Features
      • Introduced a Docker Compose configuration for deploying a multi-service application
      • Set up services for FalkorDB database, frontend, and backend
      • Configured service dependencies and environment variables
      • Exposed necessary ports for inter-service communication

    Copy link

    vercel bot commented Jan 24, 2025

    The latest updates on your projects. Learn more about Vercel for Git ↗︎

    Name Status Preview Comments Updated (UTC)
    code-graph ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 3, 2025 1:13pm

    Copy link
    Contributor

    coderabbitai bot commented Jan 24, 2025

    Important

    Review skipped

    Auto reviews are disabled on base/target branches other than the default branch.

    Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

    You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

    Walkthrough

    A new docker-compose.yml file has been introduced to define a multi-service application architecture. The configuration sets up three services: falkordb (a database service), code-graph-frontend, and code-graph-backend. Each service is configured with specific Docker image sources, port mappings, dependencies, and environment variables to facilitate seamless inter-service communication and deployment.

    Changes

    File Change Summary
    docker-compose.yml Added configuration for three services: falkordb, code-graph-frontend, and code-graph-backend with image specifications, port exposures, dependencies, and environment variable settings

    Sequence Diagram

    sequenceDiagram
        participant Frontend as code-graph-frontend
        participant Backend as code-graph-backend
        participant Database as falkordb
        
        Frontend->>Backend: Depends on
        Backend->>Database: Depends on
        
        Frontend->>Backend: Request with secret token
        Backend->>Database: Query data
        Database-->>Backend: Return data
        Backend-->>Frontend: Respond with data
    
    Loading

    Possibly related PRs

    Suggested reviewers

    • dudizimber

    Poem

    🐰 Docker's dance, services entwine,
    Compose a symphony, line by line,
    Frontend, backend, database so bright,
    Containers leaping with pure delight!
    A rabbit's orchestration, code's design 🚀


    Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

    ❤️ Share
    🪧 Tips

    Chat

    There are 3 ways to chat with CodeRabbit:

    • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
      • I pushed a fix in commit <commit_id>, please review it.
      • Generate unit testing code for this file.
      • Open a follow-up GitHub issue for this discussion.
    • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
      • @coderabbitai generate unit testing code for this file.
      • @coderabbitai modularize this function.
    • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
      • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
      • @coderabbitai read src/utils.ts and generate unit testing code.
      • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
      • @coderabbitai help me debug CodeRabbit configuration file.

    Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

    CodeRabbit Commands (Invoked using PR comments)

    • @coderabbitai pause to pause the reviews on a PR.
    • @coderabbitai resume to resume the paused reviews.
    • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
    • @coderabbitai full review to do a full review from scratch and review all the files again.
    • @coderabbitai summary to regenerate the summary of the PR.
    • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
    • @coderabbitai resolve resolve all the CodeRabbit review comments.
    • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
    • @coderabbitai help to get help.

    Other keywords and placeholders

    • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
    • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
    • Add @coderabbitai anywhere in the PR title to generate the title automatically.

    CodeRabbit Configuration File (.coderabbit.yaml)

    • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
    • Please see the configuration documentation for more information.
    • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

    Documentation and Community

    • Visit our Documentation for detailed information on how to use CodeRabbit.
    • Join our Discord Community to get help, request features, and share feedback.
    • Follow us on X/Twitter for updates and announcements.

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    🎫 Ticket compliance analysis ✅

    366 - Fully compliant

    Compliant requirements:

    • Add docker-compose.yml file
    • Configure FalkorDB service
    • Configure code-graph frontend service
    • Configure code-graph backend service
    • Set up proper service dependencies
    • Configure environment variables
    • Expose necessary ports
    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 Security concerns

    Sensitive information exposure:
    The docker-compose file contains hardcoded sensitive values that should not be in version control:

    1. SECRET_TOKEN='Vespa' is hardcoded for both frontend and backend
    2. OPENAI_API_KEY placeholder is exposed in the configuration
      These should be moved to a separate .env file or provided through secure environment variables.
    ⚡ Recommended focus areas for review

    Hardcoded Secret

    The SECRET_TOKEN is hardcoded with value 'Vespa' for both frontend and backend services. This should be configurable via environment variables.

    - SECRET_TOKEN=Vespa
    Missing Restart Policy

    No restart policy defined for services. Consider adding restart policies to handle container failures and system reboots.

    falkordb:
      image: falkordb/falkordb:latest
      ports:
        - "6379:6379"
        - "3001:3000"
      volumes:
        - ./:/data/
      stdin_open: true # Keep the container's STDIN open
      tty: true        # Allocate a pseudo-TTY
    
    code-graph-frontend:
      image: falkordb/code-graph-frontend:latest
      ports:
        - "3000:3000"
      depends_on:
        - code-graph-backend
      environment:
        - BACKEND_URL=http://code-graph-backend:5000 # Backend service URL
        - SECRET_TOKEN=Vespa
    
    code-graph-backend:
      image: falkordb/code-graph-backend:latest
      ports:
        - "4000:5000"
      depends_on:
        - falkordb
      environment:
        - FALKORDB_HOST=falkordb
        - FALKORDB_PORT=6379
        - OPENAI_API_KEY=YOUR_OPENAI_API_KEY
        - SECRET_TOKEN=Vespa
        - FLASK_RUN_HOST=0.0.0.0
        - FLASK_RUN_PORT=5000

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Security
    Secure sensitive environment variables

    Replace the hardcoded SECRET_TOKEN with a secure environment variable to prevent
    potential security breaches. This token should not be exposed in version control.

    docker-compose.yml [21-22]

     environment:
    -  - SECRET_TOKEN=Vespa
    +  - SECRET_TOKEN=${SECRET_TOKEN}
    • Apply this suggestion
    Suggestion importance[1-10]: 9

    Why: Hardcoding sensitive tokens in version control is a significant security risk. Using environment variables is a crucial security best practice.

    9
    Possible issue
    Implement container health monitoring

    Add healthcheck configurations for services to ensure proper container health
    monitoring and dependency management.

    docker-compose.yml [28-29]

     depends_on:
    -  - falkordb
    +  falkordb:
    +    condition: service_healthy
    +healthcheck:
    +  test: ["CMD", "redis-cli", "ping"]
    +  interval: 10s
    +  timeout: 5s
    +  retries: 3
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: Adding healthchecks ensures proper service orchestration and dependency management, preventing issues with services starting before dependencies are truly ready.

    8
    General
    Add service recovery mechanisms

    Add restart policies to services to ensure automatic recovery from failures and
    maintain system reliability.

    docker-compose.yml [4-6]

     services:
       falkordb:
         image: falkordb/falkordb:latest
    +    restart: unless-stopped
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Adding restart policies is important for production reliability, ensuring services recover automatically from failures. This applies to all services in the compose file.

    7

    Copy link
    Contributor

    qodo-merge-pro bot commented Jan 24, 2025

    CI Feedback 🧐

    (Feedback updated until commit 0fefd04)

    A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

    Action: test

    Failed stage: Set up environment variables and run tests [❌]

    Failed test name: chat.spec.ts:46:7 › Chat tests › Verify auto-scroll and manual scroll in chat

    Failure summary:

    The test failed due to multiple issues:

  • Primary failure: The test "Verify auto-scroll and manual scroll in chat" failed in Firefox browser
    due to a timeout error after 5000ms while waiting for an element to be enabled
  • Additional flaky tests:
    - "Validate consistent UI responses for repeated questions in chat" in
    Chromium timed out after 30000ms
    - "Validate node hide functionality via element menu in canvas"
    in Firefox failed due to tooltip visibility issues
    - "Validate view node panel keys via api" in
    Firefox failed due to tooltip visibility issues
  • Overall: 1 test failed, 3 tests were flaky, 2 tests were skipped, and 188 tests passed in 14.5
    minutes

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    1663:  ·  ✓  23 [chromium] › canvas.spec.ts:209:9 › Canvas tests › Validate node path connection in canvas ui and confirm via api for path import_data and add_edge (13.8s)
    1664:  ·  ✓  22 [chromium] › canvas.spec.ts:106:9 › Canvas tests › Verify "Clear graph" button resets canvas view for path test_kg_delete and list_graphs (16.3s)
    1665:  ·  ✓  25 [chromium] › canvas.spec.ts:128:9 › Canvas tests › Verify selecting different graphs displays nodes in canvas - Iteration 1 (6.2s)
    1666:  ·  ✓  26 [chromium] › chat.spec.ts:21:7 › Chat tests › Validate clicking the lightbulb button displays the correct options at the end of the chat (3.5s)
    1667:  ·  ✓  24 [chromium] › canvas.spec.ts:209:9 › Canvas tests › Validate node path connection in canvas ui and confirm via api for path test_kg_delete and list_graphs (13.7s)
    1668:  ⚠ The requested resource "/dots.gif" is an animated image so it will not be optimized. Consider adding the "unoptimized" property to the <Image>.
    1669:  ·  ✓  27 [chromium] › chat.spec.ts:29:7 › Chat tests › Validate that multiple consecutive questions receive individual answers (12.4s)
    1670:  ·  ✓  28 [chromium] › chat.spec.ts:103:9 › Chat tests › Verify unsuccessful node path connection between two nodes in chat for test_kg_delete and list_graphs (11.5s)
    1671:  ·  ✓  30 [chromium] › chat.spec.ts:114:7 › Chat tests › Validate error notification and its closure when sending an empty question in chat (4.2s)
    ...
    
    1939:  ·  ✓  121 [firefox] › canvas.spec.ts:209:9 › Canvas tests › Validate node path connection in canvas ui and confirm via api for path import_data and add_edge (14.2s)
    1940:  ·  ✓  122 [firefox] › canvas.spec.ts:106:9 › Canvas tests › Verify "Clear graph" button resets canvas view for path import_data and add_edge (16.3s)
    1941:  ·  ✓  123 [firefox] › canvas.spec.ts:209:9 › Canvas tests › Validate node path connection in canvas ui and confirm via api for path test_kg_delete and list_graphs (13.8s)
    1942:  ·  ✓  125 [firefox] › chat.spec.ts:21:7 › Chat tests › Validate clicking the lightbulb button displays the correct options at the end of the chat (3.4s)
    1943:  ·  ✓  124 [firefox] › canvas.spec.ts:106:9 › Canvas tests › Verify "Clear graph" button resets canvas view for path test_kg_delete and list_graphs (16.3s)
    1944:  ·  ✓  127 [firefox] › canvas.spec.ts:128:9 › Canvas tests › Verify selecting different graphs displays nodes in canvas - Iteration 1 (6.2s)
    1945:  ·  ✓  126 [firefox] › chat.spec.ts:29:7 › Chat tests › Validate that multiple consecutive questions receive individual answers (12.3s)
    1946:  ·  ✓  128 [firefox] › chat.spec.ts:103:9 › Chat tests › Verify unsuccessful node path connection between two nodes in chat for test_kg_delete and list_graphs (11.4s)
    1947:  ·  ✓  130 [firefox] › chat.spec.ts:114:7 › Chat tests › Validate error notification and its closure when sending an empty question in chat (4.2s)
    1948:  ×  ✘  129 [firefox] › chat.spec.ts:46:7 › Chat tests › Verify auto-scroll and manual scroll in chat (14.3s)
    1949:  Error: An error occurred with your deployment
    1950:  FUNCTION_INVOCATION_TIMEOUT
    1951:  sfo1::nd7xh-1738580554349-4ac298bc124a
    1952:  at u (.next/server/app/api/chat/[graph]/route.js:1:1160)
    1953:  ×  ✘  132 [firefox] › chat.spec.ts:46:7 › Chat tests › Verify auto-scroll and manual scroll in chat (retry #1) (11.8s)
    1954:  ·  ✓  131 [firefox] › chat.spec.ts:125:9 › Chat tests › Validate displaying question 0 in chat after selection from options menu (16.3s)
    1955:  Error: An error occurred with your deployment
    ...
    
    2132:  ·  ✓  194 [firefox] › searchBar.spec.ts:57:9 › search bar tests › Verify entering special characters behavior in search bar for: ? (4.1s)
    2133:  ·  ✓  195 [firefox] › searchBar.spec.ts:57:9 › search bar tests › Verify entering special characters behavior in search bar for: \ (4.1s)
    2134:  ·  ✓  196 [firefox] › searchBar.spec.ts:57:9 › search bar tests › Verify entering special characters behavior in search bar for: ` (4.1s)
    2135:  ·  ✓  197 [firefox] › searchBar.spec.ts:57:9 › search bar tests › Verify entering special characters behavior in search bar for: & (4.1s)
    2136:  ·  ✓  198 [firefox] › searchBar.spec.ts:57:9 › search bar tests › Verify entering special characters behavior in search bar for: # (4.1s)
    2137:  ·  ✓  199 [firefox] › searchBar.spec.ts:67:9 › search bar tests › search bar auto complete via ui and validating via api for: test (4.8s)
    2138:  ·  ✓  200 [firefox] › searchBar.spec.ts:67:9 › search bar tests › search bar auto complete via ui and validating via api for: set (4.9s)
    2139:  1) [firefox] › chat.spec.ts:46:7 › Chat tests › Verify auto-scroll and manual scroll in chat ─────
    2140:  TimeoutError: page.waitForFunction: Timeout 5000ms exceeded.
    2141:  at ../logic/utils.ts:9
    2142:  7 |     if (!elementHandle) throw new Error("Element not found");
    ...
    
    2145:  |                          ^
    2146:  10 |         (el) => el && !(el as HTMLElement).hasAttribute("disabled"),
    2147:  11 |         elementHandle,
    2148:  12 |         { timeout }
    2149:  at waitToBeEnabled (/home/runner/work/code-graph/code-graph/e2e/logic/utils.ts:9:26)
    2150:  at CodeGraph.sendMessage (/home/runner/work/code-graph/code-graph/e2e/logic/POM/codeGraph.ts:293:9)
    2151:  at /home/runner/work/code-graph/code-graph/e2e/tests/chat.spec.ts:50:7
    2152:  attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    2153:  playwright-report/artifacts/chat-Chat-tests-Verify-auto-scroll-and-manual-scroll-in-chat-firefox/test-failed-1.png
    2154:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2155:  Retry #1 ───────────────────────────────────────────────────────────────────────────────────────
    2156:  TimeoutError: page.waitForFunction: Timeout 5000ms exceeded.
    2157:  at ../logic/utils.ts:9
    2158:  7 |     if (!elementHandle) throw new Error("Element not found");
    ...
    
    2161:  |                          ^
    2162:  10 |         (el) => el && !(el as HTMLElement).hasAttribute("disabled"),
    2163:  11 |         elementHandle,
    2164:  12 |         { timeout }
    2165:  at waitToBeEnabled (/home/runner/work/code-graph/code-graph/e2e/logic/utils.ts:9:26)
    2166:  at CodeGraph.sendMessage (/home/runner/work/code-graph/code-graph/e2e/logic/POM/codeGraph.ts:293:9)
    2167:  at /home/runner/work/code-graph/code-graph/e2e/tests/chat.spec.ts:50:7
    2168:  attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    2169:  playwright-report/artifacts/chat-Chat-tests-Verify-auto-scroll-and-manual-scroll-in-chat-firefox-retry1/test-failed-1.png
    2170:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2171:  attachment #2: trace (application/zip) ─────────────────────────────────────────────────────────
    2172:  playwright-report/artifacts/chat-Chat-tests-Verify-auto-scroll-and-manual-scroll-in-chat-firefox-retry1/trace.zip
    2173:  Usage:
    2174:  npx playwright show-trace playwright-report/artifacts/chat-Chat-tests-Verify-auto-scroll-and-manual-scroll-in-chat-firefox-retry1/trace.zip
    2175:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2176:  Retry #2 ───────────────────────────────────────────────────────────────────────────────────────
    2177:  TimeoutError: page.waitForFunction: Timeout 5000ms exceeded.
    2178:  at ../logic/utils.ts:9
    2179:  7 |     if (!elementHandle) throw new Error("Element not found");
    ...
    
    2182:  |                          ^
    2183:  10 |         (el) => el && !(el as HTMLElement).hasAttribute("disabled"),
    2184:  11 |         elementHandle,
    2185:  12 |         { timeout }
    2186:  at waitToBeEnabled (/home/runner/work/code-graph/code-graph/e2e/logic/utils.ts:9:26)
    2187:  at CodeGraph.sendMessage (/home/runner/work/code-graph/code-graph/e2e/logic/POM/codeGraph.ts:293:9)
    2188:  at /home/runner/work/code-graph/code-graph/e2e/tests/chat.spec.ts:50:7
    2189:  attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    2190:  playwright-report/artifacts/chat-Chat-tests-Verify-auto-scroll-and-manual-scroll-in-chat-firefox-retry2/test-failed-1.png
    2191:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2192:  2) [chromium] › chat.spec.ts:62:7 › Chat tests › Validate consistent UI responses for repeated questions in chat 
    2193:  �[31mTest timeout of 30000ms exceeded.�[39m
    2194:  Error: locator.elementHandle: Target page, context or browser has been closed
    2195:  Call log:
    2196:  �[2m  - waiting for locator('//main[@data-name=\'main-chat\']/*[last()]/span')�[22m
    2197:  �[2m    - locator resolved to visible <span class="">58</span>�[22m
    2198:  at ../logic/utils.ts:17
    2199:  15 |
    2200:  16 | export const waitForStableText = async (locator: Locator, timeout: number = 5000): Promise<string> => {
    2201:  > 17 |     const elementHandle = await locator.elementHandle();
    2202:  |                                         ^
    2203:  18 |     if (!elementHandle) throw new Error("Element not found");
    2204:  19 |
    2205:  20 |     let previousText = "";
    2206:  at waitForStableText (/home/runner/work/code-graph/code-graph/e2e/logic/utils.ts:17:41)
    2207:  at CodeGraph.getTextInLastChatElement (/home/runner/work/code-graph/code-graph/e2e/logic/POM/codeGraph.ts:304:39)
    2208:  at /home/runner/work/code-graph/code-graph/e2e/tests/chat.spec.ts:68:22
    2209:  attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    2210:  playwright-report/artifacts/chat-Chat-tests-Validate-c-a5003--repeated-questions-in-chat-chromium/test-failed-1.png
    2211:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2212:  3) [firefox] › canvas.spec.ts:57:9 › Canvas tests › Validate node hide functionality via element menu in canvas for import_data 
    2213:  Error: Tooltip not visible after multiple attempts!
    2214:  at ../logic/POM/codeGraph.ts:482
    2215:  480 |         }
    2216:  481 |     
    2217:  > 482 |         throw new Error("Tooltip not visible after multiple attempts!");
    2218:  |               ^
    2219:  483 |     }
    2220:  484 |
    2221:  485 |     async nodeClicktest(x: number, y: number): Promise<void> {
    2222:  at CodeGraph.nodeClick (/home/runner/work/code-graph/code-graph/e2e/logic/POM/codeGraph.ts:482:15)
    2223:  at /home/runner/work/code-graph/code-graph/e2e/tests/canvas.spec.ts:66:7
    2224:  attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    2225:  playwright-report/artifacts/canvas-Canvas-tests-Valida-aef1d-u-in-canvas-for-import-data-firefox/test-failed-1.png
    2226:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2227:  Retry #1 ───────────────────────────────────────────────────────────────────────────────────────
    2228:  Error: Tooltip not visible after multiple attempts!
    2229:  at ../logic/POM/codeGraph.ts:482
    2230:  480 |         }
    2231:  481 |     
    2232:  > 482 |         throw new Error("Tooltip not visible after multiple attempts!");
    2233:  |               ^
    2234:  483 |     }
    2235:  484 |
    2236:  485 |     async nodeClicktest(x: number, y: number): Promise<void> {
    2237:  at CodeGraph.nodeClick (/home/runner/work/code-graph/code-graph/e2e/logic/POM/codeGraph.ts:482:15)
    2238:  at /home/runner/work/code-graph/code-graph/e2e/tests/canvas.spec.ts:66:7
    2239:  attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    2240:  playwright-report/artifacts/canvas-Canvas-tests-Valida-aef1d-u-in-canvas-for-import-data-firefox-retry1/test-failed-1.png
    2241:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2242:  attachment #2: trace (application/zip) ─────────────────────────────────────────────────────────
    2243:  playwright-report/artifacts/canvas-Canvas-tests-Valida-aef1d-u-in-canvas-for-import-data-firefox-retry1/trace.zip
    2244:  Usage:
    2245:  npx playwright show-trace playwright-report/artifacts/canvas-Canvas-tests-Valida-aef1d-u-in-canvas-for-import-data-firefox-retry1/trace.zip
    2246:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2247:  4) [firefox] › nodeDetailsPanel.spec.ts:91:9 › Node details panel tests › Validate view node panel keys via api for import_data 
    2248:  Error: Tooltip not visible after multiple attempts!
    2249:  at ../logic/POM/codeGraph.ts:482
    2250:  480 |         }
    2251:  481 |     
    2252:  > 482 |         throw new Error("Tooltip not visible after multiple attempts!");
    2253:  |               ^
    2254:  483 |     }
    2255:  484 |
    2256:  485 |     async nodeClicktest(x: number, y: number): Promise<void> {
    2257:  at CodeGraph.nodeClick (/home/runner/work/code-graph/code-graph/e2e/logic/POM/codeGraph.ts:482:15)
    2258:  at /home/runner/work/code-graph/code-graph/e2e/tests/nodeDetailsPanel.spec.ts:106:7
    2259:  attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    2260:  playwright-report/artifacts/nodeDetailsPanel-Node-deta-70c83-eys-via-api-for-import-data-firefox/test-failed-1.png
    2261:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2262:  1 failed
    2263:  [firefox] › chat.spec.ts:46:7 › Chat tests › Verify auto-scroll and manual scroll in chat ──────
    2264:  3 flaky
    2265:  [chromium] › chat.spec.ts:62:7 › Chat tests › Validate consistent UI responses for repeated questions in chat 
    2266:  [firefox] › canvas.spec.ts:57:9 › Canvas tests › Validate node hide functionality via element menu in canvas for import_data 
    2267:  [firefox] › nodeDetailsPanel.spec.ts:91:9 › Node details panel tests › Validate view node panel keys via api for import_data 
    2268:  2 skipped
    2269:  188 passed (14.5m)
    2270:  1) [firefox] › chat.spec.ts:46:7 › Chat tests › Verify auto-scroll and manual scroll in chat ─────
    2271:  TimeoutError: page.waitForFunction: Timeout 5000ms exceeded.
    2272:  at ../logic/utils.ts:9
    2273:  7 |     if (!elementHandle) throw new Error("Element not found");
    ...
    
    2276:  |                          ^
    2277:  10 |         (el) => el && !(el as HTMLElement).hasAttribute("disabled"),
    2278:  11 |         elementHandle,
    2279:  12 |         { timeout }
    2280:  at waitToBeEnabled (/home/runner/work/code-graph/code-graph/e2e/logic/utils.ts:9:26)
    2281:  at CodeGraph.sendMessage (/home/runner/work/code-graph/code-graph/e2e/logic/POM/codeGraph.ts:293:9)
    2282:  at /home/runner/work/code-graph/code-graph/e2e/tests/chat.spec.ts:50:7
    2283:  attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    2284:  playwright-report/artifacts/chat-Chat-tests-Verify-auto-scroll-and-manual-scroll-in-chat-firefox/test-failed-1.png
    2285:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2286:  Retry #1 ───────────────────────────────────────────────────────────────────────────────────────
    2287:  TimeoutError: page.waitForFunction: Timeout 5000ms exceeded.
    2288:  at ../logic/utils.ts:9
    2289:  7 |     if (!elementHandle) throw new Error("Element not found");
    ...
    
    2292:  |                          ^
    2293:  10 |         (el) => el && !(el as HTMLElement).hasAttribute("disabled"),
    2294:  11 |         elementHandle,
    2295:  12 |         { timeout }
    2296:  at waitToBeEnabled (/home/runner/work/code-graph/code-graph/e2e/logic/utils.ts:9:26)
    2297:  at CodeGraph.sendMessage (/home/runner/work/code-graph/code-graph/e2e/logic/POM/codeGraph.ts:293:9)
    2298:  at /home/runner/work/code-graph/code-graph/e2e/tests/chat.spec.ts:50:7
    2299:  attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    2300:  playwright-report/artifacts/chat-Chat-tests-Verify-auto-scroll-and-manual-scroll-in-chat-firefox-retry1/test-failed-1.png
    2301:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2302:  attachment #2: trace (application/zip) ─────────────────────────────────────────────────────────
    2303:  playwright-report/artifacts/chat-Chat-tests-Verify-auto-scroll-and-manual-scroll-in-chat-firefox-retry1/trace.zip
    2304:  Usage:
    2305:  npx playwright show-trace playwright-report/artifacts/chat-Chat-tests-Verify-auto-scroll-and-manual-scroll-in-chat-firefox-retry1/trace.zip
    2306:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2307:  Retry #2 ───────────────────────────────────────────────────────────────────────────────────────
    2308:  TimeoutError: page.waitForFunction: Timeout 5000ms exceeded.
    2309:  at ../logic/utils.ts:9
    2310:  7 |     if (!elementHandle) throw new Error("Element not found");
    ...
    
    2313:  |                          ^
    2314:  10 |         (el) => el && !(el as HTMLElement).hasAttribute("disabled"),
    2315:  11 |         elementHandle,
    2316:  12 |         { timeout }
    2317:  at waitToBeEnabled (/home/runner/work/code-graph/code-graph/e2e/logic/utils.ts:9:26)
    2318:  at CodeGraph.sendMessage (/home/runner/work/code-graph/code-graph/e2e/logic/POM/codeGraph.ts:293:9)
    2319:  at /home/runner/work/code-graph/code-graph/e2e/tests/chat.spec.ts:50:7
    2320:  attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    2321:  playwright-report/artifacts/chat-Chat-tests-Verify-auto-scroll-and-manual-scroll-in-chat-firefox-retry2/test-failed-1.png
    2322:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2323:  2) [chromium] › chat.spec.ts:62:7 › Chat tests › Validate consistent UI responses for repeated questions in chat 
    2324:  �[31mTest timeout of 30000ms exceeded.�[39m
    2325:  Error: locator.elementHandle: Target page, context or browser has been closed
    2326:  Call log:
    2327:  �[2m  - waiting for locator('//main[@data-name=\'main-chat\']/*[last()]/span')�[22m
    2328:  �[2m    - locator resolved to visible <span class="">58</span>�[22m
    2329:  at ../logic/utils.ts:17
    2330:  15 |
    2331:  16 | export const waitForStableText = async (locator: Locator, timeout: number = 5000): Promise<string> => {
    2332:  > 17 |     const elementHandle = await locator.elementHandle();
    2333:  |                                         ^
    2334:  18 |     if (!elementHandle) throw new Error("Element not found");
    2335:  19 |
    2336:  20 |     let previousText = "";
    2337:  at waitForStableText (/home/runner/work/code-graph/code-graph/e2e/logic/utils.ts:17:41)
    2338:  at CodeGraph.getTextInLastChatElement (/home/runner/work/code-graph/code-graph/e2e/logic/POM/codeGraph.ts:304:39)
    2339:  at /home/runner/work/code-graph/code-graph/e2e/tests/chat.spec.ts:68:22
    2340:  attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    2341:  playwright-report/artifacts/chat-Chat-tests-Validate-c-a5003--repeated-questions-in-chat-chromium/test-failed-1.png
    2342:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2343:  3) [firefox] › canvas.spec.ts:57:9 › Canvas tests › Validate node hide functionality via element menu in canvas for import_data 
    2344:  Error: Tooltip not visible after multiple attempts!
    2345:  at ../logic/POM/codeGraph.ts:482
    2346:  480 |         }
    2347:  481 |     
    2348:  > 482 |         throw new Error("Tooltip not visible after multiple attempts!");
    2349:  |               ^
    2350:  483 |     }
    2351:  484 |
    2352:  485 |     async nodeClicktest(x: number, y: number): Promise<void> {
    2353:  at CodeGraph.nodeClick (/home/runner/work/code-graph/code-graph/e2e/logic/POM/codeGraph.ts:482:15)
    2354:  at /home/runner/work/code-graph/code-graph/e2e/tests/canvas.spec.ts:66:7
    2355:  attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    2356:  playwright-report/artifacts/canvas-Canvas-tests-Valida-aef1d-u-in-canvas-for-import-data-firefox/test-failed-1.png
    2357:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2358:  Retry #1 ───────────────────────────────────────────────────────────────────────────────────────
    2359:  Error: Tooltip not visible after multiple attempts!
    2360:  at ../logic/POM/codeGraph.ts:482
    2361:  480 |         }
    2362:  481 |     
    2363:  > 482 |         throw new Error("Tooltip not visible after multiple attempts!");
    2364:  |               ^
    2365:  483 |     }
    2366:  484 |
    2367:  485 |     async nodeClicktest(x: number, y: number): Promise<void> {
    2368:  at CodeGraph.nodeClick (/home/runner/work/code-graph/code-graph/e2e/logic/POM/codeGraph.ts:482:15)
    2369:  at /home/runner/work/code-graph/code-graph/e2e/tests/canvas.spec.ts:66:7
    2370:  attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    2371:  playwright-report/artifacts/canvas-Canvas-tests-Valida-aef1d-u-in-canvas-for-import-data-firefox-retry1/test-failed-1.png
    2372:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2373:  attachment #2: trace (application/zip) ─────────────────────────────────────────────────────────
    2374:  playwright-report/artifacts/canvas-Canvas-tests-Valida-aef1d-u-in-canvas-for-import-data-firefox-retry1/trace.zip
    2375:  Usage:
    2376:  npx playwright show-trace playwright-report/artifacts/canvas-Canvas-tests-Valida-aef1d-u-in-canvas-for-import-data-firefox-retry1/trace.zip
    2377:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2378:  4) [firefox] › nodeDetailsPanel.spec.ts:91:9 › Node details panel tests › Validate view node panel keys via api for import_data 
    2379:  Error: Tooltip not visible after multiple attempts!
    2380:  at ../logic/POM/codeGraph.ts:482
    2381:  480 |         }
    2382:  481 |     
    2383:  > 482 |         throw new Error("Tooltip not visible after multiple attempts!");
    2384:  |               ^
    2385:  483 |     }
    2386:  484 |
    2387:  485 |     async nodeClicktest(x: number, y: number): Promise<void> {
    2388:  at CodeGraph.nodeClick (/home/runner/work/code-graph/code-graph/e2e/logic/POM/codeGraph.ts:482:15)
    2389:  at /home/runner/work/code-graph/code-graph/e2e/tests/nodeDetailsPanel.spec.ts:106:7
    2390:  attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    2391:  playwright-report/artifacts/nodeDetailsPanel-Node-deta-70c83-eys-via-api-for-import-data-firefox/test-failed-1.png
    2392:  ────────────────────────────────────────────────────────────────────────────────────────────────
    2393:  1 failed
    2394:  [firefox] › chat.spec.ts:46:7 › Chat tests › Verify auto-scroll and manual scroll in chat ──────
    2395:  3 flaky
    2396:  [chromium] › chat.spec.ts:62:7 › Chat tests › Validate consistent UI responses for repeated questions in chat 
    2397:  [firefox] › canvas.spec.ts:57:9 › Canvas tests › Validate node hide functionality via element menu in canvas for import_data 
    2398:  [firefox] › nodeDetailsPanel.spec.ts:91:9 › Node details panel tests › Validate view node panel keys via api for import_data 
    2399:  2 skipped
    2400:  188 passed (14.5m)
    2401:  ##[error]Process completed with exit code 1.
    ...
    
    2418:  Finished uploading artifact content to blob storage!
    2419:  SHA256 hash of uploaded artifact zip is 1b605c739bf80d6c0312ed285c3e87bfd04d7e2fc8a1a593f576a503dba325e9
    2420:  Finalizing artifact upload
    2421:  Artifact playwright-report.zip successfully finalized. Artifact ID 2526303011
    2422:  Artifact playwright-report has been successfully uploaded! Final size is 11846072 bytes. Artifact ID is 2526303011
    2423:  Artifact download URL: https://github.com/FalkorDB/code-graph/actions/runs/13101554230/artifacts/2526303011
    2424:  ##[group]Run actions/upload-artifact@v4
    2425:  with:
    2426:  name: failed-test-screenshots
    ...
    
    2435:  Artifact name is valid!
    2436:  Root directory input is valid!
    2437:  Beginning upload of artifact content to blob storage
    2438:  Uploaded bytes 8388608
    2439:  Uploaded bytes 11845852
    2440:  Finished uploading artifact content to blob storage!
    2441:  SHA256 hash of uploaded artifact zip is 1eb85dfab6ed30c64a61a233118e7632c1ddb7eea5e888324a26f5f0b3fe3d07
    2442:  Finalizing artifact upload
    2443:  Artifact failed-test-screenshots.zip successfully finalized. Artifact ID 2526303226
    2444:  Artifact failed-test-screenshots has been successfully uploaded! Final size is 11845852 bytes. Artifact ID is 2526303226
    ...
    
    2452:  [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
    2453:  [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
    2454:  [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
    2455:  http.https://github.com/.extraheader
    2456:  [command]/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
    2457:  [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
    2458:  Print service container logs: 358f119f94624560b26865c1a8f2c639_falkordbfalkordblatest_6b9319
    2459:  ##[command]/usr/bin/docker logs --details e6e32ee49e2222d686419879bb77a9972dbe07f1121871924830f57b06ed6b49
    2460:  11:C 03 Feb 2025 10:51:00.796 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
    

    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: 3

    🧹 Nitpick comments (1)
    docker-compose.yml (1)

    1-36: Consider adding production-ready configurations.

    For a more robust production setup, consider adding:

    1. Explicit network definitions for better isolation
    2. Resource limits to prevent container resource exhaustion
    3. Restart policies for improved reliability

    Add these configurations to your compose file:

    version: "3.9"
    
    +networks:
    +  frontend:
    +  backend:
    +  database:
    
    services:
       falkordb:
    +    networks:
    +      - database
    +    deploy:
    +      resources:
    +        limits:
    +          cpus: '1'
    +          memory: 1G
    +    restart: unless-stopped
    
       code-graph-frontend:
    +    networks:
    +      - frontend
    +      - backend
    +    deploy:
    +      resources:
    +        limits:
    +          cpus: '0.5'
    +          memory: 512M
    +    restart: unless-stopped
    
       code-graph-backend:
    +    networks:
    +      - backend
    +      - database
    +    deploy:
    +      resources:
    +        limits:
    +          cpus: '0.5'
    +          memory: 512M
    +    restart: unless-stopped
    📜 Review details

    Configuration used: CodeRabbit UI
    Review profile: CHILL
    Plan: Pro

    📥 Commits

    Reviewing files that changed from the base of the PR and between a4b6e33 and b542f2d.

    📒 Files selected for processing (1)
    • docker-compose.yml (1 hunks)
    ⏰ Context from checks skipped due to timeout of 90000ms (1)
    • GitHub Check: test
    🔇 Additional comments (1)
    docker-compose.yml (1)

    1-3: LGTM! Docker Compose version and structure are appropriate.

    The use of version 3.9 provides good compatibility while maintaining access to modern features.

    Comment on lines +14 to +23
    code-graph-frontend:
    image: falkordb/code-graph-frontend:latest
    ports:
    - "3000:3000"
    depends_on:
    - code-graph-backend
    environment:
    - BACKEND_URL=http://code-graph-backend:5000 # Backend service URL
    - SECRET_TOKEN=Vespa

    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    ⚠️ Potential issue

    Security concerns in the Frontend service configuration.

    1. Using latest tag is not recommended for production.
    2. The SECRET_TOKEN should not be hardcoded in the compose file.
    3. The backend communication should use HTTPS in production.

    Consider applying these changes:

      code-graph-frontend:
    -    image: falkordb/code-graph-frontend:latest
    +    image: falkordb/code-graph-frontend:1.0.0  # Replace with specific version
        ports:
          - "3000:3000"
        depends_on:
          - code-graph-backend
        environment:
    -      - BACKEND_URL=http://code-graph-backend:5000
    +      - BACKEND_URL=${BACKEND_URL:-https://code-graph-backend:5000}
    -      - SECRET_TOKEN=Vespa
    +      - SECRET_TOKEN=${SECRET_TOKEN}  # Set via .env file or environment

    Create a .env.example file to document required environment variables:

    BACKEND_URL=https://code-graph-backend:5000
    SECRET_TOKEN=your-secure-token-here

    Comment on lines +24 to +36
    code-graph-backend:
    image: falkordb/code-graph-backend:latest
    ports:
    - "4000:5000"
    depends_on:
    - falkordb
    environment:
    - FALKORDB_HOST=falkordb
    - FALKORDB_PORT=6379
    - OPENAI_API_KEY=YOUR_OPENAI_API_KEY
    - SECRET_TOKEN=Vespa
    - FLASK_RUN_HOST=0.0.0.0
    - FLASK_RUN_PORT=5000
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    ⚠️ Potential issue

    Critical security and reliability concerns in the Backend service configuration.

    1. Using latest tag is not recommended for production.
    2. Sensitive credentials (OpenAI API key, SECRET_TOKEN) should not be in the compose file.
    3. No health check is defined for the service.

    Consider applying these changes:

      code-graph-backend:
    -    image: falkordb/code-graph-backend:latest
    +    image: falkordb/code-graph-backend:1.0.0  # Replace with specific version
        ports:
          - "4000:5000"
        depends_on:
          - falkordb
    +    healthcheck:
    +      test: ["CMD", "curl", "-f", "http://localhost:5000/health"]
    +      interval: 30s
    +      timeout: 10s
    +      retries: 3
        environment:
          - FALKORDB_HOST=falkordb
          - FALKORDB_PORT=6379
    -      - OPENAI_API_KEY=YOUR_OPENAI_API_KEY
    +      - OPENAI_API_KEY=${OPENAI_API_KEY}
    -      - SECRET_TOKEN=Vespa
    +      - SECRET_TOKEN=${SECRET_TOKEN}
          - FLASK_RUN_HOST=0.0.0.0
          - FLASK_RUN_PORT=5000

    Add these variables to your .env.example file:

    OPENAI_API_KEY=your-openai-api-key

    Comment on lines +4 to +12
    falkordb:
    image: falkordb/falkordb:latest
    ports:
    - "6379:6379"
    - "3001:3000"
    volumes:
    - ./:/data/
    stdin_open: true # Keep the container's STDIN open
    tty: true # Allocate a pseudo-TTY
    Copy link
    Contributor

    Choose a reason for hiding this comment

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

    ⚠️ Potential issue

    Several critical issues in the FalkorDB service configuration need attention.

    1. Using the latest tag is not recommended for production as it can lead to unexpected changes during deployments.
    2. The volume mount ./:/data/ exposes the entire current directory, which could include sensitive files.
    3. Port mapping 3001:3000 might conflict with the frontend's port 3000.

    Consider applying these changes:

      falkordb:
    -    image: falkordb/falkordb:latest
    +    image: falkordb/falkordb:1.0.0  # Replace with specific version
        ports:
          - "6379:6379"
    -      - "3001:3000"
    +      - "3001:3001"  # Use consistent port numbers
        volumes:
    -      - ./:/data/
    +      - falkordb_data:/data  # Use named volume
        stdin_open: true
        tty: true
    
    volumes:
      falkordb_data:  # Define named volume

    Committable suggestion skipped: line range outside the PR's diff.

    @gkorland gkorland changed the base branch from main to staging January 29, 2025 10:41
    @barakb barakb merged commit 1d3cd5c into staging Feb 5, 2025
    7 checks passed
    @barakb barakb deleted the compose branch February 5, 2025 14:03
    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.

    Add docker-compose
    5 participants