瀏覽代碼

updated streaming config and volumes

Harlan Iverson 6 年之前
父節點
當前提交
6697cb6341
共有 3 個文件被更改,包括 37 次插入15 次删除
  1. 11 3
      Dockerfile.streaming
  2. 20 8
      nginx-conf/nginx.conf
  3. 6 4
      scripts/web/start-streaming.sh

+ 11 - 3
Dockerfile.streaming

@@ -3,7 +3,15 @@ FROM nginx-rtmp
 # NOTE need to clone from github.
 # can be changed from jessie to xenial build-pack
 
-COPY nginx.conf /etc/nginx/nginx.conf
+VOLUME /etc/nginx
 
-#WORKDIR /tmp/http
-#ADD app/resources/public /tmp/http
+RUN mkdir -p /tmp/http/cryogen
+VOLUME /tmp/http/cryogen
+
+RUN mkdir -p /tmp/http/hls
+VOLUME /tmp/http/hls
+
+RUN mkdir -p /tmp/http/media
+VOLUME /tmp/http/media
+
+USER root

+ 20 - 8
nginx.conf → nginx-conf/nginx.conf

@@ -1,14 +1,19 @@
-# wraps around the static image to deliver HLS video streaming
 
 http {
-    upstream ispooge_static {
-        #server ispooge-static:9090;
-        server 192.168.1.6:3000;
-    }
+#    include       mime.types;
+
+    default_type application/octet-stream;
 
     types {
+        text/plain txt;
+        text/html html;
+        text/css css;
+        application/javascript js;
+
         application/vnd.apple.mpegurl m3u8;
         video/mp2t ts;
+
+        application/rss+xml xml;
     }
 
     server {
@@ -46,7 +51,7 @@ http {
                   add_header 'Content-Length' 0;
                   return 204;
           }
-          root /tmp/hls/ispooge.com/;
+          root /tmp/http/hls/ispooge.com/;
         }
 
         # This URL provides RTMP statistics in XML
@@ -58,9 +63,16 @@ http {
             rtmp_stat_stylesheet stat.xsl;
         }
 
+        location /media/ {
+          rewrite  ^/media/(.*) /$1 break;
+
+          root /tmp/http/media/;
+        }
+
         location / {
 
 
+
           if ($cors = 'C') {
                 add_header 'Access-Control-Allow-Origin' "$http_origin" always;
                 add_header 'Access-Control-Allow-Credentials' 'true' always;
@@ -76,7 +88,7 @@ http {
                   return 204;
           }
 
-          proxy_pass      http://ispooge_static/;
+          root /tmp/http/cryogen/;
         }
     }
 }
@@ -111,7 +123,7 @@ rtmp {
             live on;
 
             hls on;
-            hls_path /tmp/hls/ispooge.com;
+            hls_path /tmp/http/hls/ispooge.com;
             #hls_base_url http://192.168.1.8:33080/hls/;
             hls_fragment 500ms;
             hls_playlist_length 3s;

+ 6 - 4
scripts/web/start-streaming.sh

@@ -5,8 +5,10 @@ source scripts/env.sh
 docker run -d --restart unless-stopped  \
   --name $NAME_STREAMING \
   -h ispooge-streaming \
-  -v /tmp/hls:/tmp/hls \
-  -p 33935:1935 \
-  -p 33936:1936 \
-  --link $NAME_STATIC \
+  -v $PWD/nginx-conf:/etc/nginx:ro \
+  -v $ISPOOGE_MEDIA_PATH/hls:/tmp/http/hls:rw \
+  -v $ISPOOGE_MEDIA_PATH:/tmp/http/media:ro \
+  -v $PWD/app/resources/public:/tmp/http/cryogen:ro \
+  -p $RTMP_PORT:1935 \
+  -p $HTTP_PORT:1936 \
   $IMAGE_STREAMING