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

feat: First swag at a comprehensive and complete app DB component. #2977

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

feoh
Copy link
Contributor

@feoh feoh commented Feb 19, 2025

What are the relevant tickets?

Relates to #2955

Description (What does it do?)

First swing at a one stop shopping application database component.

How can this be tested?

Integrate the component into an existing app that usees the current boilerplate. And smile if it works :)

@feoh feoh self-assigned this Feb 19, 2025
@blarghmatey
Copy link
Member

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new component, OLAppDatabase, designed to simplify the setup of application databases within the OL infrastructure. The component aims to reduce boilerplate and provide a standard configuration for typical applications. The addition of pyright to the project dependencies is also a welcome change for improving code quality through static type checking. Overall, the changes look good, but there are a few areas that could be improved for clarity and maintainability.

Summary of Findings

  • Security Group Description: The description for the security group is too specific. It should be more generic to reflect the broader purpose of the security group.
  • Vault Mount Point: The vault mount point is hardcoded to learn-ai. This should be configurable to allow for reuse across different applications.

Assessment

The pull request introduces a useful component for simplifying database setup. The code is generally well-structured and addresses the intended purpose. However, there are a few points that need to be addressed before merging, particularly regarding the security group description and the hardcoded vault mount point. Addressing these comments will improve the component's flexibility and maintainability. Users should have others review and approve this code before merging.

self.app_db_security_group = ec2.SecurityGroup(
f"{ol_db_config.app_name}-db-security-group-{stack_info.env_suffix}",
name=f"{ol_db_config.app_name}-db-security-group-{stack_info.env_suffix}",
description="Access control for the learn-ai database.",

Choose a reason for hiding this comment

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

medium

The description for the security group is very specific to learn-ai. Consider making it more generic to reflect the broader purpose of the security group, such as "Access control for application databases".

Suggested change
description="Access control for the learn-ai database.",
description="Access control for application databases.",


self.app_db_vault_backend_config = OLVaultPostgresDatabaseConfig(
db_name=self.ol_db_config.app_db_name,
mount_point=f"{self.app_db_config.engine}-learn-ai",

Choose a reason for hiding this comment

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

medium

The vault mount point is hardcoded to learn-ai. This limits the reusability of the component. Consider making this configurable via the OLAppDatabaseConfig class.

Suggested change
mount_point=f"{self.app_db_config.engine}-learn-ai",
mount_point=f"{self.app_db_config.engine}-{ol_db_config.app_name}",

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.

3 participants