diff --git a/frontend/.env.development b/frontend/.env.development new file mode 100644 index 000000000..531964bd7 --- /dev/null +++ b/frontend/.env.development @@ -0,0 +1 @@ +VITE_API_HOST=http://localhost:5000 \ No newline at end of file diff --git a/frontend/.env.production b/frontend/.env.production new file mode 100644 index 000000000..8270d9892 --- /dev/null +++ b/frontend/.env.production @@ -0,0 +1 @@ +VITE_API_HOST=https://basegun.fr/api/ \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 5cbb4e499..d234cc99d 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -9,9 +9,7 @@ COPY ./cert/. /etc/ssl/certs/ COPY ./package.json ./package-lock.json ./ RUN npm ci -COPY src ./src -COPY public ./public -COPY vite.config.js index.html ./ +COPY . . FROM base as dev diff --git a/frontend/nginx.conf b/frontend/nginx.conf index f72c168dc..041754761 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -15,14 +15,6 @@ http { try_files $uri $uri/ /index.html; } - location /api/ { - proxy_pass http://basegun-backend:5000/; - client_max_body_size 5M; - proxy_read_timeout 1800; - proxy_connect_timeout 1800; - proxy_send_timeout 1800; - } - error_page 404 /404.html; error_page 500 502 503 504 /50x.html; diff --git a/frontend/src/main.js b/frontend/src/main.js index e047ab461..9702a68c6 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -18,7 +18,7 @@ const pinia = createPinia() axios.defaults.withCredentials = true // the FastAPI backend -axios.defaults.baseURL = '/api/' +axios.defaults.baseURL = import.meta.env.VITE_API_HOST const app = createApp(App) diff --git a/infra/kube/helm/templates/ingress.yaml b/infra/kube/helm/templates/ingress.yaml index 9e72b1fe3..b9fb0e97a 100644 --- a/infra/kube/helm/templates/ingress.yaml +++ b/infra/kube/helm/templates/ingress.yaml @@ -1,18 +1,5 @@ {{- if .Values.ingress.enabled -}} -{{- $fullName := include "basegun.chart" . -}} -{{- $svcPort := .Values.frontend.service.port -}} -{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} - {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} - {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} - {{- end }} -{{- end }} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} kind: Ingress metadata: name: "basegun-ingress" @@ -23,9 +10,7 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: - {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} ingressClassName: {{ .Values.ingress.className }} - {{- end }} {{- if .Values.ingress.tls }} tls: {{- range .Values.ingress.tls }} @@ -41,21 +26,19 @@ spec: - host: {{ .host | quote }} http: paths: - {{- range .paths }} - - path: {{ .path }} - {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} - pathType: {{ .pathType }} - {{- end }} - backend: - {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: "basegun-frontend" - port: - number: {{ $svcPort }} - {{- else }} - serviceName: "basegun-frontend" - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} + - path: / + pathType: Prefix + backend: + service: + name: basegun-frontend + port: + number: 8080 + - path: /api/ + pathType: Prefix + backend: + service: + name: basegun-backend + port: + number: 5000 {{- end }} -{{- end }} +{{- end }} \ No newline at end of file diff --git a/infra/kube/helm/values-dso.yaml b/infra/kube/helm/values-dso.yaml index 2db767a57..60fc63777 100644 --- a/infra/kube/helm/values-dso.yaml +++ b/infra/kube/helm/values-dso.yaml @@ -34,7 +34,7 @@ backend: repository: harbor.apps.c6.numerique-interieur.com/mi-basegun-test/basegun-backend pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: feature-adapt-infra-for-dso-env + tag: 195-rediriger-vers-lapi-via-lingress-k8s imagePullSecrets: [] podAnnotations: {} podSecurityContext: {} @@ -49,7 +49,7 @@ backend: logs: repository: ghcr.io/datalab-mi/basegun/filebeat-rootless tag: 6.5.4 - pullPolicy: IfNotPresent + pullPolicy: Always service: type: ClusterIP port: 5000 @@ -86,9 +86,9 @@ frontend: replicaCount: 1 image: repository: harbor.apps.c6.numerique-interieur.com/mi-basegun-test/basegun-frontend - pullPolicy: IfNotPresent + pullPolicy: Always # Overrides the image tag whose default is the chart appVersion. - tag: feature-adapt-infra-for-dso-env + tag: 195-rediriger-vers-lapi-via-lingress-k8s imagePullSecrets: [] podAnnotations: {} podSecurityContext: {}