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

false boolean proxy option errors out in in Kamal 2 #956

Closed
jeromedalbert opened this issue Sep 20, 2024 · 1 comment · Fixed by #978
Closed

false boolean proxy option errors out in in Kamal 2 #956

jeromedalbert opened this issue Sep 20, 2024 · 1 comment · Fixed by #978

Comments

@jeromedalbert
Copy link
Contributor

jeromedalbert commented Sep 20, 2024

When configuring Kamal 2's deploy.yml with a false boolean option in the proxy section, kamal-proxy errors out during deploy.

Steps to repro

Deploy a Rails main app (8.0.0.alpha) with the following in config/deploy.yml:

proxy:
  ssl: false

Expected behavior

Deploy is successful.

Actual behavior

Deploy fails for the following step:

docker exec kamal-proxy kamal-proxy deploy myapp-web-production --target "44d4737d819c:80" --tls "false" --deploy-timeout "30s" --drain-timeout "30s" --buffer-requests --buffer-responses --log-request-header "Cache-Control" --log-request-header "Last-Modified" --log-request-header "User-Agent"

The error is: Error: accepts 1 arg(s), received 2.

Details

The error happens because --tls "false" (or --tls false) can't be parsed by kamal-proxy. It seems to be currently set up to only accept --tls alone, meaning that TLS is true. If you don't want TLS, it seems like --tls should be skipped altogether.

I don't know enough Go and Cobra to know whether kamal-proxy itself can (or should) be fixed to somehow understand --tls false.

Otherwise the fix would be on the Kamal side. Looks like lib/kamal/commands/app/proxy.rb calls deploy_command_args which optionizes the deploy_options. The way optionize is currently implemented for false booleans is incompatible with kamal-proxy's expected boolean options.

Workaround

Comment out ssl: false in config/deploy.yml.

@jeromedalbert jeromedalbert changed the title False boolean proxy options errors out in in Kamal 2 beta false boolean proxy option errors out in in Kamal 2 beta Sep 20, 2024
@jeromedalbert jeromedalbert changed the title false boolean proxy option errors out in in Kamal 2 beta false boolean proxy option errors out in in Kamal 2 Sep 20, 2024
@Stavrospanakakis
Copy link

@jeromedalbert To ensure the Proxy works correctly, the flag has to be specified as --tls=true|false instead of --tls true|false. This behavior is mentioned on a GitHub issue on the Cobra repository spf13/cobra#613.

Given this, it will probably have to be fixed on the Kamal, not the Proxy side.

Unfortunately, I’m not very familiar with Ruby, so I can’t provide more specific details in this context. However, since I encountered a similar issue with Go's Cobra, I wanted to share this insight in case it helps.

djmb added a commit that referenced this issue Sep 26, 2024
@djmb djmb closed this as completed in #978 Sep 26, 2024
kpumuk pushed a commit to kpumuk/kamal that referenced this issue Sep 29, 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 a pull request may close this issue.

2 participants