From 4664f8df40e71d6c570162ab69527f70e2653ee4 Mon Sep 17 00:00:00 2001 From: aidewoode Date: Tue, 12 Apr 2022 10:42:07 +0800 Subject: [PATCH 1/3] Try to fix issue of docker version cannot generate transcode cache --- .github/workflows/release-edge-build.yml | 2 +- .../cached_transcoded_stream_controller.rb | 4 +--- app/controllers/stream_controller.rb | 11 +++++------ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release-edge-build.yml b/.github/workflows/release-edge-build.yml index 314592b8..5542a837 100644 --- a/.github/workflows/release-edge-build.yml +++ b/.github/workflows/release-edge-build.yml @@ -3,7 +3,7 @@ name: Release Edge Build on: push: branches: - - master + - fix-cannot-generate-transcode-cache jobs: build: diff --git a/app/controllers/cached_transcoded_stream_controller.rb b/app/controllers/cached_transcoded_stream_controller.rb index 8ce33282..46c1c844 100644 --- a/app/controllers/cached_transcoded_stream_controller.rb +++ b/app/controllers/cached_transcoded_stream_controller.rb @@ -7,9 +7,7 @@ def new private - def set_header - return unless nginx_senfile? - + def set_nginx_header response.headers["X-Accel-Redirect"] = File.join("/private_cache_media", @stream.transcode_cache_file_path.sub(Stream::TRANSCODE_CACHE_DIRECTORY.to_s, "")) end end diff --git a/app/controllers/stream_controller.rb b/app/controllers/stream_controller.rb index e142dc55..89ddaaec 100644 --- a/app/controllers/stream_controller.rb +++ b/app/controllers/stream_controller.rb @@ -2,7 +2,6 @@ class StreamController < ApplicationController before_action :find_stream - before_action :set_header def new if need_transcode? @stream.format @@ -14,11 +13,9 @@ def new private - # Let nginx can get value of media_path dynamically in the nginx config, - # when use X-Accel-Redirect header to send file. - def set_header - return unless nginx_senfile? - + def set_nginx_header + # Let nginx can get value of media_path dynamically in the nginx config, + # when use X-Accel-Redirect header to send file. response.headers["X-Media-Path"] = Setting.media_path response.headers["X-Accel-Redirect"] = File.join("/private_media", @stream.file_path.sub(File.expand_path(Setting.media_path), "")) end @@ -34,6 +31,8 @@ def nginx_senfile? def send_local_file(file_path) if nginx_senfile? + set_nginx_header + send_file file_path return end From 7a77682e07af5cf27963ad2a37dbd5092ebf3851 Mon Sep 17 00:00:00 2001 From: aidewoode Date: Tue, 12 Apr 2022 15:07:28 +0800 Subject: [PATCH 2/3] Fix nginx config error of transcode cache --- config/nginx/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/nginx/nginx.conf b/config/nginx/nginx.conf index 4df9d3c9..ef3951f8 100644 --- a/config/nginx/nginx.conf +++ b/config/nginx/nginx.conf @@ -58,7 +58,7 @@ http { location /private_cache_media/ { internal; - alias /tmp/cache/media_file/; + alias /app/tmp/cache/media_file/; } location / { From 44dd78cb0f1d8e16a28db73b84a87d819db0db3f Mon Sep 17 00:00:00 2001 From: aidewoode Date: Tue, 12 Apr 2022 15:31:06 +0800 Subject: [PATCH 3/3] Revert github action for release edge-build --- .github/workflows/release-edge-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-edge-build.yml b/.github/workflows/release-edge-build.yml index 5542a837..314592b8 100644 --- a/.github/workflows/release-edge-build.yml +++ b/.github/workflows/release-edge-build.yml @@ -3,7 +3,7 @@ name: Release Edge Build on: push: branches: - - fix-cannot-generate-transcode-cache + - master jobs: build: