diff --git a/api/app/main.py b/api/app/main.py index d3ca1e5..e80003f 100644 --- a/api/app/main.py +++ b/api/app/main.py @@ -23,7 +23,7 @@ def start_app(): api_app.add_middleware( CORSMiddleware, - allow_origins=['https://api.visus.numerum.team', 'http://localhost:5173'], + allow_origins=['https://api.visus.numerum.team', 'https://visus.numerum.team', 'http://localhost:5173'], allow_credentials=True, allow_methods=['*'], allow_headers=['*'], diff --git a/web-app/.dockerignore b/web-app/.dockerignore new file mode 100644 index 0000000..6c26e73 --- /dev/null +++ b/web-app/.dockerignore @@ -0,0 +1,6 @@ +node_modules +npm-debug.log +build +.dockerignore +.git +k8s \ No newline at end of file diff --git a/web-app/Dockerfile b/web-app/Dockerfile new file mode 100644 index 0000000..7f74ad8 --- /dev/null +++ b/web-app/Dockerfile @@ -0,0 +1,25 @@ +FROM node:20-alpine AS builder + +WORKDIR /app + +COPY package.json package-lock.json ./ + +RUN npm install + +COPY . . + +ARG VITE_BASE_URL +ENV VITE_BASE_URL=https://api.visus.numerum.team/api/v1/ +RUN npm run build + +FROM node:20-alpine + +WORKDIR /app + +RUN npm install -g serve + +COPY --from=builder /dist /app + +EXPOSE 3000 + +CMD ["serve", "-s", ".", "-l", "3000"] \ No newline at end of file diff --git a/web-app/k8s/helm/visus-web/Chart.yaml b/web-app/k8s/helm/visus-web/Chart.yaml new file mode 100644 index 0000000..ffff024 --- /dev/null +++ b/web-app/k8s/helm/visus-web/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: visus-web-app +description: Visus WEB project +version: 0.1.0 +appVersion: "1.0" \ No newline at end of file diff --git a/web-app/k8s/helm/visus-web/templates/deployment.yaml b/web-app/k8s/helm/visus-web/templates/deployment.yaml new file mode 100644 index 0000000..3f5bd9c --- /dev/null +++ b/web-app/k8s/helm/visus-web/templates/deployment.yaml @@ -0,0 +1,22 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Chart.Name }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ .Chart.Name }} + template: + metadata: + labels: + app: {{ .Chart.Name }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: {{ .Values.service.port }} + resources: + {{- toYaml .Values.resources | nindent 12 }} \ No newline at end of file diff --git a/web-app/k8s/helm/visus-web/templates/ingress.yaml b/web-app/k8s/helm/visus-web/templates/ingress.yaml new file mode 100644 index 0000000..da2c7ec --- /dev/null +++ b/web-app/k8s/helm/visus-web/templates/ingress.yaml @@ -0,0 +1,23 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: visus-api-ingress + annotations: + cert-manager.io/cluster-issuer: lets-encrypt +spec: + tls: + - hosts: + - {{ .Values.ingress.domain }} + secretName: {{ .Values.ingress.secretTLSName }} + ingressClassName: public + rules: + - host: {{ .Values.ingress.domain }} + http: + paths: + - path: {{ .Values.ingress.path }} + pathType: {{ .Values.ingress.pathType }} + backend: + service: + name: {{ .Chart.Name }}-service + port: + number: {{ .Values.service.port }} diff --git a/web-app/k8s/helm/visus-web/templates/secrets-example.yaml b/web-app/k8s/helm/visus-web/templates/secrets-example.yaml new file mode 100644 index 0000000..bd58ee5 --- /dev/null +++ b/web-app/k8s/helm/visus-web/templates/secrets-example.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: visus-api-secret +type: Opaque +data: + SECRET_KEY: + DATABASE_URL: diff --git a/web-app/k8s/helm/visus-web/templates/service.yaml b/web-app/k8s/helm/visus-web/templates/service.yaml new file mode 100644 index 0000000..67b1eb9 --- /dev/null +++ b/web-app/k8s/helm/visus-web/templates/service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Chart.Name }}-service +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.port }} + selector: + app: {{ .Chart.Name }} \ No newline at end of file diff --git a/web-app/k8s/helm/visus-web/values.yaml b/web-app/k8s/helm/visus-web/values.yaml new file mode 100644 index 0000000..adc3d68 --- /dev/null +++ b/web-app/k8s/helm/visus-web/values.yaml @@ -0,0 +1,23 @@ +replicaCount: 1 + +image: + repository: andreiduvakin/visus-web + tag: latest + pullPolicy: Always + +service: + type: ClusterIP + port: 3000 + +resources: + limits: + memory: 512Mi + cpu: 500m + +ingress: + secretTLSName: visus-web-tls-secret + + domain: visus.numerum.team + + path: / + pathType: Prefix diff --git a/web-app/src/Components/Pages/LoginPage/LoginPage.jsx b/web-app/src/Components/Pages/LoginPage/LoginPage.jsx index 9cd81c0..861a323 100644 --- a/web-app/src/Components/Pages/LoginPage/LoginPage.jsx +++ b/web-app/src/Components/Pages/LoginPage/LoginPage.jsx @@ -7,6 +7,7 @@ const {Title} = Typography; const LoginPage = () => { const {error} = useSelector((state) => state.auth); + const {onFinish, isLoading} = useLoginPage(); const {containerStyle, formContainerStyle, titleStyle, errorStyle, labels} = useLoginPageUI(); diff --git a/web-app/src/Components/Pages/LoginPage/useLoginPage.js b/web-app/src/Components/Pages/LoginPage/useLoginPage.js index 15106ff..3c6f82d 100644 --- a/web-app/src/Components/Pages/LoginPage/useLoginPage.js +++ b/web-app/src/Components/Pages/LoginPage/useLoginPage.js @@ -21,6 +21,7 @@ const useLoginPage = () => { await dispatch(checkAuth()).unwrap(); } catch (error) { const errorMessage = error?.data?.detail || "Не удалось войти"; + console.error(error); dispatch(setError(errorMessage)); notification.error({ message: "Ошибка при входе",