Woojoong Kim | 7b3d4b1 | 2019-02-17 23:45:04 +0900 | [diff] [blame^] | 1 | --- |
| 2 | # Copyright 2019-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | --- |
| 17 | apiVersion: v1 |
| 18 | kind: ConfigMap |
| 19 | metadata: |
| 20 | name: nginx-rtmp-config |
| 21 | data: |
| 22 | nginx_rtmp_config.sh: |+ |
| 23 | #!/bin/bash |
| 24 | #ip addr add 192.168.99.2 dev north0 |
| 25 | #ip addr add 192.168.99.3 dev north0d1 |
| 26 | #ip route del default dev eth0 |
| 27 | #ip route add default gw 192.168.99.2 north0 |
| 28 | mkdir -pZ /var/www/live |
| 29 | ip route add {{ .Values.ue_ip_subnet1 }} via {{ .Values.spgwu_sgiip }} dev sgi-net; |
| 30 | ip route add {{ .Values.ue_ip_subnet2 }} via {{ .Values.spgwu_sgiip }} dev sgi-net; |
| 31 | ip link set sgi-net mtu 1200; |
| 32 | cp /conf/nginx.conf /etc/nginx/ |
| 33 | #nginx -c /etc/nginx/nginx.conf |
| 34 | #while true; do sleep 1; done |
| 35 | nginx -g "daemon off;" |
| 36 | --- |
| 37 | apiVersion: v1 |
| 38 | kind: ConfigMap |
| 39 | metadata: |
| 40 | name: nginx-rtmp-conf |
| 41 | data: |
| 42 | nginx.conf: |+ |
| 43 | |
| 44 | # I'll explain why we only have 1 worker process later |
| 45 | worker_processes 1; |
| 46 | error_log /var/log/nginx/error.log; |
| 47 | pid /run/nginx.pid; |
| 48 | |
| 49 | include /usr/share/nginx/modules/*.conf; |
| 50 | |
| 51 | events { |
| 52 | use epoll; |
| 53 | worker_connections 1024; |
| 54 | } |
| 55 | |
| 56 | http { |
| 57 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' |
| 58 | '$status $body_bytes_sent "$http_referer" ' |
| 59 | '"$http_user_agent" "$http_x_forwarded_for" $request_time'; |
| 60 | access_log /var/log/nginx/access.log main; |
| 61 | sendfile on; |
| 62 | tcp_nopush on; |
| 63 | tcp_nodelay on; |
| 64 | keepalive_timeout 65; |
| 65 | types_hash_max_size 2048; |
| 66 | include /etc/nginx/mime.types; |
| 67 | default_type application/octet-stream; |
| 68 | |
| 69 | server { |
| 70 | listen 1980 default_server; |
| 71 | server_name _; |
| 72 | root /var/www; |
| 73 | expires -1d; |
| 74 | |
| 75 | location ~ ^/live/.+\.ts$ { |
| 76 | # MPEG-TS segments can be cached upstream indefinitely |
| 77 | expires max; |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | rtmp { |
| 83 | server { |
| 84 | listen 1935; |
| 85 | |
| 86 | application app { |
| 87 | live on; |
| 88 | |
| 89 | # Don't allow RTMP playback |
| 90 | deny play all; |
| 91 | |
| 92 | # Package streams as HLS |
| 93 | hls on; |
| 94 | hls_path /var/www/live; |
| 95 | hls_nested on; |
| 96 | #hls_datetime system; |
| 97 | hls_fragment_naming system; |
| 98 | } |
| 99 | application vod2 { |
| 100 | play /var/www/live; |
| 101 | } |
| 102 | application l { |
| 103 | live on; |
| 104 | play /opt/cdn/movies; |
| 105 | } |
| 106 | } |
| 107 | } |