diff --git a/drydock/patches/caddyfile b/drydock/patches/caddyfile index 4660a749..ebdb3605 100644 --- a/drydock/patches/caddyfile +++ b/drydock/patches/caddyfile @@ -1,35 +1,43 @@ {% if DRYDOCK_ENABLE_MULTITENANCY -%} {$default_site_port} { -@favicon_matcher { - path_regexp ^/favicon.ico$ -} -rewrite @favicon_matcher /theming/asset/images/favicon.ico + @favicon_matcher { + path_regexp ^/favicon.ico$ + } + rewrite @favicon_matcher /theming/asset/images/favicon.ico -{{ patch("caddyfile-mfe-by-path") }} + {{ patch("caddyfile-mfe-by-path") }} -# Limit profile image upload size -request_body /api/profile_images/*/*/upload { - max_size 1MB -} -request_body { - max_size 4MB -} -import proxy "lms:8000" -{% if DRYDOCK_ENABLE_SCORM and (MINIO_HOST is defined or S3_STORAGE_BUCKET is defined) -%} -@scorm_matcher { - path /scorm-proxy/* -} -route @scorm_matcher { - uri /scorm-proxy/* strip_prefix /scorm-proxy -{% if MINIO_HOST is defined %} - reverse_proxy minio:9000 { - header_up Host {{ MINIO_HOST }} -{% 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 %} + # Limit profile image upload size + request_body /api/profile_images/*/*/upload { + max_size 1MB } + request_body { + max_size 4MB + } + import proxy "lms:8000" + + {% if DRYDOCK_ENABLE_SCORM and MINIO_HOST is defined %} + @scorm_matcher { + path /scorm-proxy/* + } + route @scorm_matcher { + uri /scorm-proxy/* strip_prefix /scorm-proxy + reverse_proxy minio:9000 { + header_up Host {{ MINIO_HOST }} + } + } + {% elif DRYDOCK_ENABLE_SCORM and S3_STORAGE_BUCKET is defined %} + @scorm_matcher { + path /scorm-proxy/* + } + route @scorm_matcher { + 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 + } + } + {% endif %} + } -{% endif %} -} + {% endif %} diff --git a/drydock/patches/caddyfile-cms b/drydock/patches/caddyfile-cms index 4d2abe35..6caababd 100644 --- a/drydock/patches/caddyfile-cms +++ b/drydock/patches/caddyfile-cms @@ -1,17 +1,20 @@ -{% if DRYDOCK_ENABLE_SCORM and (MINIO_HOST is defined or S3_STORAGE_BUCKET is defined) -%} +{% if DRYDOCK_ENABLE_SCORM and MINIO_HOST is defined %} @scorm_matcher { path /scorm-proxy/* } route @scorm_matcher { -{% if MINIO_HOST is defined %} uri replace /scorm-proxy/ /{{ MINIO_BUCKET_NAME }}/ reverse_proxy minio:9000 { - header_up Host {{ MINIO_HOST }} -{% elif S3_STORAGE_BUCKET is defined %} + header_up Host {{ MINIO_HOST }} + } +} +{% elif DRYDOCK_ENABLE_SCORM and S3_STORAGE_BUCKET is defined %} +@scorm_matcher { + path /scorm-proxy/* +} +route @scorm_matcher { 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 -{% endif %} + header_up Host {{ S3_STORAGE_BUCKET }}.s3.amazonaws.com } } -{% endif %} diff --git a/drydock/patches/caddyfile-lms b/drydock/patches/caddyfile-lms index 4d2abe35..6caababd 100644 --- a/drydock/patches/caddyfile-lms +++ b/drydock/patches/caddyfile-lms @@ -1,17 +1,20 @@ -{% if DRYDOCK_ENABLE_SCORM and (MINIO_HOST is defined or S3_STORAGE_BUCKET is defined) -%} +{% if DRYDOCK_ENABLE_SCORM and MINIO_HOST is defined %} @scorm_matcher { path /scorm-proxy/* } route @scorm_matcher { -{% if MINIO_HOST is defined %} uri replace /scorm-proxy/ /{{ MINIO_BUCKET_NAME }}/ reverse_proxy minio:9000 { - header_up Host {{ MINIO_HOST }} -{% elif S3_STORAGE_BUCKET is defined %} + header_up Host {{ MINIO_HOST }} + } +} +{% elif DRYDOCK_ENABLE_SCORM and S3_STORAGE_BUCKET is defined %} +@scorm_matcher { + path /scorm-proxy/* +} +route @scorm_matcher { 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 -{% endif %} + header_up Host {{ S3_STORAGE_BUCKET }}.s3.amazonaws.com } } -{% endif %} diff --git a/drydock/templates/drydock/k8s/ingress/cms.yml b/drydock/templates/drydock/k8s/ingress/cms.yml index c6ab68d5..7723b48e 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 and S3_STORAGE_BUCKET is defined %} + {%- if DRYDOCK_ENABLE_SCORM and DRYDOCK_BYPASS_CADDY and (S3_STORAGE_BUCKET is defined or MINIO_HOST 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 bed0b28a..58b370a4 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 and S3_STORAGE_BUCKET is defined %} + {%- if DRYDOCK_ENABLE_SCORM and DRYDOCK_BYPASS_CADDY and (S3_STORAGE_BUCKET is defined or MINIO_HOST is defined) %} nginx.ingress.kubernetes.io/server-snippet: | location /scorm-proxy { proxy_http_version 1.1;