How I wrote Kamal Handbook in 5 weeks and sold 300+ copies at the same time
I unexpectedly wrote a second book. And I unexpectedly sold 300 copies while making it.IdeaThe idea of Kamal Handbook came after spending more time deploying with the tool and seeing my Kamal blog post...
View ArticleRunning Thruster with Rails and Kamal
Thruster is a new zero config proxy from 37signals. Here’s how to add it to an existing Rails projects deployed with Kamal.Thruster and KamalThruster solves 4 things as a proxy for Puma:HTTP/2...
View ArticleBusiness Class 1.7: On the way to Rails 8
Here’s how Business Class 1.7 aligns itself with future Rails 8.Rails 8 alignmentRails 8 development only just started but Business Class 1.7 comes with most of distinguish Rails 8 defauls...
View ArticleAutomating PostgreSQL backups to Digital Ocean Spaces with Kamal
Here’s a short tutorial on how I set up automated PostgreSQL backups to a DO Spaces bucket with Kamal.PostgreSQL backupsIf you are like me, you found yourself deploying PostgreSQL databases to Digital...
View ArticleImplementing dark mode with Tailwind and Stimulus
About to implement a dark mode into your Rails app? Here’s one way using Tailwind and Stimulus.Dark modeDark mode can be automatic based on system settings or manual based on user action.The preference...
View ArticleUnderstanding Kamal healthcheck settings
Here’s what you should know about Kamal healthchecks, namely the Docker healthcheck and the new Kamal 1.6 web barrier.Docker healthcheckEvery running Docker container can come with a healthcheck. A...
View ArticleA very first update to Kamal Handbook
Kamal Handbook gets updated for Kamal 1.7.3Kamal 1.7.3Kamal Handbook was released 3 months ago just, around the time of Kamal 1.4, but Kamal improves fast and so I made an update targeting the latest...
View ArticleIntroduction to Minitest Mocks
Test doubles likes mocks and stubs can help us with isolating code under test with the rest of the system. Here’s how to mock in Minitest.MocksMocks are usually small handcrafted objects that are ready...
View ArticleAvoiding environment conflicts with Kamal and Dotenv
We often use Dotenv in Rails for managing environment variables in development. But both Kamal and Dotenv works with .env files by default. Let’s see how to solve this conflict.Environment conflictsWe...
View ArticleA brief look at the new Kamal Proxy replacing Traefik
Kamal 2 is coming with a brand new custom proxy that’s replacing Traefik. Let’s have a look at why is that and what it means.Why Kamal needs a proxyKamal is a simple deployment tool built around Docker...
View ArticleUpgrading from Kamal 1 to Kamal 2
Here’s some possible steps to take and notes from upgrading a single server Kamal setup to the new Kamal 2.1. Upgrade to Kamal 1.9.xFirst upgrade to Kamal 1.9 and confirm you can still deploy:$ gem...
View ArticleRunning multiple apps on a single server with Kamal 2
Kamal 2 finally brings the most requested feature to reality and allows people to run multiple applications simultaneously on a single server. Here’s how.The Kamal wayKamal is an application-centric...
View ArticleDeploying a Next.js application with Kamal 2
Here’s the simplest example to deploy a containerized Next application with Kamal.What’s KamalKamal is a new tool from 37signals for deploying web applications to bare metal and cloud VMs. It comes...
View ArticleA closer look at Rails force_ssl and assume_ssl
Rails comes with a built-in support for SSL in form of config.force_ssl. But what does it exactly do?SSL middlewareThe force_ssl directive adds the ActionDispatch::SSL middleware layer which is a Rack...
View ArticleUnderstanding Kamal proxy roles
Kamal’s configuration comes with one primary proxy role to accept HTTP traffic. Here’s how to think about proxy roles and how to configure others.Kamal rolesRoles are a Kamal way to split application...
View ArticleShow all running apps on the server with Kamal
Kamal 2 can deploy multiple apps on a single server so it’s easy to lose track of what’s deployed. This alias will fix it.To see all running apps on a server we need to query Kamal Proxy:$ ssh...
View ArticleSubclassing STI models in Rails
Here’s a short tip on opting out a specific model from Single Table Inheritance (STI).Imagine a Vehicle model which is implemented using STI and extented with a type parameter to Sedan and Wagon...
View ArticleUsing non-root users in Kamal
Kamal gives us an option to connect with a non-root user, but how can we create it?Creating a non-root userIf you use cloud VM providers like Hetzner or Digital Ocean, your virtual private server with...
View ArticleTest Driving Rails, 1st edition is released!
I am releasing my third book today. This time about Rails-native testing!IdeaI am a big fan of Rails defaults and especially those for testing. Minitest and fixtures rock! But all I ever see are posts...
View ArticleHow does Kamal deploy to multiple hosts
How does Kamal deploy to multiple hosts at once? And how to configure it?SSHKitKamal is built around SSHKit which provides Kamal with the SSH connections to issue remote commands. Through out the Kamal...
View Article