-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
fix: use password while creating extension #36936
Conversation
Warning
|
File Path | Change Summary |
---|---|
deploy/docker/fs/opt/appsmith/pg-utils.sh | Modifications to waitForPostgresAvailability and init_pg_db functions for better connection handling, validation, and logging. Added support for remote PostgreSQL servers using PGPASSWORD . Updated command execution context for pg_trgm extension creation. |
Possibly related PRs
- chore: create appsmith schema for postgres #36591: This PR adds the
init_pg_db
function topg-utils.sh
, which is directly related to the changes in the main PR that also modifies theinit_pg_db
function for PostgreSQL database initialization. - chore: Add grants for appsmith user for embedded postgres #36664: This PR enhances
pg-utils.sh
by adding thegrant_permissions_for_schema
function and modifiesinit_pg_db
, which is relevant as it builds upon the database initialization logic present in the main PR. - chore: create pg_trm extension for the GIN index creation #36722: This PR updates
pg-utils.sh
to include the creation of thepg_trgm
extension within theinit_pg_db
function, directly connecting it to the changes made in the main PR regarding the handling of PostgreSQL extensions.
Suggested labels
skip-changelog
, ok-to-test
Suggested reviewers
- abhvsn
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?
🪧 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.
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.
There was a problem hiding this 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)
deploy/docker/fs/opt/appsmith/pg-utils.sh (2)
Line range hint
70-106
: Improved database initialization logic looks good.The changes to the
init_pg_db
function enhance its robustness by checking for the existence of the database, schema, and user before creating them. The differentiation between local and remote PostgreSQL instances is also well-implemented.Consider adding error checks after each
psql
command to ensure that the operations were successful. For example:if ! psql -h "$PG_DB_HOST" -p "$PG_DB_PORT" -U postgres -d "postgres" -c "CREATE DATABASE $PG_DB_NAME;"; then echo "Failed to create database $PG_DB_NAME" exit 1 fiThis will help catch and report any issues during the initialization process.
137-140
: Good addition of pg_trgm extension, but consider security and error handling.The addition of the pg_trgm extension is beneficial for text search functionality. However, there are two points to consider:
Security: Using PGPASSWORD in the command line can expose the password in process lists. Consider using a .pgpass file or connection service file for more secure authentication.
Error Handling: Add error checking for the extension creation. For example:
if ! PGPASSWORD=$PG_DB_PASSWORD psql -h "$PG_DB_HOST" -p "$PG_DB_PORT" -U "$PG_DB_USER" -d "$PG_DB_NAME" -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"; then echo "Failed to create pg_trgm extension" exit 1 fiThis ensures that any issues during extension creation are caught and reported.
Description
Use password while creating pg_trm extension on remote postgres.
Fixes #
Issue Number
or
Fixes
Issue URL
Warning
If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.
Automation
/ok-to-test tags=""
🔍 Cypress test results
Caution
If you modify the content in this section, you are likely to disrupt the CI result for your PR.
Communication
Should the DevRel and Marketing teams inform users about this change?