Deploy to Mac mini with Kamal

Deploy your Ruby on Rails applications with Kamal to a Mac mini.

I'm sure if you're a developer, or on a team with a bunch of developers you might have some old hardware laying around that's still useful. In my case, I've demoted my old M2 variant Mac mini to my "server" closet, it's been lightly-to-not used since I put it in there, but recently I decided to push some play projects to it.

That took me down the path of having an application deploy directly to it via Kamal. To set the stage its an M2 Pro, fair amount of RAM, I recently installed the hideous Tahoe upgrade and enabled the remote ssh (that's honestly the only reason I installed Tahoe).

It's running zsh and orbstack (as a docker replacement).

Some minor things I ran into:

Kamal runs ssh in non-interactive mode, as it should, so kamal setup command failed with "docker not available"

To fix this I added a ~/.zshenv file with: export PATH=/usr/local/bin:$PATH, this puts docker in the path and makes it accessible.

Then I hit the cp command issues, which I found in an older Kamal repository issue. There's a difference in the macOS and the Linux flavor of these utilities. To get around this error, we install coreutils with homebrew. (I understand there are some intricacies in the gnutools, however, this is purely a sandbox.) And then update the ~/.zshenv with another line export PATH=/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH

After overcoming these two small issues, I was able to successfully deploy (a relatively simple app) in about 10 seconds.