kamal icon indicating copy to clipboard operation
kamal copied to clipboard

[FIX] - Make kamal use ssh keys from config when executing commands

Open federicoaldunate opened this issue 1 year ago • 3 comments

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.

federicoaldunate avatar Sep 20 '24 21:09 federicoaldunate

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?

ekampp avatar Oct 03 '24 19:10 ekampp

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?

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 avatar Oct 03 '24 20:10 federicoaldunate

@federicoaldunate - thanks for the PR! I'll get this merged if you could resolve the merge conflicts first.

djmb avatar Oct 23 '24 11:10 djmb

Closed as we've merged #1229 which included these changes

djmb avatar Dec 02 '24 10:12 djmb