diff --git a/apps/django/base/backend-deployment.yaml b/apps/django/base/backend-deployment.yaml index ed1437e..92e3bfa 100644 --- a/apps/django/base/backend-deployment.yaml +++ b/apps/django/base/backend-deployment.yaml @@ -89,6 +89,13 @@ spec: - key: production.py path: production.py defaultMode: 420 + - name: uwsgi-configmap + configMap: + name: uwsgi-configmap + items: + - key: uwsgi.ini + path: uwsgi.ini + defaultMode: 420 containers: - name: backend image: cr.yandex/crp3ccidau046kdj8g9q/backend:production_a96dead0 @@ -202,5 +209,8 @@ spec: - name: django-configmap mountPath: /opt/sarex/config/settings/production.py subPath: production.py + - name: uwsgi-configmap + mountPath: /opt/sarex/uwsgi.ini + subPath: uwsgi.ini imagePullSecrets: - name: regcred diff --git a/apps/django/base/django-configmap.yaml b/apps/django/base/django-configmap.yaml index 395a0d7..61d21a7 100644 --- a/apps/django/base/django-configmap.yaml +++ b/apps/django/base/django-configmap.yaml @@ -199,7 +199,7 @@ data: 'PAGE_SIZE': 1000, 'DEFAULT_FILTER_BACKENDS': [ 'django_filters.rest_framework.DjangoFilterBackend' ], 'DEFAULT_AUTHENTICATION_CLASSES': [ - 'sarex.authentication.backends.ZitadelJWTAuthentication', + # 'sarex.authentication.backends.ZitadelJWTAuthentication', 'rest_framework.authentication.RemoteUserAuthentication', 'rest_framework_simplejwt.authentication.JWTAuthentication', 'rest_framework.authentication.BasicAuthentication', diff --git a/apps/django/base/kustomization.yaml b/apps/django/base/kustomization.yaml index 80faec9..836acab 100644 --- a/apps/django/base/kustomization.yaml +++ b/apps/django/base/kustomization.yaml @@ -14,3 +14,4 @@ resources: - srx-admin-deployment.yaml - srx-admin-service.yaml - nginx-configmap.yaml + - uwsgi-configmap.yaml diff --git a/apps/django/base/uwsgi-configmap.yaml b/apps/django/base/uwsgi-configmap.yaml new file mode 100644 index 0000000..f28fb29 --- /dev/null +++ b/apps/django/base/uwsgi-configmap.yaml @@ -0,0 +1,30 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: uwsgi-configmap + namespace: django +data: + uwsgi.ini: | + [uwsgi] + module = config.wsgi:application + DJANGO_SETTINGS_MODULE = config.settings.production + http = 0.0.0.0:8000 + processes = 16 + master = true + vacuum = true + enable-threads = true + buffer-size = 65535 + stats = :3031 + stats-http = true + memory-report = true + lazy-apps = true + listen = 128 + disable-write-exception= 0 + harakiri = 300 + socket-timeout = 300 + chunked-input-timeout = 300 + http-timeout = 300 + worker-reload-mercy = 240 + mule-reload-mercy = 240 + static-map = /static=/opt/sarex/sarex/static/ + static-map = /media=/media/ diff --git a/apps/documentations/base/frontend-service.yaml b/apps/documentations/base/frontend-service.yaml index f4ad089..3b8eb8d 100644 --- a/apps/documentations/base/frontend-service.yaml +++ b/apps/documentations/base/frontend-service.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: - name: frontend-service + name: frontend-svc namespace: documentations spec: type: ClusterIP diff --git a/apps/documentations/base/pdm-deployment.yaml b/apps/documentations/base/pdm-deployment.yaml index d2c9fb3..7f4fc6e 100644 --- a/apps/documentations/base/pdm-deployment.yaml +++ b/apps/documentations/base/pdm-deployment.yaml @@ -143,7 +143,7 @@ spec: - name: REMARKS_URL value: http://remarks-static-service.remarks.svc.cluster.local:8080/remarks - name: RESOURCES_URL - value: http://resources-service.resources.svc.cluster.local:8000 + value: http://backend-svc.resources.svc.cluster.local:80 - name: S3_SERVICE_ACCOUNT value: /vault/secrets/documentations-s3-account-json - name: STATES_URL diff --git a/apps/issues/base/frontend-service.yaml b/apps/issues/base/frontend-service.yaml index 14dfd0f..fdb438b 100644 --- a/apps/issues/base/frontend-service.yaml +++ b/apps/issues/base/frontend-service.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: - name: frontend-service + name: frontend-svc namespace: issues spec: type: ClusterIP diff --git a/apps/resources/base/backend-deployment.yaml b/apps/resources/base/backend-deployment.yaml index adff2d6..bfdca30 100644 --- a/apps/resources/base/backend-deployment.yaml +++ b/apps/resources/base/backend-deployment.yaml @@ -48,6 +48,13 @@ spec: - key: production.py path: production.py defaultMode: 420 + - name: uwsgi-configmap + configMap: + name: uwsgi-configmap + items: + - key: uwsgi.ini + path: uwsgi.ini + defaultMode: 420 containers: - name: backend @@ -83,6 +90,9 @@ spec: - name: django-configmap mountPath: /server/config/settings/production.py subPath: production.py + - name: uwsgi-configmap + mountPath: opt/server/uwsgi.ini + subPath: uwsgi.ini livenessProbe: tcpSocket: diff --git a/apps/resources/base/backend-service.yaml b/apps/resources/base/backend-service.yaml index 1215014..99764c6 100644 --- a/apps/resources/base/backend-service.yaml +++ b/apps/resources/base/backend-service.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: - name: backend-service + name: backend-svc namespace: resources spec: type: ClusterIP @@ -10,6 +10,6 @@ spec: app: backend ports: - name: http - port: 8000 + port: 80 targetPort: 8000 protocol: TCP diff --git a/apps/resources/base/kustomization.yaml b/apps/resources/base/kustomization.yaml index 0ccff81..55f558d 100644 --- a/apps/resources/base/kustomization.yaml +++ b/apps/resources/base/kustomization.yaml @@ -8,3 +8,4 @@ resources: - backend-deployment.yaml - backend-service.yaml - django-configmap.yaml + - uwsgi-configmap.yaml diff --git a/apps/resources/base/uwsgi-configmap.yaml b/apps/resources/base/uwsgi-configmap.yaml new file mode 100644 index 0000000..9eb83fb --- /dev/null +++ b/apps/resources/base/uwsgi-configmap.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: uwsgi-configmap + namespace: resources +data: + uwsgi.ini: | + [uwsgi] + chdir = /server + module = config.wsgi:application + master = true + master-fifo = /opt/server/uwsgi-backend-server.fifo + processes = 4 + http = 0.0.0.0:8000 + chmod-socket = 666 + vacuum = true + harakiri = 6000 + buffer-size = 32768 + + static-map = /static=/opt/server/static/ + static-map = /media=/opt/server/media/ diff --git a/clusters/yc-k8s-test/infrastructure/patches/istio-config.yaml b/clusters/yc-k8s-test/infrastructure/patches/istio-config.yaml index c77e1f7..bf11efb 100644 --- a/clusters/yc-k8s-test/infrastructure/patches/istio-config.yaml +++ b/clusters/yc-k8s-test/infrastructure/patches/istio-config.yaml @@ -190,6 +190,44 @@ spec: prefix: / service: frontend-svc.django.svc.cluster.local port: 80 + gateway-platform: + name: pdm-virt-service + namespace: gateway + hosts: + - sarex.contour.infra.sarex.tech + gateways: + - gateway/platform-gateway + routes: + - path: + prefix: /gateway/ + service: pdm-svc.documentations.svc.cluster.local + port: 80 + documentations-frontend: + name: documentations-frontend-virt-service + namespace: gateway + hosts: + - sarex.contour.infra.sarex.tech + gateways: + - gateway/platform-gateway + routes: + - path: + prefix: /documentations/static/ + rewrite: / + service: frontend-svc.documentations.svc.cluster.local + port: 80 + issues-frontend: + name: issues-frontend-virt-service + namespace: gateway + hosts: + - sarex.contour.infra.sarex.tech + gateways: + - gateway/platform-gateway + routes: + - path: + prefix: /issues/static/ + rewrite: / + service: frontend-svc.issues.svc.cluster.local + port: 80 vault: name: vault-virt-service namespace: gateway