Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBC22-1788: Cache Django Media #313

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 1d;
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
Loading