basecamp / kamal

Deploy web apps anywhere.
https://kamal-deploy.org
MIT License
9.38k stars 357 forks source link

Question about Default Configuration Merge with Destination Config #854

Closed leegeng closed 1 week ago

leegeng commented 1 week ago

Hello,

I have a question regarding the following lines of code in the Kamal configuration:

https://github.com/basecamp/kamal/blob/4697f894411af5f6e245c15c84b5073bc48edd04/lib/kamal/configuration.rb#L26-L28

It seems that when a destination is specified, it merges with the default configuration. Is there a specific reason for this merging behavior instead of simply using the config file located at the destination?

For instance, in my case, we use DigitalOcean's container registry for the production environment but Docker Hub's registry for the alpha environment. When deploying to the alpha environment, the deployment does not proceed correctly. To use the default values, I need to remove the server entry, but then it defaults to the production registry server and tries to authenticate with DigitalOcean. Conversely, if I set the server to hub.docker.com, I encounter the following error during the authentication process:

Error response from daemon: login attempt to https://hub.docker.com/v2/ failed with status: 404 Not Found

Would it not be more appropriate to replace the default configuration with the destination config if no specific reason exists for merging them? I'm curious about the rationale behind this design choice, and I would appreciate any insights you can provide.

Thank you for your time and assistance.

Best regards, Kyoungwon Lee

djmb commented 1 week ago

We merge the config because there is usually going to be more in common than different between them. In this case though the absence of a value is meaningful, so there's no way right now to signify that.

leegeng commented 1 week ago

@djmb Thank you for the response. Considering the uniqueness of the registry configuration and the fact that it’s uncommon to use different registries for development and production environments, I will go ahead and close this issue.

Thanks again.