growthbook / growthbook-proxy

:zap: GrowthBook Proxy Server - Caching, Streaming, Security, and Scalability
MIT License
25 stars 13 forks source link

Proxy container seems be reachable but never responds (reason: socket hang up) #52

Closed wax911 closed 6 months ago

wax911 commented 6 months ago

Context

I have able to interface with the growthbook container and it's API successfully, however it seems like I the the proxy container is not responding, while I can ping it successfully, running commands such curl or wget to perform a /healthcheck fails, which can also be seen as an issue in growthbook.

I've gone as far as attaching a console on the growthbook-proxy container and tried to wget http://localhost:3300/healthcheck with no success, I simply get the following: image

Configuration

GrowthBook

Environment variables

APP_ORIGIN=https://growth.docker.localhost
API_HOST=https://api.growth.docker.localhost
#NODE_ENV=production
authMechanism=SCRAM-SHA-1&retryWrites=true&w=majority'
MONGODB_URI=mongodb://admin:password@mongo/?authMechanism=DEFAULT
JWT_SECRET=jwt_secret_key
SECRET_API_KEY=secret_key
ENCRYPTION_KEY=encryption_key
EMAIL_ENABLED=false
UPLOAD_METHOD=local

PROXY_ENABLED=1
PROXY_PORT=3300
PROXY_HOST_INTERNAL=http://growthbook-proxy:3300
PROXY_HOST_PUBLIC=https://proxy.growth.docker.localhost

DASHBOARD_HOST=growth.docker.localhost
DASHBOARD_PORT=3000
DASHBOARD_API_HOST=api.growth.docker.localhost
API_PORT=3100

CERT_RESOLVER=staging
TRAEFIK_ENABLE=true

Docker

version: '3'

volumes:
  uploads:
    driver: local

services:
  growthbook:
    image: "growthbook/growthbook:2.9.0"
    container_name: growthbook
    volumes:
      - uploads:/usr/local/src/app/packages/back-end/uploads
    env_file: .env
    labels:
      - 'traefik.enable=${TRAEFIK_ENABLE}'
      - 'traefik.http.routers.growth-dashboard.rule=Host(`${DASHBOARD_HOST}`)'
      - 'traefik.http.services.growth-dashboard.loadbalancer.server.port=${DASHBOARD_PORT}'
      - 'traefik.http.routers.growth-dashboard.entrypoints=web,websecure'
      - 'traefik.http.routers.growth-dashboard.service=growth-dashboard'
      - 'traefik.http.routers.growth-dashboard.tls=true'
      - 'traefik.http.routers.growth-dashboard.tls.certresolver=${CERT_RESOLVER}'
      - 'traefik.http.routers.growth-api.rule=Host(`${DASHBOARD_API_HOST}`)'
      - 'traefik.http.services.growth-api.loadbalancer.server.port=${API_PORT}'
      - 'traefik.http.routers.growth-api.entrypoints=web,websecure'
      - 'traefik.http.routers.growth-api.service=growth-api'
      - 'traefik.http.routers.growth-api.tls=false'
      - 'traefik.http.routers.growth-api.tls.certresolver=${CERT_RESOLVER}'
    networks:
      - default
    restart: unless-stopped
    logging:
      options:
        max-size: "10m"
        max-file: "3"
    #healthcheck:
    #  test: ['CMD', 'wget', 'http://localhost:${API_PORT}']
    #  interval: 20s
    #  timeout: 5s
    #  retries: 3
    #  start_period: 10s

networks:
  default:
    name: traefik
    external: true

image

GrowthBook Proxy

Environment variables

GROWTHBOOK_API_HOST=http://growthbook:3100
SECRET_API_KEY=secret_key
USE_HTTP2=true # tried toggling this back and forth makes no difference

PROXY_HOST=proxy.growth.docker.localhost
PROXY_PORT=3300

VERBOSE_DEBUGGING=true
CACHE_ENGINE=memory
#The URL of your cache engine e.g. Redis or Mongo Database
#CACHE_CONNECTION_URL=''
CACHE_STALE_TTL=60
CACHE_EXPIRES_TTL=600

CERT_RESOLVER=staging
TRAEFIK_ENABLE=true

Docker

version: '3'

services:
  proxy:
    container_name: "growthbook-proxy"
    image: "growthbook/proxy:git-e08a1b2"
    env_file: .env
    networks:
      - default
    labels:
      - 'traefik.enable=${TRAEFIK_ENABLE}'
      - 'traefik.http.routers.growth-proxy.rule=Host(`${PROXY_HOST}`)'
      - 'traefik.http.services.growth-proxy.loadbalancer.server.port=${PROXY_PORT}'
      - 'traefik.http.routers.growth-proxy.entrypoints=web,websecure'
      - 'traefik.http.routers.growth-proxy.service=growth-proxy'
      - 'traefik.http.routers.growth-proxy.tls=false'
      - 'traefik.http.routers.growth-proxy.tls.certresolver=${CERT_RESOLVER}'
    restart: unless-stopped
    logging:
      options:
        max-size: "10m"
        max-file: "3"
    healthcheck:
      test: ['CMD', 'curl', '-f', 'http://localhost:${PORT}/healthcheck']
      interval: 20s
      timeout: 5s
      retries: 3
      start_period: 10s

networks:
  default:
    name: traefik
    external: true

Container logs: image

wax911 commented 6 months ago

So I decided to take another shot at this and voila: USE_HTTP2=true was the culprit