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

feat: support custom proxy image repository #1202

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

songjiz
Copy link

@songjiz songjiz commented Nov 7, 2024

  • Allow users to specify custom proxy image repository instead of using default basecamp/kamal-proxy
  • Help users in regions where Docker Hub access is restricted (e.g. China) to pull proxy image from cloud vendor repositories
  • Move proxy related configurations from configuration to proxy

@songjiz songjiz force-pushed the allow-config-proxy-image branch 2 times, most recently from 9fe2498 to 8425e72 Compare November 22, 2024 10:20
HTTP_PORT = 80
HTTPS_PORT = 443
LOG_MAX_SIZE = "10m"
MINIMUM_VERSION = "v0.8.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice clean up!

I was also looking at proxy configuration options, hoping too override the version with a newer one - see #1252

@dihmeetree
Copy link

dihmeetree commented Nov 27, 2024

Would love to see this get introduced/merged! Reason being; Currently Kamal Proxy doesn't have built in support for "Authenticated Origin Pulls" with Cloudflare (requires you to specify a CA Cert, etc), (which is okay.. I get it.. Kamal Proxy is designed to be simple) so I'd most likely fork Kamal Proxy for the time being, add that support, and upload it to Docker Hub or something. Being able to specify my own image would be awesome!

@jethrodaniel
Copy link

jethrodaniel commented Nov 27, 2024

I also ran into DockerHub's rate-limiting here.

My app's image is hosted on Gitlab's registry, which means that when the server tries to docker pull basecamp/kamal-proxy, it's not authenticated with DockerHub, since the docker login was for a different registry.

I've gotten around the issue by monkey-patching over this in bin/kamal:

diff --git a/bin/kamal b/bin/kamal
index cbe59b9..44f6b98 100755
--- a/bin/kamal
+++ b/bin/kamal
@@ -24,4 +24,14 @@ end
 require "rubygems"
 require "bundler/setup"
 
+#-- PATCH
+require "kamal"
+class Kamal::Configuration
+  def proxy_image
+    # "basecamp/kamal-proxy:#{PROXY_MINIMUM_VERSION}"
+    "registry.gitlab.com/myuser/myapp/kamal-proxy:#{PROXY_MINIMUM_VERSION}"
+  end
+end
+#--
+
 load Gem.bin_path("kamal", "kamal")

(and pushing a copy of the kamal-proxy image to my own registry, of course).

Official support for this would be great.

- Allow users to specify custom proxy image repository instead of using default basecamp/kamal-proxy
- Help users in regions where Docker Hub access is restricted (e.g. China) to pull proxy image from cloud vendor repositories
- Move proxy related configurations from configuration to proxy
@songjiz songjiz force-pushed the allow-config-proxy-image branch from 8425e72 to 77593f5 Compare December 4, 2024 03:24
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.

5 participants