I'm using the :client
API to connect to an external node and use code there remotely, the thing though is that I'm using Dokku for deployment and it would be really nice if I could specify a ssh key at runtime.
Right now my code looks something like this:
def start(host) do
allow_boot to_char_list(host)
{:ok, slave} = :slave.start(to_char_list(host), :slave, inet_loader_args)
load_paths(slave)
{:ok, slave}
end
inet_loader_args == ' -rsh ssh -loader inet -hosts #{master_node_ip} -setcookie #{:erlang.get_cookie}'
I've tried something like setting the -rsh argument to be "-rsh ssh -i /path/to/id_rsh"
but it seems to ignore this entirely, I'm not exactly sure how it's implemented and the Erlang docs for :client
are a little hard to understand for me (I can see it uses :ssh
underneath somewhere, and that can take a "user_dir" argument which can contain a key file, but I'm not sure how to set that from :client
)
Any ideas?
to_char_list/1
– Despatch~/.ssh/id_rsa
– Despatch-rsh
argument is passed to:os.find_executable
, which in your example would look for an executablessh -i /path/to/id_rsh
, which obviously doesn't exist. I think your best bet is to do something like-rsh /path/to/my/ssh-wrapper
and havessh-wrapper
be a shell script that doesexec ssh -i /path/to/id_rsh $@
. – Buckthorn