Note |
---|
This documentation is for Release 6.3. For documentation on previous releases, please select from the options below. |
...
See documentation for your version of MySQL Server for detailed syntax (http://dev.mysql.com/doc/refman/5.1/en/create-database.html )
Media Streaming Server
Warning |
---|
Red5 is no longer the default streaming server for Avalon 6.3. With the upgrade to MediaElementjs 4, we now rely completely on HLS. |
...
For production environments, an HLS-enabled server like Wowza, Adobe Media System (commercial) or Nginx + the the HLS module (open-source) can take an mp4 created from from distribute-streaming and stream it on the fly. Then prechunking can be disabled by commenting out the the distribute-hls
operation. Instructions for setting up Nginx will follow soon. operation.
Nginx instructions
Code Block | ||||
---|---|---|---|---|
| ||||
rpm -ihv http://installrepo.kaltura.org/releases/kaltura-release.noarch.rpm
yum install kaltura-nginx
|
Add /etc/nginx/nginx.conf
Code Block |
---|
user nginx;
worker_processes 4;
events {
worker_connections 1024;
}
http {
server {
listen 8980;
# This URL provides RTMP statistics in XML
location /stat {
rtmp_stat all;
# Use this stylesheet to view XML as web page
# in browser
rtmp_stat_stylesheet /stat.xsl;
}
location /stat.xsl {
# XML stylesheet to view RTMP stats.
# Copy stat.xsl wherever you want
# and put the full directory path here
root /etc/nginx/;
}
vod_mode local;
vod_last_modified 'Sun, 19 Nov 2000 08:52:00 GMT';
vod_last_modified_types *;
vod_metadata_cache metadata_cache 512m;
vod_response_cache response_cache 128m;
gzip on;
gzip_types application/vnd.apple.mpegurl;
open_file_cache max=1000 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
location /thumb/ {
alias /var/avalon/rtmp_streams/;
vod thumb;
}
location ~ ^/avalon/(?<stream>.+)/(?<resource>.+\.(?:m3u8|ts)) {
alias /var/avalon/rtmp_streams/$stream;
vod hls;
set $token "$arg_token";
add_header X-Stream-Auth-Token "$token";
sub_filter_types application/vnd.apple.mpegurl;
sub_filter_once off;
sub_filter '.ts' ".ts?token=$token";
auth_request /auth;
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
add_header Access-Control-Allow-Origin '*';
expires 100d;
}
location = /auth {
# resolver 127.0.0.1;
proxy_pass http://127.0.0.1/authorize.txt?token=$token&name=$stream;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
}
location /crossdomain.xml {
default_type text/xml;
return 200 '<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
</cross-domain-policy>';
expires 24h;
}
}
} |
Info |
---|
listen should use a public open port.
|
Add /etc/init.d/nginx.
For RHEL7 use this script.
Code Block |
---|
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: NGINX is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
# pidfile: /var/run/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0
nginx="/usr/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/etc/nginx/nginx.conf"
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
lockfile=/var/lock/subsys/nginx
make_dirs() {
# make required directories
user=`$nginx -V 2>&1 | grep "configure arguments:.*--user=" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
if [ -n "$user" ]; then
if [ -z "`grep $user /etc/passwd`" ]; then
useradd -M -s /bin/nologin $user
fi
options=`$nginx -V 2>&1 | grep 'configure arguments:'`
for opt in $options; do
if [ `echo $opt | grep '.*-temp-path'` ]; then
value=`echo $opt | cut -d "=" -f 2`
if [ ! -d "$value" ]; then
# echo "creating" $value
mkdir -p $value && chown -R $user $value
fi
fi
done
fi
}
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
make_dirs
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
configtest || return $?
stop
sleep 1
start
}
reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac |
Add nginx
user and let it own nginx stuff
Code Block |
---|
useradd -M -s /bin/nologin nginx
chown -R nginx:nginx /etc/nginx /var/log/nginx |
Start nginx
Code Block |
---|
chmod +x /etc/init.d/nginx
service nginx start |
Avalon config should be updated to be compatible with Nginx:
Code Block |
---|
streaming:
server: :nginx
http_base: 'http://localhost:8980/avalon' |
FFmpeg
Installation prerequisites
...
Properly formatted environment variables can also override Avalon settings. For example, SETTINGS__REDIS__HOST
will override
|
A list of config values can be found at Configuration Files#config/settings.yml
...