Skip to content

Conversation

@gocanto
Copy link
Collaborator

@gocanto gocanto commented Jul 12, 2025

Summary by CodeRabbit

  • New Features

    • Added a new command to run the API's CLI interface via the Makefile.
    • Introduced a Makefile command that checks for required database environment variables before running the CLI.
  • Chores

    • Updated Docker Compose configuration to mount the .env file and set database host and port environment variables for the API runner service.
    • Enhanced Makefile help output to include the new CLI command.

@coderabbitai
Copy link

coderabbitai bot commented Jul 12, 2025

Walkthrough

The changes introduce a new Makefile target, run-cli, which allows running the API's CLI interface within the Docker api-runner service. This includes checks for required database secret environment variables, updates to the help text, and modifications to the Docker Compose configuration to support the CLI execution and environment management.

Changes

File(s) Change Summary
Makefile Updated help target to document the new run-cli command.
config/makefile/app.mk Added run-cli target with environment variable checks and Docker Compose execution for the CLI.
docker-compose.yml Modified api-runner service to add .env volume, set ENV_DB_HOST, and configure ENV_DB_PORT.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Makefile
    participant DockerCompose
    participant ApiRunnerContainer

    User->>Makefile: make run-cli
    Makefile->>Makefile: Check DB_SECRET_* env vars
    alt If any secret missing
        Makefile-->>User: Print usage & exit
    else All secrets set
        Makefile->>DockerCompose: docker compose run api-runner go run cli/main.go
        DockerCompose->>ApiRunnerContainer: Start with .env and DB env vars
        ApiRunnerContainer-->>User: CLI runs with provided secrets
    end
Loading

Possibly related PRs

  • Introduce <api-runner> service #44: Extends the api-runner service by adding environment variables, volume mounts, and the new Makefile target to run the CLI, building directly upon the earlier service setup.

Poem

In the warren of code, a new path appears,
With secrets in tow, the CLI now steers.
Compose and Makefile, in harmony run,
To launch your commands, the setup is done.
🐇 Hop in the runner, let’s see what you’ll find—
The CLI is ready, with secrets aligned!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c66622 and 266d0ea.

📒 Files selected for processing (1)
  • config/makefile/app.mk (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • config/makefile/app.mk

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.

@gocanto gocanto changed the title add db secrets to runner [feature] Launch CLI using the api-runner service Jul 12, 2025
@gocanto gocanto marked this pull request as ready for review July 12, 2025 06:26
Copy link

@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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between deefa9e and 3c66622.

📒 Files selected for processing (3)
  • Makefile (1 hunks)
  • config/makefile/app.mk (2 hunks)
  • docker-compose.yml (1 hunks)
🔇 Additional comments (6)
config/makefile/app.mk (3)

1-1: LGTM: Proper PHONY target declaration.

The addition of run-cli to the .PHONY target list is correct and follows Makefile best practices.


43-46: Consider security implications of displaying secret paths.

While displaying the paths to secret files is generally acceptable for debugging purposes, ensure that the actual secret values are never accidentally exposed in logs or console output.

The current implementation shows file paths which should be safe, but verify that the Docker Compose execution doesn't expose actual secret values in any logs.


47-50: LGTM: Proper Docker Compose execution with environment variables.

The Docker Compose command correctly passes the environment variables and executes the CLI within the api-runner service. The --rm flag ensures proper cleanup after execution.

docker-compose.yml (2)

83-83: LGTM: Secure .env file mounting.

The .env file is properly mounted as read-only (:ro flag), which is a good security practice that prevents the container from modifying the host's environment file.


86-88: LGTM: Proper environment variable configuration.

The database connection environment variables are correctly set:

  • ENV_DB_HOST points to the api-db service
  • ENV_DB_PORT uses the environment variable with a sensible default fallback

This configuration aligns well with the existing database service setup.

Makefile (1)

55-56: LGTM: Clear and consistent help text addition.

The help text entry for run-cli follows the established formatting pattern and provides a clear description of the command's purpose. The placement in the "General Commands" section is appropriate.

@gocanto gocanto merged commit f5964db into main Jul 12, 2025
4 checks passed
@gocanto gocanto deleted the feature/cli-invoke branch July 12, 2025 06:34
@coderabbitai coderabbitai bot mentioned this pull request Aug 11, 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