Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

federicoaldunate
Copy link
Contributor

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 federicoaldunate changed the title Make kamal use ssh keys from config when performing commands Make kamal use ssh keys from config when executing commands Sep 28, 2024
@federicoaldunate federicoaldunate changed the title Make kamal use ssh keys from config when executing commands [FIX] - Make kamal use ssh keys from config when executing commands Sep 30, 2024
@federicoaldunate federicoaldunate force-pushed the use-ssh-keys-when-executing-commands branch from 9c5c942 to 3e57e40 Compare October 3, 2024 19:37
@ekampp
Copy link

ekampp commented Oct 3, 2024

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?

@federicoaldunate
Copy link
Contributor Author

federicoaldunate commented Oct 3, 2024

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.

@djmb
Copy link
Collaborator

djmb commented Oct 23, 2024

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

@djmb
Copy link
Collaborator

djmb commented Dec 2, 2024

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

@djmb djmb closed this Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants