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

chore: use system rocksdb libs, if available #565

Merged
merged 7 commits into from
Oct 8, 2024
Merged

Conversation

tedil
Copy link
Contributor

@tedil tedil commented Oct 8, 2024

Summary by CodeRabbit

  • New Features

    • Introduced new environment variables for enhanced configuration: ROCKSDB_LIB_DIR and SNAPPY_LIB_DIR.
    • Updated Dockerfile to improve the build and runtime stages for the application "mehari."
    • Added a new section in the README for building from scratch, including installation instructions for the rocksdb library.
  • Bug Fixes

    • Improved compatibility by adding necessary environment variables for the target configuration.
    • Optimized the Docker image size through cleanup commands.
    • Corrected formatting in the "Supported Sequence Variant Frequency Databases" section of the README for consistency.

Copy link
Contributor

coderabbitai bot commented Oct 8, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes introduce a new section [env] in the .cargo/config.toml file specifically for the target thumbv7em-none-eabi. This section defines two environment variables, ROCKSDB_LIB_DIR and SNAPPY_LIB_DIR, both pointing to the directory path "/usr/lib/". Additionally, the Dockerfile has been modified to enhance the build and runtime stages for the application "mehari," including the addition of necessary dependencies and optimizations to the Docker image.

Changes

File Change Summary
.cargo/config.toml Added [env] section with ROCKSDB_LIB_DIR and SNAPPY_LIB_DIR, both set to "/usr/lib/".
Dockerfile Updated builder stage to install librocksdb-dev, set working directory, and copy necessary files; updated runtime stage with new base image ubuntu:noble, retained libsqlite3-0, added cleanup commands, and set entrypoint script.
README.md Added "Building from scratch" section with environment setup instructions; corrected formatting in "Supported Sequence Variant Frequency Databases"; updated internal notes for database preparation commands.

Poem

In the config, a new path we lay,
For rocks and snappy, hip-hip-hooray!
With paths set right, our builds will soar,
Hopping through code, we’ll explore more! 🐇✨


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

@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: 1

🧹 Outside diff range and nitpick comments (1)
.cargo/config.toml (1)

5-7: Environment variables added for system libraries.

The addition of ROCKSDB_LIB_DIR and SNAPPY_LIB_DIR environment variables aligns with the PR objective of using system-installed RocksDB libraries. This change allows the project to utilize system libraries instead of bundled versions, potentially improving flexibility and efficiency.

However, hardcoding the path to "/usr/lib/" might not be suitable for all systems or environments. Consider making this more flexible by:

  1. Using a relative path or a placeholder that can be overridden.
  2. Allowing these paths to be set via external environment variables.
  3. Implementing a fallback mechanism if the system libraries are not found in the specified location.

Would you like assistance in implementing a more flexible approach for specifying library paths?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between ae530e5 and 1620d0c.

📒 Files selected for processing (1)
  • .cargo/config.toml (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
.cargo/config.toml (1)

4-4: Improved readability with section separation.

The addition of an empty line after the [target.thumbv7em-none-eabi] section enhances the readability of the configuration file by clearly separating different sections.

.cargo/config.toml Show resolved Hide resolved
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

🧹 Outside diff range and nitpick comments (2)
utils/docker/Dockerfile (2)

26-27: Approve RocksDB installation with a minor suggestion.

The addition of librocksdb-dev aligns well with the PR objective to use system RocksDB libraries when available. This change enhances the flexibility of the build process.

Consider updating the comment to reflect that only RocksDB is being installed in this step:

-# Install rocksdb + snappy
+# Install rocksdb

Line range hint 53-77: Approve runtime stage improvements with a minor suggestion.

The changes in the runtime stage enhance the Docker setup by:

  1. Using a consistent base image (Debian-based) with the builder stage.
  2. Including cleanup commands to optimize the image size.
  3. Setting up an entrypoint script for improved container flexibility.
  4. Exposing port 8080 for the application.

These improvements contribute to a more efficient and maintainable Docker image.

For consistency with the builder stage, consider using COPY --chmod=+x instead of a separate RUN chmod command for the entrypoint script:

-COPY utils/docker/entrypoint.sh /
-RUN chmod a+rx /entrypoint.sh
+COPY --chmod=+x utils/docker/entrypoint.sh /

This change would make the Dockerfile more concise and consistent with modern Docker best practices.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1620d0c and 5b4719a.

📒 Files selected for processing (1)
  • utils/docker/Dockerfile (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
utils/docker/Dockerfile (2)

Line range hint 39-46: Approve working directory setup and file copying.

The changes in this segment are well-structured and follow best practices for Dockerfile organization. Setting up the working directory and copying necessary files are crucial steps in preparing the build environment.


Line range hint 1-77: Overall approval with positive feedback on Dockerfile improvements.

The changes in this Dockerfile successfully achieve the PR objective of using system RocksDB libraries while also introducing several improvements to the build and runtime processes:

  1. Installation of system RocksDB libraries in the builder stage.
  2. Refinement of the working directory setup and file copying process.
  3. Optimization of the runtime stage with cleanup commands and a more flexible entrypoint setup.

These modifications contribute to a more efficient, flexible, and maintainable Docker image for the mehari application. The changes are well-structured and follow Docker best practices.

Copy link

codecov bot commented Oct 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.01%. Comparing base (bf54266) to head (60125e9).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #565      +/-   ##
==========================================
+ Coverage   73.99%   74.01%   +0.02%     
==========================================
  Files          26       26              
  Lines        9849     9849              
==========================================
+ Hits         7288     7290       +2     
+ Misses       2561     2559       -2     

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

@tedil tedil requested a review from holtgrewe October 8, 2024 08:30
@tedil tedil enabled auto-merge (squash) October 8, 2024 08:40
@tedil tedil merged commit caed9b9 into main Oct 8, 2024
7 of 8 checks passed
@tedil tedil deleted the use-system-rocksdb branch October 8, 2024 08:45
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