From c1ee060e1ca4975119aa8a651597664b428d8c18 Mon Sep 17 00:00:00 2001 From: Cristhian Garcia Date: Fri, 26 Apr 2024 09:50:40 -0500 Subject: [PATCH] fix: enable scorm proxy if s3 plugin is installed (#92) docs: add documentation for ingress lm extra hosts --- README.md | 1 + drydock/patches/caddyfile | 4 ++-- drydock/patches/caddyfile-cms | 4 ++-- drydock/patches/caddyfile-lms | 4 ++-- drydock/templates/drydock/k8s/ingress/cms.yml | 2 +- drydock/templates/drydock/k8s/ingress/lms.yml | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0a5ef660..9d8b7af6 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ The following configuration options are available: - `DRYDOCK_FLOWER`: Whether to deploy a flower deployment for celery. Defaults to `false`. - `DRYDOCK_INGRESS`: Whether to deploy an ingress for the LMS and CMS. Defaults to `false`. - `DRYDOCK_INGRESS_EXTRA_HOSTS`: A list of extra hosts to add to the ingress. Defaults to `[]`. +- `DRYDOCK_INGRESS_LMS_EXTRA_HOSTS`: A list of extra hosts to add to the LMS ingress. Defaults to `[]`. - `DRYDOCK_CUSTOM_CERTS`: A dictionary of custom certificates to use with cert-manager. Defaults to `{}`. - `DRYDOCK_NEWRELIC_LICENSE_KEY`: The New Relic license key. Defaults to `""`. - `DRYDOCK_DEBUG`: Whether to deploy debug resources. Defaults to `false`. diff --git a/drydock/patches/caddyfile b/drydock/patches/caddyfile index 60d244df..4660a749 100644 --- a/drydock/patches/caddyfile +++ b/drydock/patches/caddyfile @@ -15,7 +15,7 @@ request_body { max_size 4MB } import proxy "lms:8000" -{% if DRYDOCK_ENABLE_SCORM -%} +{% if DRYDOCK_ENABLE_SCORM and (MINIO_HOST is defined or S3_STORAGE_BUCKET is defined) -%} @scorm_matcher { path /scorm-proxy/* } @@ -24,7 +24,7 @@ route @scorm_matcher { {% if MINIO_HOST is defined %} reverse_proxy minio:9000 { header_up Host {{ MINIO_HOST }} -{% else %} +{% elif S3_STORAGE_BUCKET is defined %} reverse_proxy https://{{ S3_STORAGE_BUCKET }}.s3.amazonaws.com { header_up Host {{ S3_STORAGE_BUCKET }}.s3.amazonaws.com {% endif %} diff --git a/drydock/patches/caddyfile-cms b/drydock/patches/caddyfile-cms index be9cf276..4d2abe35 100644 --- a/drydock/patches/caddyfile-cms +++ b/drydock/patches/caddyfile-cms @@ -1,4 +1,4 @@ -{% if DRYDOCK_ENABLE_SCORM -%} +{% if DRYDOCK_ENABLE_SCORM and (MINIO_HOST is defined or S3_STORAGE_BUCKET is defined) -%} @scorm_matcher { path /scorm-proxy/* } @@ -7,7 +7,7 @@ route @scorm_matcher { uri replace /scorm-proxy/ /{{ MINIO_BUCKET_NAME }}/ reverse_proxy minio:9000 { header_up Host {{ MINIO_HOST }} -{% else %} +{% elif S3_STORAGE_BUCKET is defined %} uri /scorm-proxy/* strip_prefix /scorm-proxy reverse_proxy https://{{ S3_STORAGE_BUCKET }}.s3.amazonaws.com { header_up Host {{ S3_STORAGE_BUCKET }}.s3.amazonaws.com diff --git a/drydock/patches/caddyfile-lms b/drydock/patches/caddyfile-lms index be9cf276..4d2abe35 100644 --- a/drydock/patches/caddyfile-lms +++ b/drydock/patches/caddyfile-lms @@ -1,4 +1,4 @@ -{% if DRYDOCK_ENABLE_SCORM -%} +{% if DRYDOCK_ENABLE_SCORM and (MINIO_HOST is defined or S3_STORAGE_BUCKET is defined) -%} @scorm_matcher { path /scorm-proxy/* } @@ -7,7 +7,7 @@ route @scorm_matcher { uri replace /scorm-proxy/ /{{ MINIO_BUCKET_NAME }}/ reverse_proxy minio:9000 { header_up Host {{ MINIO_HOST }} -{% else %} +{% elif S3_STORAGE_BUCKET is defined %} uri /scorm-proxy/* strip_prefix /scorm-proxy reverse_proxy https://{{ S3_STORAGE_BUCKET }}.s3.amazonaws.com { header_up Host {{ S3_STORAGE_BUCKET }}.s3.amazonaws.com diff --git a/drydock/templates/drydock/k8s/ingress/cms.yml b/drydock/templates/drydock/k8s/ingress/cms.yml index c633ea8f..c6ab68d5 100644 --- a/drydock/templates/drydock/k8s/ingress/cms.yml +++ b/drydock/templates/drydock/k8s/ingress/cms.yml @@ -8,7 +8,7 @@ metadata: {%- if DRYDOCK_AUTO_TLS and not DRYDOCK_CUSTOM_CERTS%} cert-manager.io/issuer: letsencrypt {%- endif %} - {%- if DRYDOCK_ENABLE_SCORM and DRYDOCK_BYPASS_CADDY %} + {%- if DRYDOCK_ENABLE_SCORM and DRYDOCK_BYPASS_CADDY and S3_STORAGE_BUCKET is defined %} nginx.ingress.kubernetes.io/server-snippet: | location /scorm-proxy { proxy_http_version 1.1; diff --git a/drydock/templates/drydock/k8s/ingress/lms.yml b/drydock/templates/drydock/k8s/ingress/lms.yml index 4f23a36d..bed0b28a 100644 --- a/drydock/templates/drydock/k8s/ingress/lms.yml +++ b/drydock/templates/drydock/k8s/ingress/lms.yml @@ -8,7 +8,7 @@ metadata: {%- if DRYDOCK_AUTO_TLS and not DRYDOCK_CUSTOM_CERTS %} cert-manager.io/issuer: letsencrypt {%- endif %} - {%- if DRYDOCK_ENABLE_SCORM and DRYDOCK_BYPASS_CADDY %} + {%- if DRYDOCK_ENABLE_SCORM and DRYDOCK_BYPASS_CADDY and S3_STORAGE_BUCKET is defined %} nginx.ingress.kubernetes.io/server-snippet: | location /scorm-proxy { proxy_http_version 1.1;