Skip to content

The companion gem for Shipyrd, the Kamal deployment dashboard

Notifications You must be signed in to change notification settings

Shipyrd/shipyrd-gem

Repository files navigation

Shipyrd

This is a simple helper gem to connect your Kamal hooks(pre-build, pre-build, pre-deploy, post-deploy) to Shipyrd.

Shipyrd is a deployment dashboard built for Kamal.

Installation

Install the gem and add to the application's Gemfile by executing:

$ bundle add shipyrd

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install shipyrd

Usage

Please see the main Shipyrd app(https://github.com/shipyrd/shipyrd) for setup and usage instructions.

Usage with Docker

You can run a dockerized version of shipyrd-gem by adding the following function to your ~/.bashrc or similar:

shipyrd() {
  docker run --rm -v "${PWD}:/workdir" --env-file <(env | grep -E '^(KAMAL_|SHIPYRD_)') ghcr.io/shipyrd/shipyrd-gem /shipyrd/bin/"$@"
}

Then within a specific Kamal hook (e.g. pre-connect), you can call shipyrd like this:

#!/usr/bin/env bash

shipyrd pre-connect

Recording a deploy

This gem currently sends the following deploy details to record a deploy. The various KAMAL_ ENV variables are set via Kamal when the hooks are called.

  • ENV["KAMAL_COMMAND"],
  • ENV["KAMAL_DESTINATION"],
  • ENV["KAMAL_HOSTS",
  • ENV["KAMAL_PERFORMER"] - gh config get -h github.com username is preferred if set.
  • ENV["KAMAL_RECORDED_AT"],
  • ENV["KAMAL_ROLE"],
  • ENV["KAMAL_RUNTIME"],
  • ENV["KAMAL_SERVICE_VERSION"],
  • ENV["KAMAL_SUBCOMMAND"],
  • ENV["KAMAL_VERSION"],
  • ENV["SHIPYRD_API_KEY"],
  • ENV["SHIPYRD_HOST"],
  • Commit message - The first 90 characters of your commit message git show -s --format=%s.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bin/test to run the tests. 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 the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/shipyrd/shipyrd-gem. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

Releasing a new version

The bin/release command will bump the version in the version.rb file, tag it, and push it up to github & rubygems.

bin/release 0.2.8

Code of Conduct

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