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

Proxy ConfigCat config in caddy #12739

Closed
geropl opened this issue Sep 7, 2022 · 2 comments · Fixed by #12756
Closed

Proxy ConfigCat config in caddy #12739

geropl opened this issue Sep 7, 2022 · 2 comments · Fixed by #12756
Assignees
Labels
component: proxy type: improvement Improves an existing feature or existing code

Comments

@geropl
Copy link
Member

geropl commented Sep 7, 2022

Currently, we're using ConfigCat client libraries from a wide variety of environments. All those clients periodically go to https://configcat.com/ and fetch the config from there directly.

Now Team IDE plans to/already uses ConfigCat to rollout features of with different lifecycles then the rest of Gitpod (delivered via marketplace to clients with different upgrade strategies vs. single version of Gitpod delivered to SaaS/Self-Hosted).

We see multiple problems with this:

  • number of requests: We're on a certain plan with ConfigCat, and are close to/already exceeding their "number of requests" limits. So far this was not an issue, because we had close control over all clients, and could tweak the polling behavior. This changes when we use ConfigCat from clients with longer lifecycles that are not under our control.
  • scaling to more clients: so far, we taught all clients to tell Self-Hosted and SaaS apart. It would be nice to centralize this behavior
  • access to ConfigCat API: so far we had to build ConfigCat keys into multiple docker images (depending on client and runtime).

The proposed solution:

  • installation-specific ConfigCat proixy: create a path in the caddy-powered proxy component that delivers the config.json file
  • if there is not ConfigCat API key configured (Self-Hosted), this returns an empty JSON object (for now)
  • if there is a ConfigCat API key (SaaS): go to ConfigCat at a certain interval, fetch the config.json from there and cache it locally to respond to all requests
  • point all clients to this installation specific path

@mustard-mh @easyCZ

@geropl geropl added type: improvement Improves an existing feature or existing code component: proxy labels Sep 7, 2022
@geropl
Copy link
Member Author

geropl commented Sep 7, 2022

BTW here's an example of a Caddy plugin in our codebase:

func (m HeadlessLogDownload) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error {

@easyCZ
Copy link
Member

easyCZ commented Sep 8, 2022

The URL for the config is https://cdn-global.configcat.com/configuration-files/<PUBLIC_API_KEY>/config_v5.json

I believe the client library understands etag and 302 responses which should be used in case the config has not changed since the last etag (etag is used as a hash of the contents more-less)

@mustard-mh mustard-mh self-assigned this Sep 8, 2022
@mustard-mh mustard-mh mentioned this issue Sep 8, 2022
2 tasks
@mustard-mh mustard-mh moved this to In Progress in 🚀 IDE Team Sep 8, 2022
Repository owner moved this from In Progress to Done in 🚀 IDE Team Sep 9, 2022
@roboquat roboquat moved this to Done in 🍎 WebApp Team Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: proxy type: improvement Improves an existing feature or existing code
Projects
Status: Done
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants