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

Add health check to docker compose #546

Merged
merged 3 commits into from
Jan 22, 2025
Merged

Conversation

Knocks83
Copy link
Contributor

@Knocks83 Knocks83 commented Jan 9, 2025

Added health check in the included docker-compose.yml file

@actual-github-bot actual-github-bot bot changed the title Add health check to docker compose [WIP] Add health check to docker compose Jan 9, 2025
Copy link
Contributor

👋 Hi! It looks like this PR has not had any changes for a week now. Would you like someone to review this PR? If so - please remove the "[WIP]" prefix from the PR title. That will let the community know that this PR is open for a review.

@github-actions github-actions bot added the stale label Jan 17, 2025
@Knocks83 Knocks83 changed the title [WIP] Add health check to docker compose Add health check to docker compose Jan 17, 2025
Copy link
Contributor

coderabbitai bot commented Jan 17, 2025

Walkthrough

The pull request introduces a health check configuration for the actual_server service in the docker-compose.yml file. The health check is implemented using a custom script located at src/scripts/health-check.js, which will be executed using the CMD-SHELL directive. The configuration specifies a 60-second interval between health checks, with a 10-second timeout for each check. The service allows up to 3 retries if a health check fails, and includes a 20-second start period to give the service time to initialize before health checks begin actively monitoring its status. This addition provides a mechanism to automatically detect and respond to potential service health issues during container runtime.


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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: 2

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c017b8a and 1da3ba4.

⛔ Files ignored due to path filters (1)
  • upcoming-release-notes/546.md is excluded by !**/*.md
📒 Files selected for processing (1)
  • docker-compose.yml (1 hunks)
🔇 Additional comments (1)
docker-compose.yml (1)

25-28: LGTM! Health check parameters are well configured.

The health check parameters are reasonably configured:

  • 60s interval provides a good balance between responsiveness and overhead
  • 10s timeout is sufficient for a health check
  • 3 retries help avoid false positives
  • 20s start period gives enough time for the service to initialize

@@ -19,4 +19,11 @@ services:
# Change './actual-data' below to the path to the folder you want Actual to store its data in on your server.
# '/data' is the path Actual will look for its files in by default, so leave that as-is.
- ./actual-data:/data
healthcheck:
# Enable health check for the instance
test: ["CMD-SHELL", "node src/scripts/health-check.js"]
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

Consider using an absolute path or mounting the health check script.

The relative path src/scripts/health-check.js might not be accessible in the container. Consider either:

  1. Using an absolute path if the script is already included in the container image
  2. Mounting the script via a volume if it needs to be provided externally

Example of mounting the script:

    volumes:
      # Change './actual-data' below to the path to the folder you want Actual to store its data in on your server.
      # '/data' is the path Actual will look for its files in by default, so leave that as-is.
      - ./actual-data:/data
+     # Mount the health check script
+     - ./scripts/health-check.js:/app/health-check.js
    healthcheck:
      # Enable health check for the instance
-     test: ["CMD-SHELL", "node src/scripts/health-check.js"]
+     test: ["CMD-SHELL", "node /app/health-check.js"]

Committable suggestion skipped: line range outside the PR's diff.

docker-compose.yml Show resolved Hide resolved
@github-actions github-actions bot removed the stale label Jan 18, 2025
Copy link
Contributor

@matt-fidd matt-fidd left a comment

Choose a reason for hiding this comment

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

LGTM, thank you

@matt-fidd matt-fidd merged commit 5ada00c into actualbudget:master Jan 22, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants