Skip to content

Conversation

@ton77v
Copy link
Contributor

@ton77v ton77v commented Oct 29, 2024

Docker compose stack to deploy the demo cluster to Coolify: https://ror-demo.anaphora.it/

Summary by CodeRabbit

  • New Features

    • Introduced a complete demo environment setup for Elasticsearch and Kibana with Ruby on Rails integration, including Docker Compose configurations and network setup.
    • Added scripts to automate environment variable setup and build processes.
    • Provided a detailed README with deployment and local development instructions.
    • Added a multi-stage Docker build for Kibana with SSL disabled and custom configuration.
  • Chores

    • Added .dockerignore and .gitignore files to exclude sensitive and unnecessary files from Docker builds and version control.
    • Ensured consistent line endings for shell scripts with a new .gitattributes file.

@coutoPL
Copy link
Collaborator

coutoPL commented Nov 21, 2024

@ton77v can we close this?

@ton77v
Copy link
Contributor Author

ton77v commented Nov 25, 2024

I hope we can merge it to main, this setup works fine

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 15, 2025

Walkthrough

A new demo environment setup has been introduced in the coolify-demo directory. This includes Docker Compose configurations, Dockerfiles, shell scripts for environment and build automation, and supporting files like .gitignore, .dockerignore, and a README with deployment instructions. The setup orchestrates Elasticsearch and Kibana services with custom initialization and health checks.

Changes

File(s) Change Summary
coolify-demo/.dockerignore
coolify-demo/.gitignore
Added ignore files to exclude .env, readme.md, Docker Compose, and Dockerfile patterns from Docker builds and to prevent .env from being tracked by git.
coolify-demo/Dockerfile-KBN-noSSL Introduced a multi-stage Dockerfile for Kibana without SSL, including custom configuration injection and plugin installation logic.
coolify-demo/build_starter.sh Added a shell script to automate package installation, environment variable setup, and Docker Compose build steps for the demo.
coolify-demo/docker-compose.local.yaml Added a Docker Compose file defining three services (es-ror, kbn-ror, initializer) connected via a custom bridge network, without further configuration.
coolify-demo/docker-compose.yaml Added a comprehensive Docker Compose file defining es-ror, kbn-ror, and initializer services, with build contexts, environment variables, ports, health checks, dependencies, and resource limits.
coolify-demo/readme.md Added a README with detailed deployment and local development instructions for running the demo environment using Coolify and Docker Compose.
coolify-demo/set_env_vars.sh Added a shell script to fetch Elasticsearch and Kibana versions from an API, write them to a .env file, and display the results.
.gitattributes Added .gitattributes to normalize line endings for shell scripts to LF.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant build_starter.sh
    participant set_env_vars.sh
    participant Docker Compose
    participant es-ror
    participant kbn-ror
    participant initializer

    User->>build_starter.sh: Run build_starter.sh
    build_starter.sh->>set_env_vars.sh: Source environment variables
    set_env_vars.sh->>API: Fetch ES/KBN versions
    set_env_vars.sh-->>build_starter.sh: Write .env file
    build_starter.sh->>Docker Compose: Build images

    User->>Docker Compose: Start stack (docker-compose up)
    Docker Compose->>es-ror: Start Elasticsearch service
    es-ror-->>Docker Compose: Health check
    Docker Compose->>kbn-ror: Start Kibana after es-ror healthy
    kbn-ror-->>Docker Compose: Health check
    Docker Compose->>initializer: Start after es-ror & kbn-ror healthy
    initializer-->>Docker Compose: Health check (/tmp/init_done)
Loading

Poem

In the meadow of code, a demo takes flight,
With Docker and Compose, it launches just right.
Elasticsearch and Kibana, side by side they run,
Scripts set the stage, and the cluster’s begun.
A README to guide, and health checks to cheer—
The rabbit hops forward, the playground is here!
🐇✨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between c61a3d2 and adbba63.

📒 Files selected for processing (2)
  • .gitattributes (1 hunks)
  • coolify-demo/Dockerfile-KBN-noSSL (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .gitattributes
🚧 Files skipped from review as they are similar to previous changes (1)
  • coolify-demo/Dockerfile-KBN-noSSL

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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: 8

🧹 Nitpick comments (11)
coolify-demo/docker-compose.local.yaml (1)

1-2: Suggest specifying Compose version
To align with the main docker-compose.yaml and improve clarity, add a version: '3.8' (or appropriate) at the top of this file.

coolify-demo/build_starter.sh (1)

7-9: Source environment script relative to its location
For reliability, source set_env_vars.sh via the script’s directory instead of relying on the working directory. For example:

source "$(dirname "$0")/set_env_vars.sh"
coolify-demo/readme.md (6)

7-9: Specify code fence language for the URL block
The fenced block around the Git URL should declare a language (e.g., text) to satisfy lint rules:

- ```
+ ```text
  https://github.com/beshu-tech/ror-sandbox
- ```
+ ```
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

7-7: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


13-16: Specify code fence language for path block
Add a language (e.g., text or bash) to the fenced block showing /coolify-demo to improve readability and pass linting:

- ```
+ ```text
  /coolify-demo
- ```
+ ```
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

14-14: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


28-30: Specify code fence language for build command
The custom build command block should use shell for syntax highlighting and lint compliance:

- ```
+ ```shell
  chmod +x coolify-demo/build_starter.sh && cd coolify-demo && ./build_starter.sh
- ```
+ ```
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

28-28: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


32-34: Specify code fence language for start command
Similarly, annotate the start command block with shell:

- ```
+ ```shell
  cd coolify-demo && docker compose up --no-build -d
- ```
+ ```
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

32-32: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


21-21: Remove stray apostrophe
Line ends with an extra apostrophe (…try again'). Please delete it to correct the sentence.


46-46: Add missing determiner
Change “in current directory” to “in the current directory” for clarity:

- in current directory:
+ in the current directory:
🧰 Tools
🪛 LanguageTool

[uncategorized] ~46-~46: You might be missing the article “the” here.
Context: ...ly, please use the following command in current directory: ```shell docker compose -f d...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

coolify-demo/Dockerfile-KBN-noSSL (1)

20-22: Consider documenting SSL security implications

While disabling SSL works for the demo environment, it would be beneficial to add a comment explicitly noting this is for demo purposes only and shouldn't be used in production environments without proper security considerations.

coolify-demo/set_env_vars.sh (1)

14-22: Consider making API URL configurable

The API URL is hardcoded. Consider making it configurable via an environment variable to improve flexibility.

+ # Use configurable API URL with fallback to default
+ API_URL=${API_URL:-"https://api.beshu.tech/list_es_versions"}
+ echo "Fetching version information from: $API_URL"
+ 
- response=$(curl -s https://api.beshu.tech/list_es_versions)
+ response=$(curl -s "$API_URL")
coolify-demo/docker-compose.yaml (1)

52-56: Inconsistent authentication approach

The Kibana health check uses admin:admin credentials over HTTP while Elasticsearch uses HTTPS. Consider using a consistent authentication approach across services.

- test: [ "CMD", "curl", "-fk", "-u", "admin:admin", "http://localhost:5601/api/features" ]
+ test: [ "CMD", "curl", "-fk", "-u", "${KBN_ADMIN_USER:-admin}:${KBN_ADMIN_PASSWORD:-admin}", "http://localhost:5601/api/features" ]
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 1cd2ce8 and c61a3d2.

📒 Files selected for processing (8)
  • coolify-demo/.dockerignore (1 hunks)
  • coolify-demo/.gitignore (1 hunks)
  • coolify-demo/Dockerfile-KBN-noSSL (1 hunks)
  • coolify-demo/build_starter.sh (1 hunks)
  • coolify-demo/docker-compose.local.yaml (1 hunks)
  • coolify-demo/docker-compose.yaml (1 hunks)
  • coolify-demo/readme.md (1 hunks)
  • coolify-demo/set_env_vars.sh (1 hunks)
🧰 Additional context used
🪛 LanguageTool
coolify-demo/readme.md

[uncategorized] ~24-~24: Possible missing comma found.
Context: ...n Ror" with whatever domain you want to use e.g. https://ror-demo.anaphora.it 6....

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~46-~46: You might be missing the article “the” here.
Context: ...ly, please use the following command in current directory: ```shell docker compose -f d...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

🪛 markdownlint-cli2 (0.17.2)
coolify-demo/readme.md

7-7: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


14-14: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


28-28: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


32-32: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

🔇 Additional comments (12)
coolify-demo/.gitignore (1)

1-1: Correctly excluding environment file
Ignoring the generated .env file prevents leaking sensitive configuration into source control.

coolify-demo/.dockerignore (1)

1-3: Verify ignored build-context files
Excluding .env, readme.md, and all docker-compose.* files from the Docker build context is appropriate to keep images lean and avoid leaking credentials or docs into images.

coolify-demo/docker-compose.local.yaml (2)

3-14: Service network attachments are correct
All three services (es-ror, kbn-ror, and initializer) join the es-ror-network bridge network as intended.


15-17: Network definition is valid
The es-ror-network is declared with the bridge driver as expected.

coolify-demo/build_starter.sh (2)

3-6: Dependency installation on Alpine
Installing jq and curl via apk is correct for the Coolify helper image (Alpine). Ensure this script is only run in that environment.


10-11: Compose build invocation is sound
Using docker compose build aligns with Docker’s current CLI.

coolify-demo/Dockerfile-KBN-noSSL (4)

1-4: Well-structured multi-stage build approach

The multi-stage build pattern used here is excellent for minimizing image size and separating build-time dependencies from runtime needs. This is especially good practice for Kibana 9.0+ which uses a minimal base image without packaging tools.


9-10: Good package management practices

Good practice with installing only the necessary packages and cleaning up the apt cache in the same layer to keep the image size minimal.


32-34: Interesting SSL certificate requirement note

Good documentation explaining why SSL certificates are still needed even with SSL disabled. This non-obvious requirement could cause issues if not properly understood.


38-42: Good security practice with user switching

Good security practice switching back to the non-root kibana user after completing operations requiring elevated privileges.

coolify-demo/set_env_vars.sh (1)

3-7: Good dependency checking

Good practice checking for required dependencies before proceeding with the script, and providing clear installation instructions.

coolify-demo/docker-compose.yaml (1)

23-28: Well-defined health checks

Good implementation of health checks with appropriate intervals, timeouts, retries and start periods. This ensures services start in the correct order and are actually ready, not just running.

- "ES_JAVA_OPTS=-Xms512m -Xmx512m -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5000"
- ES_VERSION=${ES_VERSION:-9.0.1}
healthcheck:
test: [ "CMD", "curl", "-fk", "-u", "admin:admin", "https://localhost:9200/_cluster/health" ]
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Security concern: Hard-coded credentials in health check

The health check contains hard-coded admin credentials. Consider using environment variables for these credentials to improve security and maintainability.

- test: [ "CMD", "curl", "-fk", "-u", "admin:admin", "https://localhost:9200/_cluster/health" ]
+ test: [ "CMD", "curl", "-fk", "-u", "${ES_ADMIN_USER:-admin}:${ES_ADMIN_PASSWORD:-admin}", "https://localhost:9200/_cluster/health" ]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test: [ "CMD", "curl", "-fk", "-u", "admin:admin", "https://localhost:9200/_cluster/health" ]
test: [ "CMD", "curl", "-fk", "-u", "${ES_ADMIN_USER:-admin}:${ES_ADMIN_PASSWORD:-admin}", "https://localhost:9200/_cluster/health" ]
🤖 Prompt for AI Agents
In coolify-demo/docker-compose.yaml at line 24, the health check uses hard-coded
admin credentials in the curl command. Replace the hard-coded username and
password with environment variables by referencing them in the command, and
define these variables securely in the environment section or an external
secrets file to improve security and maintainability.

@beshu-tech beshu-tech deleted a comment from coderabbitai bot May 21, 2025
@beshu-tech beshu-tech deleted a comment from coderabbitai bot May 21, 2025
@beshu-tech beshu-tech deleted a comment from coderabbitai bot May 21, 2025
@beshu-tech beshu-tech deleted a comment from coderabbitai bot May 21, 2025
@beshu-tech beshu-tech deleted a comment from coderabbitai bot May 21, 2025
@beshu-tech beshu-tech deleted a comment from coderabbitai bot May 21, 2025
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.

2 participants