The simple deployment dashboard for Kamal-based deployments.
For a more detailed project and concept overview check out the initial announcement details.
There's two main steps to getting started with Shipyrd.
- Running Shipyrd as an accessory within your existing Kamal setup.
- Enable the various hooks that Kamal supports to update the deploy state in Shipyrd.
Within your Kamal accessories deploy configuration you'll need to add a new accessory for Shipyrd. Swap out the host IP address as well as the host in the example below. You'll also want to point DNS towards this server unless you already have a wildcard record pointing to your host.
The accessory configuration requires a few secrets:
SHIPYRD_HOST
- Host where Shipyrd will live.SHIPYRD_DATABASE_URL
- The MySQL database URL, in for the format ofmysql2://user:password@host:port/database
.SHIPYRD_QUEUE_DATABASE_URL
- The MySQL database URL for job queue, in for the format ofmysql2://user:password@host:port/database
.SHIPYRD_CABLE_DATABASE_URL
- The MySQL database URL for the websocket backend, in for the format ofmysql2://user:password@host:port/database
.SHIPYRD_SECRET_KEY_BASE
- Userails secret
oropenssl rand -hex 64
to generate one.SHIPYRD_ENCRYPTION_DETERMINISTIC_KEY
- Userails db:encryption:init
oropenssl rand -base64 32
to generate one.SHIPYRD_ENCRYPTION_PRIMARY_KEY
- Userails db:encryption:init
oropenssl rand -base64 32
to generate one.SHIPYRD_ENCRYPTION_KEY_DERIVATION_SALT
- Userails db:encryption:init
oropenssl rand -base64 32
to generate one.
accessories:
shipyrd:
image: shipyrd/shipyrd:v0.3.5
host: 867.530.9
proxy:
host: shipyrd.myapp.com
ssl: true
env:
secret:
- SHIPYRD_HOST
- SHIPYRD_SECRET_KEY_BASE
- SHIPYRD_ENCRYPTION_DETERMINISTIC_KEY
- SHIPYRD_ENCRYPTION_PRIMARY_KEY
- SHIPYRD_ENCRYPTION_KEY_DERIVATION_SALT
- SHIPYRD_DATABASE_URL
- SHIPYRD_QUEUE_DATABASE_URL
- SHIPYRD_CABLE_DATABASE_URL
For an overview of the information that's automatically collected with the Kamal hooks take a look at the documentation for the shipyrd gem.
With your accessory added and the SHIPYRD_*
secrets set in your .env
file for Kamal you should be able to push up your environment settings and then boot the Shipyrd accessory.
kamal env push
kamal accessory boot shipyrd
If you're upgrading you can reboot the Shipyrd accessory with kamal accessory reboot shipyrd
so that it picks up the new version
Install the Shipyrd gem:
gem install shipyrd
Next, you'll need to add the Shipyrd trigger to each hook in your Kamal setup.
If you're already using any of these hooks just place the below code in the hook at the point of success within the hook. If you're creating new hooks for all of these make sure that you make them all executable with chmod +x .kamal/hooks/pre-connect
for example.
The Shipyrd gem loads your API key from ENV['SHIPYRD_API_KEY']
automatically. You can make this available to your current shell process or use something like the dotenv
gem to automatically load the value from your .env
file.
.kamal/hooks/pre-connect
#!/usr/bin/env ruby
require 'dotenv/load'
require 'shipyrd'
Shipyrd::Client.new.trigger('pre-connect')
.kamal/hooks/pre-build
#!/usr/bin/env ruby
require 'dotenv/load'
require 'shipyrd'
Shipyrd::Client.new.trigger('pre-build')
.kamal/hooks/pre-deploy
#!/usr/bin/env ruby
require 'dotenv/load'
require 'shipyrd'
Shipyrd::Client.new.trigger('pre-deploy')
.kamal/hooks/post-deploy
#!/usr/bin/env ruby
require 'dotenv/load'
require 'shipyrd'
Shipyrd::Client.new.trigger('post-deploy')
With the triggers added to your Kamal hooks you'll now be able to see your app go through the deploy process in Shipyrd. Once a deploy completes you'll then be able to see the changes that went out with a deploy, who deployed it, when it was last deployed, how long the deploy took.
Kamal sets ENV['KAMAL_PERFORMER']
to your username on your computer via git config user.email
or whoami
, whichever it finds first. Shipyrd will instead fetch your GitHub username from your local configuration if it's set since this helps with linking over to GitHub and avatars. You can set your GitHub username in your local configuration via:
gh config get -h github.com [USERNAME]
When you're ready to upgrade to a newer version of Shipyrd it's just a matter of bumping the version in your deploy.yml file and then rebooting the accessory via Kamal.
- Change the version(
v4.0.4
) in the image reference line in your deploy.yml file.
image: shipyrd/shipyrd:v4.0.4
- Reboot the accessory via Kamal.
kamal accessory reboot shipyrd
The reboot command retains your data and just stops the container, removes the container, and starts the container with the new version. Rebooting will cause a short downtime while the new container boots up, usually just a few seconds. You can tail the logs(kamal accessory logs shipyrd
) to watch it come back online, you'll see a few healthchecks to /up and then it should start responding.
If you discover an issue, or are interested in a new feature, please open an issue. If you want to contribute code, feel free to open a pull request. If the PR is substantial, it may be beneficial to open an issue beforehand to discuss.