diff --git a/API/.dockerignore b/API/.dockerignore new file mode 100644 index 0000000..329ed4e --- /dev/null +++ b/API/.dockerignore @@ -0,0 +1,4 @@ +.venv +k8s +.idea +.env \ No newline at end of file diff --git a/API/app/main.py b/API/app/main.py index 2207555..55181ac 100644 --- a/API/app/main.py +++ b/API/app/main.py @@ -22,7 +22,7 @@ def start_app(): api_app.add_middleware( CORSMiddleware, - allow_origins=["http://localhost:5173"], + allow_origins=["https://api.numerum.team", "https://numerum.team", "http://localhost:5173"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], diff --git a/API/k8s/helm/teamfolio-api/templates/deployment.yaml b/API/k8s/helm/teamfolio-api/templates/deployment.yaml index 9778621..381a9b1 100644 --- a/API/k8s/helm/teamfolio-api/templates/deployment.yaml +++ b/API/k8s/helm/teamfolio-api/templates/deployment.yaml @@ -24,6 +24,11 @@ spec: secretKeyRef: name: teamfolio-api-secret key: SECRET_KEY + - name: DATABASE_URL + valueFrom: + secretKeyRef: + name: teamfolio-api-secret + key: DATABASE_URL volumeMounts: - name: uploads-volume mountPath: {{ .Values.persistence.uploads.containerPath }} diff --git a/WEB/.dockerignore b/WEB/.dockerignore new file mode 100644 index 0000000..593eedb --- /dev/null +++ b/WEB/.dockerignore @@ -0,0 +1,7 @@ +node_modules +npm-debug.log +build +.dockerignore +.git +k8s +.env \ No newline at end of file diff --git a/WEB/.gitignore b/WEB/.gitignore index 7211af5..f088a92 100644 --- a/WEB/.gitignore +++ b/WEB/.gitignore @@ -23,3 +23,5 @@ dist-ssr *.sln *.sw? */.vscode/* + +.env diff --git a/WEB/Dockerfile b/WEB/Dockerfile new file mode 100644 index 0000000..da3a794 --- /dev/null +++ b/WEB/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.numerum.team +RUN npm run build + +FROM node:20-alpine + +WORKDIR /app + +RUN npm install -g serve + +COPY --from=builder /app/dist /app + +EXPOSE 3000 + +CMD ["serve", "-s", ".", "-l", "3000"] \ No newline at end of file diff --git a/WEB/k8s/helm/teamfolio-web/Chart.yaml b/WEB/k8s/helm/teamfolio-web/Chart.yaml new file mode 100644 index 0000000..81bc2f7 --- /dev/null +++ b/WEB/k8s/helm/teamfolio-web/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: teamfolio-web-app +description: teamfolio WEB project +version: 0.1.0 +appVersion: "1.0" \ No newline at end of file diff --git a/WEB/k8s/helm/teamfolio-web/templates/deployment.yaml b/WEB/k8s/helm/teamfolio-web/templates/deployment.yaml new file mode 100644 index 0000000..3f5bd9c --- /dev/null +++ b/WEB/k8s/helm/teamfolio-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/k8s/helm/teamfolio-web/templates/ingress.yaml b/WEB/k8s/helm/teamfolio-web/templates/ingress.yaml new file mode 100644 index 0000000..da2c7ec --- /dev/null +++ b/WEB/k8s/helm/teamfolio-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/k8s/helm/teamfolio-web/templates/service.yaml b/WEB/k8s/helm/teamfolio-web/templates/service.yaml new file mode 100644 index 0000000..67b1eb9 --- /dev/null +++ b/WEB/k8s/helm/teamfolio-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/k8s/helm/teamfolio-web/values.yaml b/WEB/k8s/helm/teamfolio-web/values.yaml new file mode 100644 index 0000000..89944d8 --- /dev/null +++ b/WEB/k8s/helm/teamfolio-web/values.yaml @@ -0,0 +1,23 @@ +replicaCount: 1 + +image: + repository: archi341/teamfolio-web + tag: latest + pullPolicy: Always + +service: + type: ClusterIP + port: 3000 + +resources: + limits: + memory: 512Mi + cpu: 500m + +ingress: + secretTLSName: teamfolio-web-tls-secret + + domain: numerum.team + + path: / + pathType: Prefix diff --git a/WEB/src/core/config.js b/WEB/src/core/config.js index fb32220..965cb9f 100644 --- a/WEB/src/core/config.js +++ b/WEB/src/core/config.js @@ -1,5 +1,5 @@ const CONFIG = { - BASE_URL: "http://127.0.0.1:8000", + BASE_URL: import.meta.env.VITE_BASE_URL || "http://127.0.0.1:8000", }; export default CONFIG;