Hello! I have a question about self-hosting growth...
# ask-questions
b
Hello! I have a question about self-hosting growthbook with proxy We successfully deployed growthbook in Kubernetes and it's working fine, but we want to have the proxy so we can release features to our FE public apps. I have set the following environment variables in the proxy pod: • CACHE_CONNECTION_URL (set to our redis instance, works fine from what I can see in the proxy logs) • CACHE_ENGINE: redis • GROWTHBOOK_API_HOST: url of the growhbook api, which is reachable from this pod and tested with curl successfully • NODE_ENV : production • PORT : 3300 • PUBLISH_PAYLOAD_TO_CHANNEL : true • SDK_ENDPOINT : url of the growhbook api, same value as GROWTHBOOK_API_HOSTSECRET_API_KEY: value of the secret I created outside of growthbook. This exact environment variable (key and value) is also attached to the main growthbook pod as mentioned in the docs The problem I have is that on the proxy pod logs, I see the following recurring error:
Copy code
| {"level":50,"time":1742477988959,"pid":48,"hostname":"growthbook-proxy-74cdb798dc-8cwwq","msg":"connection polling error: API server unreachable"}
| {"level":50,"time":1742477988959,"pid":48,"hostname":"growthbook-proxy-74cdb798dc-8cwwq","msg":"connection polling error: no data"}
| {"level":50,"time":1742478048990,"pid":48,"hostname":"growthbook-proxy-74cdb798dc-8cwwq","msg":"connection polling error: API server unreachable"}
| {"level":50,"time":1742478048990,"pid":48,"hostname":"growthbook-proxy-74cdb798dc-8cwwq","msg":"connection polling error: no data"}
If I hit the proxy healthcheck endpoint https://growthbook-proxy.my.domain.com/healthcheck/checks , sometimes I get this result:
Copy code
{
  "ok": true,
  "proxyVersion": "1.2.1",
  "build": {
    "sha": "",
    "date": ""
  },
  "checks": {
    "apiServer": "up",
    "registrar": "connected",
    "cache:redis": "ready"
  }
}
Some other times I get this other result:
Copy code
{
  "ok": true,
  "proxyVersion": "1.2.1",
  "build": {
    "sha": "",
    "date": ""
  },
  "checks": {
    "apiServer": "down",
    "registrar": "connected",
    "cache:redis": "ready"
  }
}
Which shows the
apiServer
being down and that would explain why I see this errors on the logs, but I can't explain why I'm still able to retrieve data. Also when `apiServer`is down, the API server healthchecks tell me it's healthy🤷 I'm able to register a SDK successfully in the UI and see this result (see picture bellow) I'm also able to hit the Full API Endpoint (proxied) with an successfull 200 status. Is this regular growhtbook-proxy behaviour? if not, what I'm doing wrong here? Thank you for your help!
h
This does not seem like normal proxy behavior. Very odd that the API server health would flip-flop. The proxy health check logic for the API server looks like this:
Copy code
const resp = await fetch(ctx.growthbookApiHost + "/healthcheck");
    const data = await resp.json();
    if (data?.healthy) checks.apiServer = "up";
I wonder if you can simulate this check (perhaps inside a pod) to see if its a general k8s / istio thing, or a GB proxy issue
b
I will create a dummy pod with a python script that checks the healthcheck endpoint and see if it flips, but I doubt it since the pod healthcheck would also fail and I would receive alerts