Support per-host SSH port configuration for servers and accessories
Hi team,
I'm trying to deploy to two different servers:
-
webgoes to VPS1, using default SSH port 22 -
accessories.dbgoes to VPS2, using custom SSH port 10234
My current deploy.yml looks like this:
servers:
web:
hosts:
- xx.xx.xx.xx
accessories:
db:
image: library/postgres:17.4
host: xx.xx.xx.xx
But I don't see a way to specify different SSH ports for each host.
Setting a global ssh.port affects all hosts, which doesn't work in this case.
Question: Does Kamal currently support this kind of setup (different SSH ports per host)? If not, could it be supported in the future?
Thanks!
It uses SSHKit under the hood, which supports per host SSH port and the code is already there, e.g: https://github.com/basecamp/kamal/blob/4b88852aea58bf94009a6d854afdc630a5c111b5/lib/kamal/cli/base.rb#L155-L159
I was checking the Accessory code and looks like it requires some refactor to allow connections via SSH using a non-default port, e.g:
https://github.com/basecamp/kamal/blob/4b88852aea58bf94009a6d854afdc630a5c111b5/lib/kamal/cli/accessory.rb#L64-L67