++ sarex-contour: django frontend — вырезать несуществующие upstream'ы
nginx падал в CrashLoopBackOff: "host not found in upstream backend-svc.pm.svc.cluster.local" — proxy_pass резолвится один раз при старте, приложений pm/documentations/processing в sarex-contour нет. Убраны location-блоки /api/pm/, /api/v1/documents/, /workflows/; django и workspaces (оба раскатаны) — оставлены. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
1ff52d0442
commit
d5efdefd27
@ -2,3 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1
|
|||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
resources:
|
resources:
|
||||||
- ../base
|
- ../base
|
||||||
|
patches:
|
||||||
|
- path: nginx-configmap.yaml
|
||||||
|
target:
|
||||||
|
kind: ConfigMap
|
||||||
|
name: nginx-configmap
|
||||||
|
|||||||
145
apps/django/sarex-contour/nginx-configmap.yaml
Normal file
145
apps/django/sarex-contour/nginx-configmap.yaml
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: nginx-configmap
|
||||||
|
namespace: django
|
||||||
|
data:
|
||||||
|
# base референсит backend-svc.pm/документации и frontend-svc.processing —
|
||||||
|
# этих приложений в sarex-contour нет, nginx падал на старте с
|
||||||
|
# "host not found in upstream" (резолвится один раз при парсинге конфига).
|
||||||
|
# Вырезаны блоки /api/pm/, /api/v1/documents/, /workflows/ — оставлены
|
||||||
|
# только django (свой backend) и workspaces (уже раскатан).
|
||||||
|
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;
|
||||||
|
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|admin)/ {
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Connection "";
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_pass http://backend-svc.django.svc.cluster.local:80;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /static/pdf-runtime/assets/mupdf-wasm.wasm {
|
||||||
|
alias /opt/react_client/static/pdf-runtime/assets/mupdf-wasm.wasm;
|
||||||
|
add_header Content-Type application/wasm always;
|
||||||
|
add_header Cache-Control "public, max-age=31536000, immutable" always;
|
||||||
|
add_header Access-Control-Allow-Origin "*" always;
|
||||||
|
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
|
||||||
|
add_header Access-Control-Allow-Headers "DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /workspaces-v2/worker/static/viewer-pdf/mupdf-wasm.js {
|
||||||
|
alias /opt/react_client/static/viewer-pdf/mupdf-wasm.js;
|
||||||
|
add_header Content-Type application/javascript always;
|
||||||
|
add_header Cache-Control "public, max-age=31536000, immutable" always;
|
||||||
|
add_header Access-Control-Allow-Origin "*" always;
|
||||||
|
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
|
||||||
|
add_header Access-Control-Allow-Headers "DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /workspaces-v2/worker/mupdf.worker-3.3.9.js {
|
||||||
|
alias /opt/react_client/static/pdf-runtime/mupdf.worker-3.3.9.js;
|
||||||
|
add_header Content-Type application/javascript always;
|
||||||
|
add_header Cache-Control "public, max-age=31536000, immutable" always;
|
||||||
|
add_header Access-Control-Allow-Origin "*" always;
|
||||||
|
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
|
||||||
|
add_header Access-Control-Allow-Headers "DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /workspaces-v2/worker/static/viewer-pdf/mupdf.js {
|
||||||
|
alias /opt/react_client/static/viewer-pdf/mupdf.js;
|
||||||
|
add_header Content-Type application/javascript always;
|
||||||
|
add_header Cache-Control "public, max-age=31536000, immutable" always;
|
||||||
|
add_header Access-Control-Allow-Origin "*" always;
|
||||||
|
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
|
||||||
|
add_header Access-Control-Allow-Headers "DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /workspaces-v2/worker/static/viewer-pdf/mupdf-wasm.wasm {
|
||||||
|
add_header Content-Type application/wasm always;
|
||||||
|
alias /opt/react_client/static/viewer-pdf/mupdf-wasm.wasm;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~^/workspaces-v2/(.+).js {
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Connection "";
|
||||||
|
rewrite /workspaces-v2/(.+) /$1 break;
|
||||||
|
proxy_pass http://frontend-svc.workspaces.svc.cluster.local:80;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~^/workspaces-v2/(.+)\.wasm$ {
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Connection "";
|
||||||
|
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 /service-worker.js {
|
||||||
|
try_files /static/$uri @index;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri @index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user