diff --git a/core/settings.py b/core/settings.py index 1736ee4e..426085bf 100644 --- a/core/settings.py +++ b/core/settings.py @@ -259,9 +259,7 @@ "REDIRECT_URI": os.environ.get("AZURE_REDIRECT_URI"), "SCOPES": ["User.Read"], "AUTHORITY": os.environ.get("AZURE_AUTHORITY"), - "PUBLIC_PATHS": [ - "/metrics", - ], + "PUBLIC_PATHS": ["/metrics"], "USERNAME_ATTRIBUTE": "mail", "USER_MAPPING_FN": "users.helper.user_mapping_fn", } diff --git a/deployments/templates/deployment.yml b/deployments/templates/deployment.yml index b8318da1..16c7696d 100644 --- a/deployments/templates/deployment.yml +++ b/deployments/templates/deployment.yml @@ -32,6 +32,26 @@ spec: - name: http containerPort: 8000 protocol: TCP + readinessProbe: + httpGet: + httpGet: + path: / + port: 8000 + httpHeaders: + - name: Host + value: .service.justice.gov.uk + initialDelaySeconds: 10 + periodSeconds: 10 + timeoutSeconds: 10 + livenessProbe: + httpGet: + path: / + port: 8000 + httpHeaders: + - name: Host + value: .service.justice.gov.uk + initialDelaySeconds: 40 + periodSeconds: 60 env: - name: ENV value: "${ENV}" diff --git a/home/views.py b/home/views.py index ab3970d7..bf7024ba 100644 --- a/home/views.py +++ b/home/views.py @@ -3,6 +3,7 @@ from urllib.parse import urlparse from data_platform_catalogue.client.exceptions import EntityDoesNotExist +from data_platform_catalogue.entities import EntityTypes from data_platform_catalogue.search_types import DomainOption from django.conf import settings from django.http import Http404, HttpResponse, HttpResponseBadRequest @@ -10,7 +11,6 @@ from django.utils.translation import gettext as _ from django.views.decorators.cache import cache_control -from data_platform_catalogue.entities import EntityTypes from home.forms.search import SearchForm from home.service.details import ( ChartDetailsService, @@ -36,7 +36,7 @@ EntityTypes.CHART.url_formatted: ChartDetailsService, EntityTypes.DASHBOARD.url_formatted: DashboardDetailsService, EntityTypes.PUBLICATION_COLLECTION.url_formatted: PublicationCollectionDetailsService, - EntityTypes.PUBLICATION_DATASET.url_formatted: PublicationDatasetDetailsService + EntityTypes.PUBLICATION_DATASET.url_formatted: PublicationDatasetDetailsService, } @@ -63,6 +63,7 @@ def details_view(request, result_type, urn): return render(request, service.template, service.context) + @cache_control(max_age=300, private=True) def details_view_csv(request, result_type, urn) -> HttpResponse: match result_type: