{"id":13411762,"url":"https://github.com/shlima/health_bit","last_synced_at":"2025-10-08T18:13:36.563Z","repository":{"id":39686324,"uuid":"262140584","full_name":"shlima/health_bit","owner":"shlima","description":"Tiny health check of Rack apps like Rails, Sinatra for use with uptime checking systems like Kubernetes, Docker or Uptimerobot","archived":false,"fork":false,"pushed_at":"2023-03-15T21:38:13.000Z","size":178,"stargazers_count":112,"open_issues_count":3,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-06T04:57:22.481Z","etag":null,"topics":["health","health-check","healthcheck","rack","ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shlima.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-07T19:29:27.000Z","updated_at":"2025-06-13T17:29:42.000Z","dependencies_parsed_at":"2024-06-21T14:27:41.890Z","dependency_job_id":"f3de48cd-6ee6-4733-912b-760d87a52624","html_url":"https://github.com/shlima/health_bit","commit_stats":{"total_commits":37,"total_committers":5,"mean_commits":7.4,"dds":0.1351351351351351,"last_synced_commit":"0ca4d6599c24bce19b1e792ddd47d685940b1246"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/shlima/health_bit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shlima%2Fhealth_bit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shlima%2Fhealth_bit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shlima%2Fhealth_bit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shlima%2Fhealth_bit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shlima","download_url":"https://codeload.github.com/shlima/health_bit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shlima%2Fhealth_bit/sbom","scorecard":{"id":819914,"data":{"date":"2025-08-11","repo":{"name":"github.com/shlima/health_bit","commit":"0ca4d6599c24bce19b1e792ddd47d685940b1246"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Code-Review","score":1,"reason":"Found 3/24 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/shlima/health_bit/main.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/shlima/health_bit/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/shlima/health_bit/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/shlima/health_bit/main.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/main.yml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/shlima/health_bit/main.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/shlima/health_bit/main.yml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 9 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"18 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-22f2-v57c-j9cx","Warn: Project is vulnerable to: GHSA-3h57-hmj3-gj3p","Warn: Project is vulnerable to: GHSA-54rr-7fvw-6x8f","Warn: Project is vulnerable to: GHSA-65f5-mfpf-vfhj","Warn: Project is vulnerable to: GHSA-7g2v-jj9q-g3rg","Warn: Project is vulnerable to: GHSA-7wqh-767x-r66v","Warn: Project is vulnerable to: GHSA-8cgq-6mh2-7j6v","Warn: Project is vulnerable to: GHSA-93pm-5p5f-3ghx","Warn: Project is vulnerable to: GHSA-c6qg-cjj8-47qp","Warn: Project is vulnerable to: GHSA-gjh7-p2fx-99vx","Warn: Project is vulnerable to: GHSA-rqv2-275x-2jq5","Warn: Project is vulnerable to: GHSA-xj5v-6v4g-jfw6","Warn: Project is vulnerable to: GHSA-2rxp-v6pw-ch6m","Warn: Project is vulnerable to: GHSA-4xqq-m2hx-25v8","Warn: Project is vulnerable to: GHSA-5866-49gr-22v4","Warn: Project is vulnerable to: GHSA-r55c-59qm-vjw6","Warn: Project is vulnerable to: GHSA-vg3r-rm7w-2xgh","Warn: Project is vulnerable to: GHSA-vmwr-mc7x-5vc3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T15:13:52.040Z","repository_id":39686324,"created_at":"2025-08-23T15:13:52.041Z","updated_at":"2025-08-23T15:13:52.041Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278839162,"owners_count":26054876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["health","health-check","healthcheck","rack","ruby","ruby-on-rails"],"created_at":"2024-07-30T20:01:16.633Z","updated_at":"2025-10-08T18:13:36.527Z","avatar_url":"https://github.com/shlima.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"![CI](https://github.com/shlima/health_bit/workflows/CI/badge.svg)\n[![gem version](https://badge.fury.io/rb/health_bit.svg)](https://rubygems.org/gems/health_bit)\n\n# HealthBit\n\n![](./doc/logo.png?sanitize=true)\n\nThis gem was inspired by the [health_check](https://github.com/ianheggie/health_check), but is simpler and more\nextensible and contains up to 95% less code.\n\nKey differences:\n* is a rack application (just a lambda function)\n* can be used with rails, sinatra or any other rack application\n* can add custom checks\n* can add multiple endpoints with independent checks\n* can use any rack middleware (such as http basic auth, IP whitelist)\n\n## Toc\n\n* [Installation](#installation)\n* [Configuration](#configuration)\n* [Add Checks](#add-checks)\n* [Add a Route](#add-a-route)\n* [Password Protection](#password-protection)\n* [Multiple endpoints](#multiple-endpoints)\n* [Custom formatter](#custom-formatter)\n\n## Check Examples\n\n* [Database check](#database-check)\n* [Redis check](#redis-check)\n* [Sidekiq check](#sidekiq-check)\n* [Rails cache check](#rails-cache-check)\n* [Elasticsearch check](#elasticsearch-check)\n* [RabbitMQ check](#rabbitmq-check)\n* [HTTP check](#http-check)\n* [ClickHouse check](#clickhouse-check)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'health_bit'\n```\n\n## Configuration\n\n```ruby\n# config/initializers/health_bit.rb\n\nHealthBit.configure do |c|\n  # DEFAULT SETTINGS ARE SHOWN BELOW\n  c.success_text = '%\u003ccount\u003ed checks passed 🎉'\n  c.headers = {\n    'Content-Type' =\u003e 'text/plain;charset=utf-8',\n    'Cache-Control' =\u003e 'private,max-age=0,must-revalidate,no-store'\n  }\n  c.success_code = 200\n  c.fail_code = 500\n  c.show_backtrace = false\n  c.formatter = HealthBit::Formatter.new\n  # DEFAULT SETTINGS ARE SHOWN ABOVE\n\n  c.add('Check name') do\n    # Body check, should returns `true`\n    true\n  end\nend\n```\n\n## Add Checks\n\nBy default, the **gem does not contain any checks**, **you should add the\nnecessary checks by yourself**. The check should return `false` or `nil`\nto be considered unsuccessful or throw an exception, any other\nvalues are considered satisfactory.\n\nExample checks:\n\n```ruby\n## Successful checks\nHealthBit.add('PostgreSQL') do |env|\n  ApplicationRecord.connection.select_value('SELECT 1') == 1\nend\n\nHealthBit.add('Custom') do |env|\n  next(false) if 1 != 0 \n  \n  true\nend\n\n## Failed checks\nHealthBit.add('Database') do |env|\n  false\nend\n\nHealthBit.add('Docker service') do |env|\n  raise 'not responding'\nend\n\n# The Check can be added as an object responding to a call\n# (to be able to test your check)\nclass Covid19Check\n  def self.call(env)\n    false\n  end\nend\n\nHealthBit.add('COVID-19 Checker', Covid19Check)\n```\n\n## Add a Route\n\nSince the gem is a rack application, you must mount it to app's\nroutes. Below is an example for the Rails.\n\n```ruby\n# config/routes.rb\n\nRails.application.routes.draw do\n  mount HealthBit.rack =\u003e '/health'\nend\n```\n\n```bash\ncurl --verbose http://localhost:3000/health\n\n\u003c HTTP/1.1 200 OK\n\u003c Content-Type: text/plain;charset=utf-8\n\u003c Cache-Control: private,max-age=0,must-revalidate,no-store\n\u003c X-Request-Id: 59a796b9-29f7-4302-b1ff-5d0b06dd6637\n\u003c X-Runtime: 0.006007\n\u003c Vary: Origin\n\u003c Transfer-Encoding: chunked\n\n4 checks passed 🎉\n```\n\n## Password Protection\n\nSince the gem is a common rack application, you can add any rack\nmiddleware to it. Below is an example with HTTP-auth for the Rails.\n\n```ruby\n# config/routes.rb\n\nRails.application.routes.draw do\n  HealthBit.rack.use Rack::Auth::Basic do |username, password|\n    ActiveSupport::SecurityUtils.secure_compare(Digest::SHA256.hexdigest(username), Digest::SHA256.hexdigest('user')) \u0026 ActiveSupport::SecurityUtils.secure_compare(Digest::SHA256.hexdigest(password), Digest::SHA256.hexdigest('password'))\n  end\n\n  mount HealthBit.rack =\u003e '/health'\nend\n```\n\n## Database check\n\n```ruby\nHealthBit.add('Database') do |env|\n  ApplicationRecord.connection.select_value('SELECT 1') == 1\nend\n```\n\n## Redis check\n\n```ruby\nHealthBit.add('Redis') do |env|\n  Redis.current.ping == 'PONG'\nend\n```\n\n## Sidekiq check\n\n```ruby\nHealthBit.add('Sidekiq') do |env|\n  Sidekiq.redis(\u0026:ping) == 'PONG'\nend\n```\n\n## Rails cache check\n\n```ruby\nHealthBit.add('Rails cache') do |env|\n  Rails.cache.write('__health_bit__', '1', expires_in: 1.second)\nend\n```\n\n## Elasticsearch check\n\n```ruby\nHealthBit.add('Elasticsearch') do |env|\n  Elasticsearch::Client.new.ping\nend\n```\n\n## RabbitMQ check\n\n```ruby\nHealthBit.add('RabbitMQ') do |env|\n  Bunny::Connection.connect(\u0026:connection)\nend\n```\n\n## HTTP check\n\n```ruby\nHealthBit.add('HTTP check') do |env|\n  Net::HTTP.new('www.example.com', 80).request_get('/').kind_of?(Net::HTTPSuccess)\nend\n```\n\n## ClickHouse check\n\n```ruby\nHealthBit.add('ClickHouse') do |env|\n  ClickHouse.connection.ping\nend\n```\n\n## Multiple endpoints\n\nSometimes you have to add several health check endpoints. Let's say\nyou have to check the docker container health and the health\nof your application as a whole. Below is an example for the Rails.\n\n```ruby\n# config/initializers/health_bit.rb\n\nDockerCheck = HealthBit.clone\nAppCheck = HealthBit.clone\n\nDockerCheck.add('Docker Health') do |env|\n  true\nend\n\nAppCheck.add('App Health') do |env|\n  ApplicationRecord.connection.select_value(\"SELECT 't'::boolean\")\nend\n```\n\n```ruby\n# config/routes.rb\n\nRails.application.routes.draw do\n  mount DockerCheck.rack =\u003e '/docker'\n  mount AppCheck.rack =\u003e '/app'\nend\n```\n\n## Custom formatter\n\nYou can easily [configure](https://github.com/shlima/health_bit/blob/master/lib/health_bit/formatter.rb) custom format of response body, headers and\nhttp statuses.\n\n```ruby\nclass JsonFormatter \u003c HealthBit::Formatter\n  # @param error HealthBit::CheckError\n  # @param env Hash\n  # @param health_bit HealthBit\n  def format_failure(error, env, health_bit)\n    { 'status': 'error' }.to_json\n  end\n\n  # @param error HealthBit::CheckError\n  # @param env Hash\n  # @param health_bit HealthBit\n  def headers_failure(error, env, health_bit)\n    {\n      'Content-Type' =\u003e 'application/json'\n    }\n  end\nend\n\nHealthBit.configure do |c|\n  c.formatter = JsonFormatter.new\nend\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshlima%2Fhealth_bit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshlima%2Fhealth_bit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshlima%2Fhealth_bit/lists"}