On Kamal

As mentioned in previous posts, I’ve been playing around with Rails 8 and trying to familiarize myself with all the new things it has to offer.

One of the new features that Rails 8 offers out of the box is Kamal, the idea behind it is that you can chuck your Rails application in a container, push it to a container registry and deploy it on a cloud / bare metal instance that you have access to.

In terms of the ease of use, it was really great! There’s a tutorial video that explains Kamal and how to perform the deployment. I gave it a watch and set about deploying my application. There were a few hitches I ran into along the way:

  • If you have host or hosts setup for your proxy configuration, kamal-proxy will only route requests to your application if the request is intended for that host
  • I had an interesting issue with the DNS cache on Firefox lasting a lot longer than I expected (I tried everything I can on this front, disabling DoH, clearing Firefox’s DNS cache) but the DNS was still resolving to an older entry. On my Mac when using nslookup or Chrome, accessing the site resolved to the intended server but it persisted on Firefox.

Once the DNS problem subsided (just needed to outlive the TTL), my site was accessible from Firefox! For my use case as a developer working on an application where I don’t expect to see a lot of traffic (I don’t need to think about load balancing or horizontal/vertical scaling), what we got out of the box was great! It really cut down on the time that you would usually take in order to achieve the same thing.

So for the Rails developer out there, if you have not tried Kamal yet, do give it a try!