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

Splitting to two services #14

Merged
merged 19 commits into from
Jun 8, 2024
Merged

Splitting to two services #14

merged 19 commits into from
Jun 8, 2024

Conversation

madflojo
Copy link
Member

@madflojo madflojo commented Jun 1, 2024

This pull request splits the current monolith into two primary services. This optimizes for faster API calls as the overhead of downloading files can be split.

Summary by CodeRabbit

  • New Features

    • Added Redis support to Docker Compose configurations.
    • Introduced various load testing targets: run-stress, run-soak, and run-steady.
    • Added new Grafana dashboard configurations for enhanced visualization.
    • Introduced Docker Compose configurations for load testing and monolithic setups.
    • Added new K6 test scripts and configurations for load, soak, steady, and stress testing.
  • Documentation

    • Updated README to reflect the structure and deployment models of the "Airport Lookup" project.
  • Chores

    • Updated Prometheus configuration to monitor new services.
    • Added health checks and dependencies for Docker Compose services.
    • Introduced new configuration files for tarmac-data-manager, tarmac-lookup, and tarmac-monolith.

Copy link
Contributor

coderabbitai bot commented Jun 1, 2024

Warning

Review failed

The pull request is closed.

Walkthrough

The recent update enhances the "Airport Lookup" project by refining Docker Compose configurations, adding load testing capabilities, and improving observability through Grafana and Prometheus. Key changes include the addition of Redis, new load testing targets, and updated Grafana dashboards. These improvements aim to bolster the project's deployment flexibility, performance testing, and monitoring capabilities.

Changes

Files/Paths Change Summary
Makefile Added redis to Docker Compose commands, introduced load testing setup, and added targets for different load testing types.
README.md Updated summary and descriptions of deployment models, services, and health checks.
config/grafana/dashboards/default.json Adjusted visualization settings like fillOpacity, gradientMode, legendFormat, and layout modes for better Grafana dashboard appearance.
config/prometheus.yml Added new targets lookup:8080 and data-manager:8080, replacing example:8080.
config/tarmac-*.json Introduced new configuration files for tarmac-data-manager and tarmac-lookup, and updated task frequency in tarmac-monolith.
docker-compose.yml Renamed services, updated paths, added health checks, and included grafana as a dependency.
load-compose.yml Introduced Docker Compose configuration for load testing, defining services lookup, data-manager, and mysql with their settings.
monolith-compose.yml Introduced Docker Compose configuration for a monolithic setup, detailing services like lookup, mysql, redis, prometheus, and grafana.
tests/k6/script.js Added a new test script for sending POST requests and checking responses.
tests/k6/*.json Introduced configuration files for different load testing scenarios (soak, steady, stress) using K6, specifying stages, durations, and thresholds.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant LoadTest
    participant LookupService
    participant DataManager
    participant MySQL
    participant Redis

    User->>LoadTest: Initiate Load Test
    LoadTest->>LookupService: Send POST Request
    LookupService->>Redis: Check Cache
    alt Cache Miss
        LookupService->>DataManager: Fetch Data
        DataManager->>MySQL: Query Database
        MySQL-->>DataManager: Return Data
        DataManager-->>LookupService: Send Data
        LookupService->>Redis: Store in Cache
    end
    LookupService-->>LoadTest: Return Response
    LoadTest-->>User: Display Results
Loading

Poem

In the code where data flows,
With Docker Compose, the setup grows. 🚀
Redis joins the caching spree,
Load tests run with glee. 🐇
Grafana's dashboards shining bright,
Prometheus keeps the metrics tight. 📊
Together they dance, a symphony of code,
In Tarmac's realm, new paths are stowed. 🌟


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

codecov bot commented Jun 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.92%. Comparing base (1bae35c) to head (460ce2a).
Report is 6 commits behind head on main.

Current head 460ce2a differs from pull request most recent head 77e2bc7

Please upload reports for the commit 77e2bc7 to get more accurate results.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #14   +/-   ##
=======================================
  Coverage   92.92%   92.92%           
=======================================
  Files           2        2           
  Lines          99       99           
=======================================
  Hits           92       92           
  Misses          5        5           
  Partials        2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@madflojo madflojo marked this pull request as ready for review June 8, 2024 19:57
@madflojo madflojo changed the title Splitting to two services and adding k6 Splitting to two services Jun 8, 2024
@madflojo
Copy link
Member Author

madflojo commented Jun 8, 2024

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Jun 8, 2024

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Outside diff range and nitpick comments (1)
docker-compose.yml (1)

[!TIP]
Codebase Verification

The verification script indicates that the data-manager service configuration in the docker-compose.yml file is invalid. This suggests that one or more required fields are missing or incorrectly defined.

Please review the following points in the data-manager service configuration:

  • Ensure all required fields (container_name, image, ports, healthcheck, environment, volumes, depends_on) are present and correctly defined.

Category:

Analysis chain

Line range hint 33-58: Configuration for the data-manager service looks good. Ensure the new environment variables and dependencies are tested in a staging environment.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the data-manager service starts correctly with the new configuration.

# Test: Start the data-manager service and check for successful initialization.
docker-compose up data-manager

Length of output: 114



Script:

#!/bin/bash
# Verify the structure and syntax of the docker-compose.yml file
ast-grep --lang yaml --pattern $'services:\n  data-manager:\n    container_name: data-manager\n    image: madflojo/tarmac:unstable\n    ports:\n      - 8080:8080\n    healthcheck:\n      test: ["CMD", "curl", "-f", "http://localhost:8080/ready"]\n      interval: 10s\n      timeout: 5s\n      retries: 3\n    environment:\n      - "APP_ENABLE_TLS=false"\n      - "APP_LISTEN_ADDR=0.0.0.0:8080"\n      - "APP_DEBUG=false"\n      - "APP_TRACE=false"\n      - "APP_WASM_FUNCTION_CONFIG=/config/tarmac-data-manager.json"\n      - "APP_ENABLE_SQL=true"\n      - "APP_SQL_TYPE=mysql"\n      - "APP_SQL_DSN=root:example@tcp(mysql:3306)/example"\n      - "APP_ENABLE_KVSTORE=true"\n      - "APP_KVSTORE_TYPE=redis"\n      - "APP_REDIS_SERVER=redis:6379"\n    volumes:\n      - "./config:/config"\n      - "./functions/build:/functions"\n    depends_on:' docker-compose.yml

# Search for any potential issues or misconfigurations in the docker-compose.yml file
rg 'data-manager' docker-compose.yml

Length of output: 1102



Script:

#!/bin/bash
# Verify the structure and syntax of the docker-compose.yml file using yq
yq e '.services.data-manager' docker-compose.yml

Length of output: 118



Script:

#!/bin/bash
# Verify the structure and syntax of the docker-compose.yml file using grep and awk

# Extract the data-manager service configuration
grep -A 20 'data-manager:' docker-compose.yml | awk '
/^\s*container_name:/ {container_name=1}
/^\s*image:/ {image=1}
/^\s*ports:/ {ports=1}
/^\s*healthcheck:/ {healthcheck=1}
/^\s*environment:/ {environment=1}
/^\s*volumes:/ {volumes=1}
/^\s*depends_on:/ {depends_on=1}
END {
  if (container_name && image && ports && healthcheck && environment && volumes && depends_on) {
    print "data-manager service configuration is valid"
  } else {
    print "data-manager service configuration is invalid"
  }
}'

Length of output: 551

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1a82646 and 4b0becd.

Files selected for processing (14)
  • Makefile (1 hunks)
  • README.md (2 hunks)
  • config/grafana/dashboards/default.json (36 hunks)
  • config/prometheus.yml (1 hunks)
  • config/tarmac-data-manager.json (1 hunks)
  • config/tarmac-lookup.json (1 hunks)
  • config/tarmac-monolith.json (1 hunks)
  • docker-compose.yml (3 hunks)
  • load-compose.yml (1 hunks)
  • monolith-compose.yml (1 hunks)
  • tests/k6/script.js (1 hunks)
  • tests/k6/soak.json (1 hunks)
  • tests/k6/steady.json (1 hunks)
  • tests/k6/stress.json (1 hunks)
Files skipped from review due to trivial changes (7)
  • config/tarmac-data-manager.json
  • config/tarmac-lookup.json
  • config/tarmac-monolith.json
  • monolith-compose.yml
  • tests/k6/soak.json
  • tests/k6/steady.json
  • tests/k6/stress.json
Additional context used
Biome
tests/k6/script.js

[error] 7-7: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.

LanguageTool
README.md

[style] ~156-~156: The phrase ‘feel free to’ is used quite frequently. Consider using a less frequent alternative to set your writing apart from others and make it sound more professional. (FEEL_FREE_TO_STYLE_ME)
Context: ...suggestion, please open a pull request. Feel free to open an issue if you have a more comple...

Markdownlint
README.md

51-51: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


148-148: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


94-94: null (MD014, commands-show-output)
Dollar signs used before commands without showing output


31-31: null (MD040, fenced-code-language)
Fenced code blocks should have a language specified


58-58: null (MD040, fenced-code-language)
Fenced code blocks should have a language specified

Additional comments not posted (12)
config/prometheus.yml (1)

21-22: LGTM! Ensure that both lookup and data-manager services expose metrics at :8080/metrics.

tests/k6/script.js (2)

1-20: The test script looks good and should effectively validate the response status for the service.

Tools
Biome

[error] 7-7: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.


7-7: Consider simplifying the JSON key as suggested by the static analysis tool.

- "local_code": "PHX"
+ local_code: "PHX"

Likely invalid or redundant comment.

Tools
Biome

[error] 7-7: The computed expression can be simplified without the use of a string literal. (lint/complexity/useLiteralKeys)

Unsafe fix: Use a literal key instead.

load-compose.yml (1)

3-55: The Docker Compose configurations for lookup and data-manager are well-defined. Ensure that the health checks are effectively monitoring service health.

Makefile (1)

34-50: The new load testing targets in the Makefile are well-structured. Verify that they correctly orchestrate the load tests as expected.

docker-compose.yml (3)

66-73: The new health check configuration for the mysql service is appropriate.


80-87: The new health check configuration for the redis service is appropriate.


Line range hint 3-31: Configuration for the lookup service looks good. Ensure the new environment variables and dependencies are tested in a staging environment.

README.md (3)

2-26: The updated project overview and API description are clear and informative.


27-87: The descriptions for the monolith and microservices models are detailed and helpful.

Tools
Markdownlint

51-51: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces


31-31: null (MD040, fenced-code-language)
Fenced code blocks should have a language specified


58-58: null (MD040, fenced-code-language)
Fenced code blocks should have a language specified


106-136: The section on non-functional requirements is comprehensive and well-explained.

config/grafana/dashboards/default.json (1)

Line range hint 55-264: Visualization settings in the Grafana dashboard have been appropriately updated. Verify the dashboard's appearance in a staging environment to ensure the changes meet the desired aesthetics and functionality.

README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@madflojo madflojo merged commit 099eebe into tarmac-project:main Jun 8, 2024
6 checks passed
@madflojo madflojo deleted the split branch June 8, 2024 21:50
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.

1 participant