From ca6a747e300b7f3bcd7072df728451d191623fa5 Mon Sep 17 00:00:00 2001
From: Antoine SCHILDKNECHT <antoine.schildknecht@ubicast.eu>
Date: Mon, 20 Mar 2023 09:02:19 +0000
Subject: [PATCH] Remove mediacache templates folder | refs #37557

---
 roles/mediacache/templates/index.j2      | 17 -----
 roles/mediacache/templates/mediacache.j2 | 96 ------------------------
 2 files changed, 113 deletions(-)
 delete mode 100644 roles/mediacache/templates/index.j2
 delete mode 100644 roles/mediacache/templates/mediacache.j2

diff --git a/roles/mediacache/templates/index.j2 b/roles/mediacache/templates/index.j2
deleted file mode 100644
index b2ade6d4..00000000
--- a/roles/mediacache/templates/index.j2
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml">
-    <head>
-        <title>UbiCast cache server</title>
-        <style>
-            html { background: #222; color: #ddd; }
-            body { margin: 0 auto; max-width: 500px; }
-            a { color: #5cf; text-decoration: none; }
-            a:hover { text-decoration: underline; }
-        </style>
-    </head>
-    <body>
-        <h1>UbiCast cache server</h1>
-        <hr/>
-        <p>Powered by UbiCast -- <a href="https://www.ubicast.eu">https://www.ubicast.eu</a></p>
-    </body>
-</html>
diff --git a/roles/mediacache/templates/mediacache.j2 b/roles/mediacache/templates/mediacache.j2
deleted file mode 100644
index 3b879583..00000000
--- a/roles/mediacache/templates/mediacache.j2
+++ /dev/null
@@ -1,96 +0,0 @@
-# Cache configuration
-#  Maximum retention of 30 days
-#  1G of RAM for keys zone (one megabyte can store about 8 thousand keys)
-#  wost case is up to 2800 hours of 720p video (50M files) on a 2 TB cache
-#  WARNING: keys_zone=name:size size does not accept g units, only m
-#  https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path
-proxy_cache_path {{ mediacache_folder }} levels=1:2 keys_zone=mediacache:1000m max_size={{ mediacache_size }}g inactive=30d;
-
-server {
-    listen 80 default_server;
-
-    server_name {{ mc_url }};
-
-    location /.well-known/acme-challenge {
-        default_type "text/plain";
-        root /var/www/letsencrypt;
-    }
-
-    location / {
-        return 301 https://$host$request_uri;
-    }
-
-}
-
-server {
-    listen 443 default_server ssl backlog=15000;
-
-    server_name {{ mc_url }};
-    root /var/www/mediacache/;
-
-    location /crossdomain {
-
-    }
-
-    location /streaming/ {
-        # Live; expiration headers are defined by upstream (nginx/wowza)
-        rewrite ^/(.*)$ /$1? break;
-        proxy_pass https://{{ ms_url }};
-        proxy_cache mediacache;
-
-        # do not consider secure urls as new files
-        proxy_cache_key $scheme$proxy_host$uri;
-
-        # only one request at a time will be allowed to populate a new cache element
-        proxy_cache_lock on;
-
-        # hide upstream X-Cache header
-        proxy_hide_header X-Cache;
-
-        # add own X-Cache header
-        add_header X-Cache $upstream_cache_status;
-
-        # rm cookie
-        proxy_hide_header       Set-Cookie;
-        proxy_ignore_headers    Set-Cookie;
-
-    }
-
-    location /resources/ {
-        # VOD
-        location ~ \.(m3u8|ts|mp4|mp3|oga|ogv|ogg|mov|flv)$ {
-            rewrite ^/(.*)$ /$1? break;
-            proxy_pass https://{{ ms_url }};
-            proxy_cache mediacache;
-
-            # do not consider secure urls as new files
-            proxy_cache_key $scheme$proxy_host$uri;
-
-            # only one request at a time will be allowed to populate a new cache element
-            proxy_cache_lock on;
-
-            # how long should the data be kept in the cache
-            proxy_cache_valid 200 30d;
-
-            # instruct browser to cache this
-            expires 7d;
-
-            # headers
-            proxy_ignore_headers "Cache-Control" "X-Accel-Expires" "Expires";
-            add_header X-Cache $upstream_cache_status;
-
-            # rm cookie
-            proxy_hide_header       Set-Cookie;
-            proxy_ignore_headers    Set-Cookie;
-
-        }
-
-    }
-
-    location / {
-        # only urls to video and audio files are allowed, discard any requested path for other urls
-        rewrite ^/(.*)$ /index.html? break;
-
-    }
-
-}
-- 
GitLab