Description

This gem is intended for internal use at Shaman, though you may find it useful (if a bit opinionated) nonetheless.

Prerequisites

  • A Rails >= 5.0 application
  • Ruby >= 2.3.0

Installation

Add this line to your gemfile:

gem 'kubelink'

Then run bundle install.

Features

Configuration and logging

This gems sets a few configuration options in production:

  • config.force_ssl = true
  • config.log_level = :info

It also includes lograge to reduce logging to a manageable level.

Healthcheck endpoints

By including this gem two endpoints will be added to your routes:

  • /healthz, which runs SELECT 1 on the database and returns a 200 OK
  • /statusz, which just returns a 200 OK

They are supposed to be used as liveness and readiness probes in Kubernetes.

Prometheus exporter

PrometheusExporter::Middleware is added to rack. You still need to run an exporter in a separate process:

bundle exec prometheus_exporter

Sentry integration

This gem requires the presence of a SENTRY_DSN environment variable to enable Sentry integration in production. You need to include the relevant script tag in your layout by using the appropriate helper:

<%= sentry_include_tag %>

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome at https://git.shaman.xyz/shaman/kubelink. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Kubelink project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.