Skip to content

Conversation

@sinanmohd
Copy link
Contributor

@sinanmohd sinanmohd commented Sep 23, 2024

Change Summary

  • closes nocodb/nocohub#3805

Change type

  • feat: add sqlite support in the upstall script

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 23, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes introduce a new configuration variable, CONFIG_POSTGRES_SQLITE, to allow users to choose between PostgreSQL and SQLite as the database. The default setting is PostgreSQL. The script modifications include conditional logic for generating the Docker Compose file and configuring environment variables based on the selected database type. This enhances the script's flexibility in database configuration based on user input.

Changes

File Path Change Summary
docker-compose/1_Auto_Upstall/noco.sh Added CONFIG_POSTGRES_SQLITE variable to select between PostgreSQL and SQLite; updated Docker Compose generation logic to conditionally include PostgreSQL service and connection strings.

Possibly related PRs

  • fix: compose configuration generation #9536: The changes in this PR also involve modifications to the noco.sh script, specifically related to the generation of Docker Compose configurations, which aligns with the main PR's updates to database service configuration based on user input.

Suggested labels

🐛 Type: Bug, size:M, lgtm

Suggested reviewers

  • o1lab
  • DarkPhoenix2704
  • pranavxc

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 938523d and 2aaa2b3.

📒 Files selected for processing (1)
  • docker-compose/1_Auto_Upstall/noco.sh (10 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docker-compose/1_Auto_Upstall/noco.sh

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.

@sinanmohd sinanmohd added the 🔦 Type: Feature New functionality is requested. label Sep 23, 2024
@dstala dstala requested a review from pranavxc September 25, 2024 06:23
@sinanmohd sinanmohd force-pushed the feat-upstall-sqlite branch 3 times, most recently from a2aa298 to cd41294 Compare September 25, 2024 12:32
@sinanmohd sinanmohd marked this pull request as ready for review September 25, 2024 12:46
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Sep 25, 2024
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: 5

🧹 Outside diff range and nitpick comments (3)
docker-compose/1_Auto_Upstall/noco.sh (3)

Line range hint 589-634: Unnecessary port mapping for MinIO when disabled

The Traefik service is configured to map port 9000 even when MinIO is not enabled. This could expose an unused port and potentially cause confusion or security concerns.

Conditionally include the port mapping for port 9000 only when MinIO is enabled:

        ports:
          - "80:80"
          - "443:443"
-         - "9000:9000"

Add the port mapping when MinIO is enabled:

if [ "${CONFIG_MINIO_ENABLED}" = "Y" ]; then
    cat >> "$compose_file" <<EOF
          - "9000:9000"
EOF
fi

456-456: Clarify default option in database selection prompt

The prompt for selecting the database shows [P/S] with a default of "P" for PostgreSQL. This could be unclear to users who may not know which letter corresponds to which database.

Clarify the prompt to indicate the full names and the default option:

-    CONFIG_POSTGRE_SQLITE=$(prompt "Select PostgreSQL or SQLite as your database [P/S]" "P")
+    CONFIG_POSTGRE_SQLITE=$(prompt "Select your database: PostgreSQL [P] or SQLite [S] (default: P)" "P")

Line range hint 12-24: Domain name validation missing

In the get_user_inputs function, when the user provides a domain name, there is no validation to ensure it's correctly formatted. This could lead to issues with SSL configuration and accessing NocoDB.

Add validation for the domain name input:

CONFIG_DOMAIN_NAME=$(prompt "Enter the IP address or domain name for the NocoDB instance" "$(get_public_ip)")

+ while ! is_valid_domain "$CONFIG_DOMAIN_NAME"; do
+     print_error "The domain name '$CONFIG_DOMAIN_NAME' is not valid."
+     CONFIG_DOMAIN_NAME=$(prompt "Please enter a valid domain name" "$(get_public_ip)")
+ done
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between bdd6942 and cd41294.

📒 Files selected for processing (1)
  • docker-compose/1_Auto_Upstall/noco.sh (8 hunks)
🔇 Additional comments not posted (1)
docker-compose/1_Auto_Upstall/noco.sh (1)

531-541: ⚠️ Potential issue

Variable 'gen_redis' checked twice in condition

In the create_docker_compose_file function, the condition [ -n "$gen_redis" ] || [ "$gen_redis" ] repeats the check for gen_redis. This duplication is unnecessary.

Simplify the condition by removing the duplicate check:

-    if [ -n "$gen_postgres" ] || [ -n "$gen_redis" ]; then
+    if [ -n "$gen_postgres" ] || [ -n "$gen_redis" ]; then

Likely invalid or redundant comment.

@sinanmohd sinanmohd force-pushed the feat-upstall-sqlite branch 3 times, most recently from 97fe4cd to 8637c53 Compare September 25, 2024 13:00
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Sep 25, 2024
@sinanmohd sinanmohd requested a review from pranavxc September 25, 2024 14:09
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Sep 26, 2024
@sinanmohd sinanmohd requested a review from pranavxc September 26, 2024 01:25
Copy link
Member

@pranavxc pranavxc left a comment

Choose a reason for hiding this comment

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

Not part of this pr, let's add -v while removing docker containers to remove any attached volume

$CONFIG_DOCKER_COMMAND compose down

to

$CONFIG_DOCKER_COMMAND compose down -v

@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Sep 26, 2024
@sinanmohd sinanmohd requested a review from pranavxc September 26, 2024 14:02
Copy link
Member

@pranavxc pranavxc left a comment

Choose a reason for hiding this comment

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

Code changes looks fine, will merge after couple more testing.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 28, 2024
Copy link
Member

@pranavxc pranavxc left a comment

Choose a reason for hiding this comment

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

Getting following error while running script, initially it was working and later it started throwing following error.

Screenshot 2024-09-28 at 11 35 31 AM
bash <(curl -sSL https://raw.githubusercontent.com/nocodb/nocodb/ec578a824a38e64654346bc42d6ffee5f74c5f8f/docker-compose/1_Auto_Upstall/noco.sh) <(mktemp)

@sinanmohd
Copy link
Contributor Author

sinanmohd commented Sep 28, 2024

Getting following error while running script, initially it was working and later it started throwing following error.
Screenshot 2024-09-28 at 11 35 31 AM

bash <(curl -sSL https://raw.githubusercontent.com/nocodb/nocodb/ec578a824a38e64654346bc42d6ffee5f74c5f8f/docker-compose/1_Auto_Upstall/noco.sh) <(mktemp)

this happens when

  1. the container is running (the following outputs a path)
    CUSTOM_HOME="$($CONFIG_DOCKER_COMMAND inspect --format='{{index .Mounts 0}}' "$NOCO_ID" | cut -d ' ' -f 3)"
    PARENT_DIR="$(dirname "$CUSTOM_HOME")"

  2. you are in $PARENT_DIR

  3. NOCO_HOME is deleted

@sinanmohd sinanmohd marked this pull request as draft September 28, 2024 10:06
@sinanmohd sinanmohd force-pushed the feat-upstall-sqlite branch 2 times, most recently from 6479964 to bf06cba Compare September 28, 2024 10:17
@sinanmohd sinanmohd marked this pull request as ready for review September 28, 2024 10:22
@sinanmohd sinanmohd requested a review from pranavxc September 28, 2024 10:22
@dosubot dosubot bot removed the lgtm This PR has been approved by a maintainer label Sep 30, 2024
@sinanmohd sinanmohd requested a review from pranavxc September 30, 2024 12:32
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 1, 2024
@pranavxc pranavxc merged commit ebb3abe into nocodb:develop Oct 1, 2024
@coderabbitai coderabbitai bot mentioned this pull request Oct 10, 2024
1 task
@coderabbitai coderabbitai bot mentioned this pull request Jan 29, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files. 🔦 Type: Feature New functionality is requested.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants