https://www.growthbook.io/ logo
#announcements
Title
# announcements
n

nice-painting-14163

06/06/2022, 7:30 AM
<!here> anyone deployed it with ingress in kubernetes..?? As backend and frond end are using different PORT 3000 and 3100 I am getting CORS error
f

fresh-football-47124

06/06/2022, 7:36 AM
I haven't use ingress, but I can help with the CORS errors
What do you have for APP_ORIGIN and API_HOST?
Assuming those are set correctly, CORs should go away- if you are still having them and need another way, you can set the CORS_ORIGIN_REGEX env var
a

adventurous-vase-72101

06/06/2022, 9:12 AM
n

nice-painting-14163

06/07/2022, 8:58 AM
I already checked it @fresh-football-47124 still facing the same issue Can you guide me where are we setting the back-end ..?? Back-end is running at http://localhost:3100 in development mode
is there any config file etc
I am getting this error Error connecting to the GrowthBook API at
<http://localhost:3100>
.
@fresh-football-47124
a

adventurous-vase-72101

06/07/2022, 11:47 AM
Did you set correct
appOriginName
and
apiHostName
in deployment's environment variable ? These values should be same with host names in
ingress.yaml
.
n

nice-painting-14163

06/07/2022, 12:25 PM
ok
@fresh-football-47124 Below are the values I am using
Copy code
- name: APP_ORIGIN
  value: <http://dev-growth.samsungacr.com:3000>
- name: API_HOST
  value: <http://dev-growth.samsungacr.com:3100>
f

fresh-tailor-1332

06/17/2022, 10:17 AM
@nice-painting-14163 I have the same issue, did you find a way to fix this ?
n

nice-painting-14163

06/20/2022, 8:39 AM
yeh
@fresh-tailor-1332 are you looking for kubernetes..??
Copy code
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert
  creationTimestamp: null
  labels:
    io.kompose.service: growthbook
  name: growthbook
  namespace: growth
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: growthbook
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        kompose.cmd: kompose convert
      creationTimestamp: null
      labels:
        io.kompose.service: growthbook
    spec:
      containers:
        - env:
            - name: MONGODB_URI
              value: <mongodb://root:password@mongodb:27017/>
            - name: APP_ORIGIN
              value: <http://dev-growth.samsungacr.com>
            - name: API_HOST
              value: <http://dev-api-growth.samsungacr.com>
          image: growthbook/growthbook:latest
          name: growthbook
          ports:
            - name: frontend-port
              containerPort: 3000
              protocol: TCP
            - name: backend-port
              containerPort: 3100
              protocol: TCP
          resources: {}
          volumeMounts:
            - mountPath: /usr/local/src/app/packages/back-end/uploads
              name: uploads
      restartPolicy: Always
      volumes:
        - name: uploads
          persistentVolumeClaim:
            claimName: uploads
f

fresh-tailor-1332

06/20/2022, 8:46 AM
Yes, I also had CORS issues using Ingress. CORS_ORIGIN_REGEX env var solved the issue in my case
n

nice-painting-14163

06/20/2022, 9:36 AM
Ingress.yaml
Copy code
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: Ingress
metadata:
  name: growthbook-ingress
  namespace: growth
  annotations:
    <http://kubernetes.io/ingress.class|kubernetes.io/ingress.class>: alb
    <http://external-dns.alpha.kubernetes.io/hostname|external-dns.alpha.kubernetes.io/hostname>: <http://dev-growth.samsungacr.com|dev-growth.samsungacr.com>
    <http://external-dns.alpha.kubernetes.io/aws-zone-type-public|external-dns.alpha.kubernetes.io/aws-zone-type-public>: "true"
    <http://alb.ingress.kubernetes.io/security-groups|alb.ingress.kubernetes.io/security-groups>: sg-0a2b24dbd36900ba1
    <http://alb.ingress.kubernetes.io/scheme|alb.ingress.kubernetes.io/scheme>: internet-facing
spec:
  rules:
    - host: <http://dev-growth.samsungacr.com|dev-growth.samsungacr.com>
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: growthbook
                port:
                  number: 3000
    - host: <http://dev-api-growth.samsungacr.com|dev-api-growth.samsungacr.com>
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: growthbook
                port:
                  number: 3100
I created one seprate ingress for backend too
Copy code
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: Ingress
metadata:
  name: growthbook-ingress-3100
  namespace: growth
  annotations:
    <http://kubernetes.io/ingress.class|kubernetes.io/ingress.class>: alb
    <http://external-dns.alpha.kubernetes.io/hostname|external-dns.alpha.kubernetes.io/hostname>: <http://dev-api-growth.samsungacr.com|dev-api-growth.samsungacr.com>
    <http://external-dns.alpha.kubernetes.io/aws-zone-type-public|external-dns.alpha.kubernetes.io/aws-zone-type-public>: "true"
    <http://alb.ingress.kubernetes.io/security-groups|alb.ingress.kubernetes.io/security-groups>: sg-0a2b24dbd36900ba1
    <http://alb.ingress.kubernetes.io/scheme|alb.ingress.kubernetes.io/scheme>: internet-facing
spec:
  rules:
    - host: <http://dev-api-growth.samsungacr.com|dev-api-growth.samsungacr.com>
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: growthbook
                port:
                  number: 3100
service.yaml
Copy code
apiVersion: v1
kind: Service
metadata:
  annotations:
    kompose.cmd: kompose convert
    <http://service.beta.kubernetes.io/aws-load-balancer-internal|service.beta.kubernetes.io/aws-load-balancer-internal>: 0.0.0.0/0
    <http://service.beta.kubernetes.io/aws-load-balancer-backend-protocol|service.beta.kubernetes.io/aws-load-balancer-backend-protocol>: http
    <http://external-dns.alpha.kubernetes.io/hostname|external-dns.alpha.kubernetes.io/hostname>: <http://dev-growth.na.internal.samsungacr.com|dev-growth.na.internal.samsungacr.com>
    <http://service.beta.kubernetes.io/aws-load-balancer-security-groups|service.beta.kubernetes.io/aws-load-balancer-security-groups>: sg-0a2b24dbd36900ba1
    <http://external-dns.alpha.kubernetes.io/aws-zone-type-private|external-dns.alpha.kubernetes.io/aws-zone-type-private>: "true"
  creationTimestamp: null
  labels:
    io.kompose.service: growthbook
  name: growthbook-lb
  namespace: growth
spec:
  type: LoadBalancer
  ports:
    - name: "frontend-port"
      port: 80
      targetPort: 3000
      protocol: TCP
    - name: "backend-port"
      port: 3100
      targetPort: 3100
      protocol: TCP
  selector:
    io.kompose.service: growthbook
try all these 🙂
deploy all it will work for me
👍 1
@fresh-tailor-1332
f

fresh-tailor-1332

06/23/2022, 7:27 AM
f

fresh-football-47124

06/23/2022, 9:14 AM
Thanks
34 Views