From 5a26b1f625cac497bdaea3042dcccfb053be6025 Mon Sep 17 00:00:00 2001 From: pmustonebi Date: Tue, 17 Mar 2026 10:56:00 +0000 Subject: [PATCH 1/2] Updated to allow access from bare K8s urls --- rnacentral/rnacentral/settings.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rnacentral/rnacentral/settings.py b/rnacentral/rnacentral/settings.py index b01db2737..adf675326 100644 --- a/rnacentral/rnacentral/settings.py +++ b/rnacentral/rnacentral/settings.py @@ -11,6 +11,7 @@ limitations under the License. """ +import fnmatch import os from dotenv import load_dotenv @@ -49,8 +50,18 @@ def _require_env(name): # Hosts/domain names that are valid for this site; required if DEBUG is False +_static_hosts = ["rnacentral.org", "www.rnacentral.org", "test.rnacentral.org", "test-2.rnacentral.org"] _extra_hosts = [h for h in os.getenv("ALLOWED_HOSTS", "").split(",") if h] -ALLOWED_HOSTS = ["rnacentral.org", "www.rnacentral.org", "test.rnacentral.org", "test-2.rnacentral.org"] + _extra_hosts + + +class _AllowedHosts(list): + """Extends ALLOWED_HOSTS to support glob patterns (e.g. *-worker-*.caas.ebi.ac.uk).""" + + def __contains__(self, host): + return any(fnmatch.fnmatch(host, pattern) for pattern in self) + + +ALLOWED_HOSTS = _AllowedHosts(_static_hosts + _extra_hosts) # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name From af549f0c6ebf46e427b3a617304b31a60afebe35 Mon Sep 17 00:00:00 2001 From: pmustonebi Date: Tue, 17 Mar 2026 12:51:51 +0000 Subject: [PATCH 2/2] updated with allowedHosts: ".caas.ebi.ac.uk" --- kubernetes/helm/templates/rnacentral.yaml | 8 ++++++++ kubernetes/helm/values.dev.yaml | 6 ++++++ rnacentral/rnacentral/settings.py | 13 +------------ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/kubernetes/helm/templates/rnacentral.yaml b/kubernetes/helm/templates/rnacentral.yaml index b54cb4c6f..1d44d91fb 100644 --- a/kubernetes/helm/templates/rnacentral.yaml +++ b/kubernetes/helm/templates/rnacentral.yaml @@ -62,6 +62,14 @@ spec: env: - name: RNACENTRAL_ENV value: {{ .Values.setEnv }} + {{- if .Values.allowedHosts }} + - name: ALLOWED_HOSTS + value: {{ .Values.allowedHosts }} + {{- end }} + {{- if .Values.djangoDebug }} + - name: DJANGO_DEBUG + value: {{ .Values.djangoDebug }} + {{- end }} - name: DOORBELL_API_KEY valueFrom: secretKeyRef: diff --git a/kubernetes/helm/values.dev.yaml b/kubernetes/helm/values.dev.yaml index 86d07264d..43c6035f6 100644 --- a/kubernetes/helm/values.dev.yaml +++ b/kubernetes/helm/values.dev.yaml @@ -15,6 +15,12 @@ sitemaps: "false" # Add environment variable setEnv: "dev" +# Allowed hosts (in addition to rnacentral.org domains hardcoded in settings.py) +allowedHosts: ".caas.ebi.ac.uk" + +# Disable SSL redirect so the site is accessible over plain HTTP on NodePort +djangoDebug: "True" + # Memcached memcachedRequestsMemory: "4000Mi" memcachedLimitsMemory: "4000Mi" diff --git a/rnacentral/rnacentral/settings.py b/rnacentral/rnacentral/settings.py index adf675326..b01db2737 100644 --- a/rnacentral/rnacentral/settings.py +++ b/rnacentral/rnacentral/settings.py @@ -11,7 +11,6 @@ limitations under the License. """ -import fnmatch import os from dotenv import load_dotenv @@ -50,18 +49,8 @@ def _require_env(name): # Hosts/domain names that are valid for this site; required if DEBUG is False -_static_hosts = ["rnacentral.org", "www.rnacentral.org", "test.rnacentral.org", "test-2.rnacentral.org"] _extra_hosts = [h for h in os.getenv("ALLOWED_HOSTS", "").split(",") if h] - - -class _AllowedHosts(list): - """Extends ALLOWED_HOSTS to support glob patterns (e.g. *-worker-*.caas.ebi.ac.uk).""" - - def __contains__(self, host): - return any(fnmatch.fnmatch(host, pattern) for pattern in self) - - -ALLOWED_HOSTS = _AllowedHosts(_static_hosts + _extra_hosts) +ALLOWED_HOSTS = ["rnacentral.org", "www.rnacentral.org", "test.rnacentral.org", "test-2.rnacentral.org"] + _extra_hosts # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name