Kamal - Configure a remote builder
If you're on macOS, especially M1, M2, M3... (Apple Silicon), you may have to use a remote builder or your build process may fail.
A remote builder is just a server that builds your app for you, instead of doing the build work in your local machine. You send your code to the remote builder, and it produces the deployeable Docker image.
This is useful, for example, in case your local development machine is too slow building, and you want to speed things up.
It may also me something you need to to if you're on macOS.
The newest macOS machines (the Apple Silicon family: M1, M2, M3, etc.) may find issues with Docker (the underlying technology Kamal uses for building and deploying your app); this is fully solvable if you use a remote builder instead of your local Mac for building.
How to set up a remote builder server in Kamal
Setting up a remote builder couldn't be easier: just spin up a new server on Hetzner exactly as you did on the Quickstart. In a nutshell: select a server and a location, add your SSH key, no need for backups this time, and in the Cloud Config box, paste this:
#cloud-config
runcmd:
- bash -lc 'set -euo pipefail; wget -qO /root/railsfast-setup.sh https://setup.railsfast.com; chmod +x /root/railsfast-setup.sh; /root/railsfast-setup.sh 2>&1 | tee -a /var/log/railsfast-setup.log && reboot'
Create the server and wait for the setup script to finish as described in the Quickstart.
Then, in your deploy.yml file, uncomment the remote builder machine section under the builder key:
builder:
arch: amd64
# Uncomment this:
local: false
remote: ssh://[email protected]
args:
RUBY_VERSION: 3.4.7
secrets:
- RAILS_MASTER_KEY
And change the placeholder 5.6.7.8 IP for the actual IP of the server you've just created.
That's it! Try deploying with kamal deploy now and your setup will use the remote builder for building, instead of your local machine.