[FIX] - Make kamal use ssh keys from config when executing commands
When using the SSH keys options, commands are being executed without applying these options.
We should consider these commands to ensure they can run properly.
Example: The command
kamal app exec -i 'bin/rails console'
was not using the -i path_to_key.pem option for execution.
Have you tried with the --interactive and --reuse arguments? As used in the deploy alias config option.
# Aliases are triggered with "bin/kamal <alias>". You can overwrite arguments on invocation:
# "bin/kamal logs -r job" will tail logs from the first server in the job section.
aliases:
console: app exec --interactive --reuse "bin/rails console"
shell: app exec --interactive --reuse "bash"
logs: app logs -f
dbc: app exec --interactive --reuse "bin/rails dbconsole"
Perhaps this is fixable in documentation instead?
Have you tried with the
--interactiveand--reusearguments? As used in the deploy alias config option.# Aliases are triggered with "bin/kamal <alias>". You can overwrite arguments on invocation: # "bin/kamal logs -r job" will tail logs from the first server in the job section. aliases: console: app exec --interactive --reuse "bin/rails console" shell: app exec --interactive --reuse "bash" logs: app logs -f dbc: app exec --interactive --reuse "bin/rails dbconsole"Perhaps this is fixable in documentation instead?
The thing is every kamal app exec will run on ssh, and if the user doesn't have the config ~/.ssh/config set, then the command will fail.
Even if the user has keys set up.
@federicoaldunate - thanks for the PR! I'll get this merged if you could resolve the merge conflicts first.
Closed as we've merged #1229 which included these changes