From 11793c71d4c9d2abfc2ff6fe3ab37bb53eb90e96 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 24 Apr 2026 13:16:32 +0500 Subject: [PATCH] ++ --- apps/django/base/frontend-deployment.yaml | 12 +++ apps/django/base/nginx-configmap.yaml | 107 +++++++++++++++++++++ apps/pm/base/backend-service.yaml | 2 +- apps/processing/base/frontend-service.yaml | 2 +- apps/workspaces/base/frontend-service.yaml | 2 +- 5 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 apps/django/base/nginx-configmap.yaml diff --git a/apps/django/base/frontend-deployment.yaml b/apps/django/base/frontend-deployment.yaml index 713eaa7..a201e4b 100644 --- a/apps/django/base/frontend-deployment.yaml +++ b/apps/django/base/frontend-deployment.yaml @@ -16,6 +16,14 @@ spec: labels: app: frontend spec: + volumes: + - name: nginx-configmap + configMap: + name: nginx-configmap + items: + - key: nginx.conf + path: nginx.conf + defaultMode: 420 containers: - name: frontend image: cr.yandex/crp3ccidau046kdj8g9q/sarex-frontend-dev:contour_0b579274 @@ -28,5 +36,9 @@ spec: requests: cpu: 100m memory: 100Mi + volumeMounts: + - name: nginx-configmap + mountPath: /etc/nginx/nginx.conf + subPath: nginx.conf imagePullSecrets: - name: regcred diff --git a/apps/django/base/nginx-configmap.yaml b/apps/django/base/nginx-configmap.yaml new file mode 100644 index 0000000..1b9adf8 --- /dev/null +++ b/apps/django/base/nginx-configmap.yaml @@ -0,0 +1,107 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-configmap + namespace: django +data: + nginx.conf: | + worker_processes auto; + + pid /var/run/nginx.pid; + + events { + use epoll; + worker_connections 1024; + } + + http { + + # Basic Settings + large_client_header_buffers 8 128k; + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 300; + types_hash_max_size 2048; + client_max_body_size 5000M; + client_header_buffer_size 5M; + # server_tokens off; + # server_names_hash_bucket_size 64; + # server_name_in_redirect off; + include /etc/nginx/mime.types; + default_type application/octet-stream; + + # Logging Settings + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + + # GZIP Settings + gzip on; + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + server { + listen 80; + listen [::]:80; + root /opt/react_client/; + + add_header 'Access-Control-Allow-Origin' '*' always; + add_header 'Access-Control-Allow-Methods' '*' always; + add_header 'Access-Control-Allow-Headers' '*' always; + + location = /static/index.bundle.js { + add_header Cache-Control 'no-store no-cache, must-revalidate, proxy-revalidate, max-age=0'; + if_modified_since off; + expires off; + } + location ~^/api/pm/ { + #rewrite /api/(.+) /$1 break; + proxy_set_header Host $host; + proxy_pass http://backend-svc.pm.svc.cluster.local:8000; + } + + location ~^/api/v1/documents/ { + #rewrite /api/(.+) /$1 break; + proxy_set_header Host $host; + proxy_pass http://backend-filestream-svc.documentations.svc.cluster.local:80; + } + + location ~^/(api|admin)/ { + proxy_set_header Host $host; + proxy_pass http://backend-svc.django.svc.cluster.local:80; + } + + location ~^/workspaces-v2/(.+).js { + rewrite /workspaces-v2/(.+) /$1 break; + proxy_pass http://frontend-svc.workspaces.svc.cluster.local:80; + } + + location @index { + add_header Cache-Control 'no-cache, must-revalidate, proxy-revalidate, max-age=0'; + if_modified_since off; + expires off; + try_files /static/index.html =404; + } + + location ~^/workflows/(.+).js { + rewrite /workflows/(.+) /$1 break; + proxy_pass http://frontend-svc.processing.svc.cluster.local:80; + } + location /service-worker.js { + try_files /static/$uri @index; + } + + location / { + try_files $uri @index; + } + } + } + diff --git a/apps/pm/base/backend-service.yaml b/apps/pm/base/backend-service.yaml index 69f6c27..55abdc2 100644 --- a/apps/pm/base/backend-service.yaml +++ b/apps/pm/base/backend-service.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: - name: backend-service + name: backend-svc namespace: pm spec: type: ClusterIP diff --git a/apps/processing/base/frontend-service.yaml b/apps/processing/base/frontend-service.yaml index 024ea55..14a2a63 100644 --- a/apps/processing/base/frontend-service.yaml +++ b/apps/processing/base/frontend-service.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: - name: frontend-service + name: frontend-svc namespace: processing spec: type: ClusterIP diff --git a/apps/workspaces/base/frontend-service.yaml b/apps/workspaces/base/frontend-service.yaml index b09b11e..9d8cfdd 100644 --- a/apps/workspaces/base/frontend-service.yaml +++ b/apps/workspaces/base/frontend-service.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: - name: frontend-service + name: frontend-svc namespace: workspaces spec: type: ClusterIP