Skip to content
Snippets Groups Projects
Commit ac99daf1 authored by derrabauke's avatar derrabauke
Browse files

tried to connect the client with backend

- via env vars but it seems to be hard in minikube enviroment
parent bdd38af5
No related branches found
No related tags found
No related merge requests found
...@@ -7,12 +7,13 @@ WORKDIR /usr/src/app ...@@ -7,12 +7,13 @@ WORKDIR /usr/src/app
COPY package*.json ./ COPY package*.json ./
ENV PATH /usr/src/app/node_modules/.bin:$PATH ENV PATH /usr/src/app/node_modules/.bin:$PATH
ENV API_URL backend://backend:3002
RUN npm install --silent RUN npm install --silent
COPY . . COPY . .
RUN npm run build RUN API_URL=$API_URL node scripts/build.js
# Put this stuff into a nginx server # Put this stuff into a nginx server
FROM nginx:latest FROM nginx:latest
......
...@@ -33,6 +33,9 @@ spec: ...@@ -33,6 +33,9 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }} {{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }} imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: API_URL
value: "{{ .Values.backendName}}://{{ .Values.backendName }}:{{ .Values.backendPort }}"
ports: ports:
- name: http - name: http
containerPort: 80 containerPort: 80
......
...@@ -3,12 +3,13 @@ ...@@ -3,12 +3,13 @@
# Declare variables to be passed into your templates. # Declare variables to be passed into your templates.
replicaCount: 1 replicaCount: 1
backendName: "backend"
backendPort: "3002"
image: image:
repository: client # !Change this to the actual image repository: client # !Change this to the actual image
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion. # Overrides the image tag whose default is the chart appVersion.
tag: "v0.0.1" tag: "v0.0.2"
imagePullSecrets: [] imagePullSecrets: []
nameOverride: "" nameOverride: ""
...@@ -41,13 +42,16 @@ service: ...@@ -41,13 +42,16 @@ service:
port: 80 port: 80
ingress: ingress:
enabled: false enabled: true
annotations: {} annotations: {}
# kubernetes.io/ingress.class: nginx # kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true" # kubernetes.io/tls-acme: "true"
hosts: hosts:
- host: chart-example.local - host: backend
paths: [] paths:
- path: /api
backend:
fullName: "backend"
tls: [] tls: []
# - secretName: chart-example-tls # - secretName: chart-example-tls
# hosts: # hosts:
......
This diff is collapsed.
...@@ -141,7 +141,8 @@ function build(previousFileSizes) { ...@@ -141,7 +141,8 @@ function build(previousFileSizes) {
); );
console.log(); console.log();
} }
console.log("THIS IS THE API URL")
console.log(process.env.API_URL)
console.log('Creating an optimized production build...'); console.log('Creating an optimized production build...');
const compiler = webpack(config); const compiler = webpack(config);
......
import axios from 'axios' import axios from 'axios'
const axiosInstance = axios.create({ const axiosInstance = axios.create({
baseURL: process.env.PUBLIC_URL, baseURL: process.env.API_URL,
withCredentials: true, withCredentials: true,
}); });
...@@ -16,7 +16,7 @@ axiosInstance.interceptors.response.use( ...@@ -16,7 +16,7 @@ axiosInstance.interceptors.response.use(
); );
export const signout = () => { export const signout = () => {
return axiosInstance.post(process.env.PUBLIC_URL + '/logout').then(user => { return axiosInstance.post('/logout').then(user => {
// delete axiosInstance.defaults.headers.common["Authorization"]; // delete axiosInstance.defaults.headers.common["Authorization"];
return user.data return user.data
}) })
...@@ -93,4 +93,4 @@ export const deleteTodo = (_id) => { ...@@ -93,4 +93,4 @@ export const deleteTodo = (_id) => {
}).then(todo => { }).then(todo => {
return todo return todo
}) })
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment