Skip to content

Commit

Permalink
DBC22-1788: Cache Django Media
Browse files Browse the repository at this point in the history
Updating some resource values at same time to ensure capacity
  • Loading branch information
wmuldergov committed Mar 1, 2024
1 parent dcc0341 commit e6f057a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 37 deletions.
14 changes: 14 additions & 0 deletions compose/frontend/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ server {
add_header X-Proxy-Cache $upstream_cache_status;
}

location /django-media/ {
proxy_ssl_server_name on;
proxy_pass http://{ENVIRONMENT}-django;
proxy_connect_timeout 5s;
proxy_cache_background_update on;
proxy_cache_lock on;
proxy_cache_lock_age 10s;
proxy_cache_lock_timeout 10s;
proxy_cache_revalidate on;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_valid 200 1h;
add_header X-Proxy-Cache $upstream_cache_status;
}

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
Expand Down
24 changes: 0 additions & 24 deletions infrastructure/_django/templates/django-route.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,6 @@ spec:
host: {{ .Values.route.host }}
path: /django-static/

---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: {{ template "app.fullname" . }}-backend-media
labels: {{ include "app.labels" . | nindent 4 }}
{{ if .Values.route.iprestricted }}
annotations:
haproxy.router.openshift.io/ip_whitelist: {{ .Values.route.ipallowlist }}
{{ end }}
spec:
to:
kind: Service
name: {{ template "app.fullname" . }}
port:
targetPort: 80-tcp
tls:
termination: edge
insecureEdgeTerminationPolicy: Redirect
wildcardPolicy: None
host: {{ .Values.route.host }}
path: /django-media/


---
apiVersion: route.openshift.io/v1
kind: Route
Expand Down
12 changes: 6 additions & 6 deletions infrastructure/main/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ image-caching:
resources:
requests:
cpu: 50m
memory: 50Mi
memory: 100Mi
limits:
cpu: 250m
memory: 100Mi
memory: 150Mi
env:
imagecachingConfigMap: prod-drivebc-image-caching
autoscaling:
Expand All @@ -92,7 +92,7 @@ redis:
cpu: 50m
memory: 50Mi
limits:
cpu: 100m
cpu: 200m
memory: 100Mi

static:
Expand All @@ -106,10 +106,10 @@ static:
resources:
requests:
cpu: 50m
memory: 50Mi
limits:
cpu: 150m
memory: 100Mi
limits:
cpu: 250m
memory: 150Mi
env:
staticConfigMap: prod-drivebc-static
staticSecret: prod-drivebc-static
Expand Down
8 changes: 4 additions & 4 deletions infrastructure/main/values-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ static:
deployment:
resources:
requests:
cpu: 20m
memory: 50Mi
limits:
cpu: 150m
cpu: 50m
memory: 100Mi
limits:
cpu: 250m
memory: 150Mi
env:
staticConfigMap: test-drivebc-static
staticSecret: test-drivebc-static
Expand Down
6 changes: 3 additions & 3 deletions infrastructure/main/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ image-caching:
resources:
requests:
cpu: 50m
memory: 50Mi
memory: 100Mi
limits:
cpu: 250m
memory: 100Mi
memory: 150Mi
env:
imagecachingConfigMap: uat-drivebc-image-caching
autoscaling:
Expand All @@ -92,7 +92,7 @@ redis:
cpu: 50m
memory: 50Mi
limits:
cpu: 100m
cpu: 200m
memory: 100Mi

static:
Expand Down

0 comments on commit e6f057a

Please sign in to comment.