<!here> anyone deployed it with ingress in kuberne...
# announcements
n
<!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
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
n
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
Did you set correct
appOriginName
and
apiHostName
in deployment's environment variable ? These values should be same with host names in
ingress.yaml
.
n
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
@nice-painting-14163 I have the same issue, did you find a way to fix this ?
n
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
Yes, I also had CORS issues using Ingress. CORS_ORIGIN_REGEX env var solved the issue in my case
n
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
f
Thanks