3 min read

Running kamal commands on your servers with Shipyrd

It’s now possible to run manual one-off kamal commands on your server via Shipyrd!

Once you’ve booted shipyrd and pinged it from your app you’ll see your application within Shipyrd(Scan And Then is a demo app I'm using for this blog post). Clicking the application name then takes you to the application edit page. If you haven’t already you’ll want to populate your repository URL so that Shipyrd knows where to fetch the deploy recipe from. From there you can click “Connect to GitHub”.

Once you’re on the “Connect to GitHub” page you’ll see an overview of how to create the access token for Shipyrd. Shipyrd utilizes the content permission to fetch config/deploy.yml(and any matching destination deploy.yml files) which it subsequently uses whenever you run a command in Shipyrd. In the future there’s also plans to create deployment records in GitHub via Shipyrd which is where the deployment permission comes from.

Once the GitHub connection is configured it’ll automatically import your deploy recipes for Kamal. When Shipyrd imports your deploy recipes it stores a copy alongside the specific destination and then processes the recipe to create new server records for that destination.

With the GitHub connection created you can now view your destination by clicking “View” within the destinations list below.

From here you’ll notice that your Kamal recipe has been imported along with some additional instructions to grant SSH access to Shipyrd for your servers. Shipyrd generates an SSH key pair for each destination within Shipyrd, the command outlined pushes the public key from that pair up to your destination servers.

Once you’ve run that command locally to push up Shipyrd’s public key then you’re ready to run a command on that destination.

The command runner in Shipyrd currently supports non-interactive commands only. Commands like lock status, app logs, app details, accessory details, etc. (There’s plans to add support for interactive commands in the future though)

A great first command to run just to verify everything is working correctly is lock status. If you haven’t used it before it just checks to see if there’s a deploy lock on your server.

Yay! We can even inspect our own logs via the runner with accessory logs shipyrd

Give the new command runner a whirl and if you have any feedback/requests feel free to shoot me an email or post on the issues page on GitHub. Also, hopefully you enjoy the facelift from Bulma, it was finally time to spruce it up a bit more.