Skip to content
Snippets Groups Projects
Commit 8050be13 authored by Stéphane Diemer's avatar Stéphane Diemer
Browse files

Cleaned history.

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 1088 additions and 0 deletions
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import utils
def setup(interactive=True):
# Get hostname
utils.log('Getting system hostname.')
code, out = utils.exec_cmd(['hostname'], get_out=True)
if code == 0:
hostname = out
utils.log('Hostname is %s.' % hostname)
else:
raise Exception('Failed to get hostname.')
# Install and configure postfix
dir_path = utils.get_dir(__file__)
cmds = [
'apt-get update',
'DEBIAN_FRONTEND=noninteractive apt-get -y install postfix mailutils',
'echo "Replacing /etc/postfix/main.cf"',
dict(line='write', template='%s/main.cf' % dir_path, target='/etc/postfix/main.cf', params=(
('{{ hostname }}', hostname),
('{{ smtp }}', utils.get_conf('system_smtp', '')),
)),
'echo "%s" > /etc/mailname' % hostname,
'rgrep root /etc/aliases || echo "root: sysadmin@ubicast.eu" >> /etc/aliases',
'service postfix restart',
'newaliases',
]
utils.run_commands(cmds)
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = {{ hostname }}
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
#virtual_maps = hash:/etc/postfix/virtual
myorigin = /etc/mailname
mydestination = {{ hostname }} localhost
relayhost = {{ smtp }}
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = localhost
inet_protocols = ipv4
default_transport = smtp
relay_transport = smtp
disable_vrfy_command=yes
#!/bin/bash
source /root/envsetup/envsetup.conf
# installation mediaserver
DEBIAN_FRONTEND=noninteractive apt-get install -y python3-mediaserver
# session ms
msinstaller.py msuser
# disabling integrated worker if needed
if [ ${IS_WORKER} = "0" ]; then
apt-get remove -y celerity-workers
fi
# mv MS_deploy.sh to /var/tmp
mv MS_deploy.sh /var/tmp/MS_deploy.sh
#!/bin/bash
# Admin menu : to be deployed on each MediaServer
# Customer should arrive on it after each SSH connexion with login admin
BACKTITLE='MediaServer Deployement'
## Load already set up parameters
MS_IP0=$(grep address /etc/network/interfaces | awk '{print$2}')
MS_NETMASK0=$(grep netmask /etc/network/interfaces | awk '{print$2}')
MS_GATEWAY0=$(grep gateway /etc/network/interfaces | awk '{print$2}')
MS_DNS10=$(grep nameserver /etc/resolv.conf | head -1 | awk '{print$2}')
MS_DNS20=$(grep nameserver /etc/resolv.conf | tail -1 | awk '{print$2}')
MS_NTP0=$(grep ^server /etc/ntp.conf | tail -1 | awk '{print$2}')
MS_VHOST0=$(grep server_name /etc/nginx/sites-available/mediaserver-msuser.conf | head -1 | awk '{print$2}' | awk -F ";" '{print$1}')
MS_STREAMVHOST0=$(grep server_name /etc/nginx/sites-available/streaming.conf | head -1 | awk '{print$2}' | awk -F ";" '{print$1}')
MS_VIDEOVHOST0=$(grep server_name /etc/nginx/sites-available/videos.conf | head -1 | awk '{print$2}' | awk -F ";" '{print$1}')
MS_CMVHOST0=$(grep server_name /etc/nginx/sites-available/skyreach.conf | head -1 | awk '{print$2}' | awk -F ";" '{print$1}')
MS_MONVHOST0=$(grep server_name /etc/nginx/sites-available/msmonitor.conf | head -1 | awk '{print$2}' | awk -F ";" '{print$1}')
## Screens
dialog --backtitle "${BACKTITLE}" --title "Perform customization" --yesno "Welcome to UbiCast MediaServer customization tool." 8 70
if [ $? != 0 ]
then
dialog --backtitle "${BACKTITLE}" --title "Perform customization" --msgbox "MediaServer deployement cancelled." 8 70
exit
fi
# Network parameters
MS_IP=$(dialog --backtitle "${BACKTITLE}" --title "Network configuration" --inputbox "MediaServer IP ?" 8 50 ${MS_IP0} --output-fd 1)
MS_NETMASK=$(dialog --backtitle "${BACKTITLE}" --title "Network configuration" --inputbox "Netmask ?" 8 50 ${MS_NETMASK0} --output-fd 1)
MS_GATEWAY$(dialog --backtitle "${BACKTITLE}" --title "Network configuration" --inputbox "Gateway ?" 8 50 ${MS_GATEWAY0} --output-fd 1)
MS_DNS1=$(dialog --backtitle "${BACKTITLE}" --title "Network configuration" --inputbox "Main DNS ?" 8 50 ${MS_DNS10} --output-fd 1)
MS_DNS2=$(dialog --backtitle "${BACKTITLE}" --title "Network configuration" --inputbox "Secondary DNS ?" 8 50 ${MS_DNS20} --output-fd 1)
MS_NTP=$(dialog --backtitle "${BACKTITLE}" --title "Network configuration" --inputbox "NTP server ?" 8 50 ${MS_NTP0} --output-fd 1)
# vhosts
MS_VHOST=$(dialog --backtitle "${BACKTITLE}" --title "Webserver configuration" --inputbox "MS main URL (ie mediaserver.example.com)" 8 50 ${MS_VHOST0} --output-fd 1)
MS_STREAMVHOST=$(dialog --backtitle "${BACKTITLE}" --title "Webserver configuration" --inputbox "MS streaming URL (ie streaming-mediaserver.example.com)" 8 60 ${MS_STREAMVHOST0} --output-fd 1)
MS_VIDEOVHOST=$(dialog --backtitle "${BACKTITLE}" --title "Webserver configuration" --inputbox "MS video/FTP URL (ie video-mediaserver.example.com)" 8 60 ${MS_VIDEOVHOST0} --output-fd 1)
MS_CMVHOST=$(dialog --backtitle "${BACKTITLE}" --title "Webserver configuration" --inputbox "CampusManager URL (ie campusmanager.example.com)" 8 60 ${MS_CMVHOST0} --output-fd 1)
MS_MONVHOST=$(dialog --backtitle "${BACKTITLE}" --title "Webserver configuration" --inputbox "Monitor application URL (ie monitor-mediaserver.example.com)" 8 70 ${MS_MONVHOST0} --output-fd 1)
## Server configuration
# IP
sudo sed -i "s@address .*@address ${MS_IP}@" /etc/network/interfaces
sudo sed -i "s@netmask .*@netmask ${MS_NETMASK}@" /etc/network/interfaces
sudo sed -i "s@gateway .*@gateway ${MS_GATEWAY}@" /etc/network/interfaces
# DNS
sudo chown msinstall:root /etc/resolv.conf
sudo echo "nameserver ${MS_DNS1}" > /etc/resolv.conf
# test DNS2
if ( test -z ${MS_DNS2} )
then
echo "no 2nd DNS"
else
sudo echo "nameserver ${MS_DNS2}" >> /etc/resolv.conf
fi
sudo chown root:root /etc/resolv.conf
# NTP
sudo chown msinstall:root /etc/ntp.conf
sudo sed -i "s@^server .*@@" /etc/ntp.conf
sudo echo ${MS_NTP} >> /etc/ntp.conf
sudo chown root:root /etc/ntp.conf
# webserver
# ms
sudo sed -i "s@server_name .*@server_name ${MS_VHOST};@" /etc/nginx/sites-available/mediaserver-msuser.conf
# streaming
sudo sed -i "s@server_name .*@server_name ${MS_STREAMVHOST};@" /etc/nginx/sites-available/streaming.conf
# video
sudo sed -i "s@server_name .*@server_name ${MS_VIDEOVHOST};@" /etc/nginx/sites-available/videos.conf
# cm
sudo sed -i "s@server_name .*@server_name ${MS_CMVHOST};@" /etc/nginx/sites-available/skyreach.conf
# monitor
sudo sed -i "s@server_name .*@server_name ${MS_MONVHOST};@" /etc/nginx/sites-available/msmonitor.conf
# hca
sudo sed -i "s@base_url = .*@base_url = \"http://${MS_VIDEOVHOST}\"@" /etc/hca/http.ini
sudo sed -i "s@host = .*@host = \"${MS_VIDEOVHOST}\"@" /etc/hca/http.ini
sudo sed -i "s@server = .*@server = \"rtmp://${MS_STREAMVHOST}/vod\"@" /etc/hca/http.ini
sudo sed -i "s@server=.*@server=\"${MS_STREAMVHOST}\"@" /etc/hca/rtmp.ini
## Customization complete
dialog --backtitle "${BACKTITLE}" --title "Customization complete" --msgbox "Congratulations, your MS is now configured.
Press enter to reboot." 8 50
sudo reboot
#!/bin/bash
source /root/envsetup/envsetup.conf
# optimisations nginx
if ( test -f /etc/nginx/nginx.conf )
then
CPU=$(cat /proc/cpuinfo | grep processor | wc -l)
sed -i "s@worker_processes .*@worker_processes ${CPU};@" /etc/nginx/nginx.conf
service nginx restart
fi
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import utils
from shutil import copyfile
def setup(interactive=True):
dir_path = utils.get_dir(__file__)
wowza_setup_name = 'WowzaStreamingEngine-4.5.0-linux-x64-installer.deb'
utils.log('It may take a while to download the Wowza installer from the UbiCast server.')
if utils.exec_cmd('lsb_release -a | grep 14') == 0:
jre_package = 'openjdk-7-jre-headless' # 14.04
else:
jre_package = 'openjdk-8-jre-headless' # 16.04
cmds = [
'apt-get install -y %s' % jre_package,
# Get and install Wowza
'[ -f "/tmp/%(name)s" ] || wget -q "https://www.ubicast.eu/media/downloads/packages/%(name)s" -O "/tmp/%(name)s"' % {'name': wowza_setup_name},
'dpkg -i "/tmp/%s"' % wowza_setup_name,
# Configure Wowza
'echo "%s" > /usr/local/WowzaStreamingEngine/conf/Server.license' % utils.get_conf('wowza_license'),
'echo "ubicast %s admin" > /usr/local/WowzaStreamingEngine/conf/admin.password' % utils.get_conf('wowza_manager_pwd'),
'update-rc.d WowzaStreamingEngine defaults',
'update-rc.d WowzaStreamingEngineManager defaults',
'chmod +x /usr/local/WowzaStreamingEngine/logs',
'cp -R /usr/local/WowzaStreamingEngine/examples/LiveVideoStreaming/conf/live /usr/local/WowzaStreamingEngine/conf/',
'mkdir -p /usr/local/WowzaStreamingEngine/applications/live',
dict(line='write', template='%s/live-application.xml' % dir_path, target='/usr/local/WowzaStreamingEngine/conf/live/Application.xml', backup=True, params=(
('{{ live_pwd }}', utils.get_conf('wowza_live_pwd')),
)),
'/etc/init.d/WowzaStreamingEngine restart',
'/etc/init.d/WowzaStreamingEngineManager restart',
]
if utils.get_conf('wowza_server_name'):
cmds.append('mkdir -p /var/www/streaming')
if os.path.exists('/home/ftp/storage/www'):
cmds.extend([
'[ -d "/usr/local/WowzaStreamingEngine/content-back" ] || mv /usr/local/WowzaStreamingEngine/content /usr/local/WowzaStreamingEngine/content-back',
'ln -sfn /home/ftp/storage/www /usr/local/WowzaStreamingEngine/content',
])
utils.run_commands(cmds)
copyfile('%s/Tune.xml' % dir_path, '/usr/local/WowzaStreamingEngine/conf/Tune.xml')
utils.log('Edit /usr/local/WowzaStreamingEngine/conf/admin.password to change web manager access password.')
utils.log('Edit /usr/local/WowzaStreamingEngine/conf/Server.license to change license key.')
<?xml version="1.0" encoding="UTF-8"?>
<Root>
<Tune>
<!--
HeapSize
${com.wowza.wms.TuningHeapSizeProduction} - Assumes Wowza Streaming Engine is only application running on server
${com.wowza.wms.TuningHeapSizeDevelopment} - Assumes Wowza Streaming Engine is sharing resources with other applications
or specify heap size directly (ex: <HeapSize>8000M</HeapSize>)
-->
<HeapSize>${com.wowza.wms.TuningHeapSizeProduction}</HeapSize>
<!--
GarbageCollector
${com.wowza.wms.TuningGarbageCollectorConcurrentDefault} - Concurrent Collector (recommended)
${com.wowza.wms.TuningGarbageCollectorG1Default} - G1 (Garbage First) Collector
or specify custom GC settings directly (ex: <GarbageCollector>-XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:NewSize=512m</GarbageCollector>)
-->
<GarbageCollector>${com.wowza.wms.TuningGarbageCollectorG1Default}</GarbageCollector>
<!--
VM Options - other VM startup options
${com.wowza.wms.AppHome} - Application home directory
${com.wowza.wms.StartupDateTime} - Date and time the server was started
-->
<VMOptions>
<VMOption>-server</VMOption>
<VMOption>-Djava.net.preferIPv4Stack=true</VMOption>
<!-- <VMOption>-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="${com.wowza.wms.AppHome}/logs"</VMOption> -->
<!-- <VMOption>-Duser.language=en -Duser.country=US -Dfile.encoding=Cp1252</VMOption> -->
<!-- <VMOption>-verbose:gc -Xloggc:"${com.wowza.wms.AppHome}/logs/gc_${com.wowza.wms.StartupDateTime}.log" -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime</VMOption> -->
</VMOptions>
</Tune>
</Root>
<?xml version="1.0" encoding="UTF-8"?>
<Root version="1">
<Application>
<Name>live</Name>
<AppType>LiveHTTPOrigin</AppType>
<Description></Description>
<!-- Uncomment to set application level timeout values
<ApplicationTimeout>60000</ApplicationTimeout>
<PingTimeout>12000</PingTimeout>
<ValidationFrequency>8000</ValidationFrequency>
<MaximumPendingWriteBytes>0</MaximumPendingWriteBytes>
<MaximumSetBufferTime>60000</MaximumSetBufferTime>
<MaximumStorageDirDepth>25</MaximumStorageDirDepth>
-->
<Connections>
<AutoAccept>true</AutoAccept>
<AllowDomains></AllowDomains>
</Connections>
<!--
StorageDir path variables
${com.wowza.wms.AppHome} - Application home directory
${com.wowza.wms.ConfigHome} - Configuration home directory
${com.wowza.wms.context.VHost} - Virtual host name
${com.wowza.wms.context.VHostConfigHome} - Virtual host home directory
${com.wowza.wms.context.Application} - Application name
${com.wowza.wms.context.ApplicationInstance} - Application instance name
-->
<Streams>
<StreamType>live</StreamType>
<StorageDir>${com.wowza.wms.context.VHostConfigHome}/content</StorageDir>
<KeyDir>${com.wowza.wms.context.VHostConfigHome}/keys</KeyDir>
<!-- LiveStreamPacketizers (separate with commas): cupertinostreamingpacketizer, smoothstreamingpacketizer, sanjosestreamingpacketizer, mpegdashstreamingpacketizer, cupertinostreamingrepeater, smoothstreamingrepeater, sanjosestreamingrepeater, mpegdashstreamingrepeater, dvrstreamingpacketizer, dvrstreamingrepeater -->
<LiveStreamPacketizers>cupertinostreamingpacketizer, mpegdashstreamingpacketizer, sanjosestreamingpacketizer, smoothstreamingpacketizer</LiveStreamPacketizers>
<!-- Properties defined here will override any properties defined in conf/Streams.xml for any streams types loaded by this application -->
<Properties>
</Properties>
</Streams>
<Transcoder>
<!-- To turn on transcoder set to: transcoder -->
<LiveStreamTranscoder></LiveStreamTranscoder>
<!-- [templatename].xml or ${SourceStreamName}.xml -->
<Templates>${SourceStreamName}.xml,transrate.xml</Templates>
<ProfileDir>${com.wowza.wms.context.VHostConfigHome}/transcoder/profiles</ProfileDir>
<TemplateDir>${com.wowza.wms.context.VHostConfigHome}/transcoder/templates</TemplateDir>
<Properties>
</Properties>
</Transcoder>
<DVR>
<!-- As a single server or as an origin, use dvrstreamingpacketizer in LiveStreamPacketizers above -->
<!-- Or, in an origin-edge configuration, edges use dvrstreamingrepeater in LiveStreamPacketizers above -->
<!-- As an origin, also add dvrchunkstreaming to HTTPStreamers below -->
<!-- If this is a dvrstreamingrepeater, define Application/Repeater/OriginURL to point back to the origin -->
<!-- To turn on DVR recording set Recorders to dvrrecorder. This works with dvrstreamingpacketizer -->
<Recorders></Recorders>
<!-- As a single server or as an origin, set the Store to dvrfilestorage-->
<!-- edges should have this empty -->
<Store></Store>
<!-- Window Duration is length of live DVR window in seconds. 0 means the window is never trimmed. -->
<WindowDuration>0</WindowDuration>
<!-- Storage Directory is top level location where dvr is stored. e.g. c:/temp/dvr -->
<StorageDir>${com.wowza.wms.context.VHostConfigHome}/dvr</StorageDir>
<!-- valid ArchiveStrategy values are append, version, delete -->
<ArchiveStrategy>append</ArchiveStrategy>
<!-- Properties for DVR -->
<Properties>
</Properties>
</DVR>
<TimedText>
<!-- VOD caption providers (separate with commas): vodcaptionprovidermp4_3gpp, vodcaptionproviderttml, vodcaptionproviderwebvtt, vodcaptionprovidersrt, vodcaptionproviderscc -->
<VODTimedTextProviders>vodcaptionprovidermp4_3gpp</VODTimedTextProviders>
<!-- Properties for TimedText -->
<Properties>
</Properties>
</TimedText>
<!-- HTTPStreamers (separate with commas): cupertinostreaming, smoothstreaming, sanjosestreaming, mpegdashstreaming, dvrchunkstreaming -->
<HTTPStreamers>sanjosestreaming, cupertinostreaming, smoothstreaming, mpegdashstreaming</HTTPStreamers>
<MediaCache>
<MediaCacheSourceList></MediaCacheSourceList>
</MediaCache>
<SharedObjects>
<StorageDir>${com.wowza.wms.context.VHostConfigHome}/applications/${com.wowza.wms.context.Application}/sharedobjects/${com.wowza.wms.context.ApplicationInstance}</StorageDir>
</SharedObjects>
<Client>
<IdleFrequency>-1</IdleFrequency>
<Access>
<StreamReadAccess>*</StreamReadAccess>
<StreamWriteAccess>*</StreamWriteAccess>
<StreamAudioSampleAccess></StreamAudioSampleAccess>
<StreamVideoSampleAccess></StreamVideoSampleAccess>
<SharedObjectReadAccess>*</SharedObjectReadAccess>
<SharedObjectWriteAccess>*</SharedObjectWriteAccess>
</Access>
</Client>
<RTP>
<!-- RTP/Authentication/[type]Methods defined in Authentication.xml. Default setup includes; none, basic, digest -->
<Authentication>
<PublishMethod>digest</PublishMethod>
<PlayMethod>none</PlayMethod>
</Authentication>
<!-- RTP/AVSyncMethod. Valid values are: senderreport, systemclock, rtptimecode -->
<AVSyncMethod>senderreport</AVSyncMethod>
<MaxRTCPWaitTime>12000</MaxRTCPWaitTime>
<IdleFrequency>75</IdleFrequency>
<RTSPSessionTimeout>90000</RTSPSessionTimeout>
<RTSPMaximumPendingWriteBytes>0</RTSPMaximumPendingWriteBytes>
<RTSPBindIpAddress></RTSPBindIpAddress>
<RTSPConnectionIpAddress>0.0.0.0</RTSPConnectionIpAddress>
<RTSPOriginIpAddress>127.0.0.1</RTSPOriginIpAddress>
<IncomingDatagramPortRanges>*</IncomingDatagramPortRanges>
<!-- Properties defined here will override any properties defined in conf/RTP.xml for any depacketizers loaded by this application -->
<Properties>
</Properties>
</RTP>
<MediaCaster>
<RTP>
<RTSP>
<!-- udp, interleave -->
<RTPTransportMode>interleave</RTPTransportMode>
</RTSP>
</RTP>
<StreamValidator></StreamValidator>
<!-- Properties defined here will override any properties defined in conf/MediaCasters.xml for any MediaCasters loaded by this applications -->
<Properties>
</Properties>
</MediaCaster>
<MediaReader>
<!-- Properties defined here will override any properties defined in conf/MediaReaders.xml for any MediaReaders loaded by this applications -->
<Properties>
</Properties>
</MediaReader>
<MediaWriter>
<!-- Properties defined here will override any properties defined in conf/MediaWriter.xml for any MediaWriter loaded by this applications -->
<Properties>
</Properties>
</MediaWriter>
<LiveStreamPacketizer>
<!-- Properties defined here will override any properties defined in conf/LiveStreamPacketizers.xml for any LiveStreamPacketizers loaded by this applications -->
<Properties>
<Property>
<Name>httpRandomizeMediaName</Name>
<Value>true</Value>
<Type>Boolean</Type>
</Property>
<Property>
<Name>cupertinoChunkDurationTarget</Name>
<Value>2000</Value>
<Type>Integer</Type>
</Property>
</Properties>
</LiveStreamPacketizer>
<HTTPStreamer>
<!-- Properties defined here will override any properties defined in conf/HTTPStreamers.xml for any HTTPStreamer loaded by this applications -->
<Properties>
<Property>
<Name>httpOriginMode</Name>
<Value>on</Value>
<Type>String</Type>
</Property>
<Property>
<Name>cupertinoCacheControlPlaylist</Name>
<Value>max-age=1</Value>
<Type>String</Type>
</Property>
<Property>
<Name>cupertinoCacheControlMediaChunk</Name>
<Value>max-age=3600</Value>
<Type>String</Type>
</Property>
<Property>
<Name>smoothCacheControlPlaylist</Name>
<Value>max-age=1</Value>
<Type>String</Type>
</Property>
<Property>
<Name>smoothCacheControlMediaChunk</Name>
<Value>max-age=3600</Value>
<Type>String</Type>
</Property>
<Property>
<Name>smoothCacheControlDataChunk</Name>
<Value>max-age=3600</Value>
<Type>String</Type>
</Property>
<Property>
<Name>smoothStreamingEncryptionRandomIV</Name>
<Value>false</Value>
<Type>Boolean</Type>
</Property>
<Property>
<Name>sanjoseCacheControlPlaylist</Name>
<Value>max-age=1</Value>
<Type>String</Type>
</Property>
<Property>
<Name>sanjoseCacheControlMediaChunk</Name>
<Value>max-age=3600</Value>
<Type>String</Type>
</Property>
<Property>
<Name>mpegdashCacheControlPlaylist</Name>
<Value>max-age=1</Value>
<Type>String</Type>
</Property>
<Property>
<Name>mpegdashCacheControlMediaChunk</Name>
<Value>max-age=3600</Value>
<Type>String</Type>
</Property>
</Properties>
</HTTPStreamer>
<Manager>
<!-- Properties defined are used by the Manager -->
<Properties>
</Properties>
</Manager>
<Repeater>
<OriginURL></OriginURL>
<QueryString><![CDATA[]]></QueryString>
</Repeater>
<StreamRecorder>
<Properties>
</Properties>
</StreamRecorder>
<Modules>
<Module>
<Name>base</Name>
<Description>Base</Description>
<Class>com.wowza.wms.module.ModuleCore</Class>
</Module>
<Module>
<Name>logging</Name>
<Description>Client Logging</Description>
<Class>com.wowza.wms.module.ModuleClientLogging</Class>
</Module>
<Module>
<Name>flvplayback</Name>
<Description>FLVPlayback</Description>
<Class>com.wowza.wms.module.ModuleFLVPlayback</Class>
</Module>
<Module>
<Name>ModuleCoreSecurity</Name>
<Description>Core Security Module for Applications</Description>
<Class>com.wowza.wms.security.ModuleCoreSecurity</Class>
</Module>
</Modules>
<!-- Properties defined here will be added to the IApplication.getProperties() and IApplicationInstance.getProperties() collections -->
<Properties>
<Property>
<Name>securityPublishRequirePassword</Name>
<Value>false</Value>
<Type>Boolean</Type>
</Property>
<Property>
<Name>secureurlparams.publish</Name>
<Value>{{ live_pwd }}</Value>
<Type>String</Type>
</Property>
</Properties>
</Application>
</Root>
<?xml version="1.0" encoding="UTF-8"?>
<Root version="1">
<Application>
<Name>live</Name>
<AppType>Live</AppType>
<Description>Default application for live streaming created when Wowza Streaming Engine is installed. Use this application with its default configuration or modify the configuration as needed. You can also copy it to create another live application.</Description>
<!-- Uncomment to set application level timeout values
<ApplicationTimeout>60000</ApplicationTimeout>
<PingTimeout>12000</PingTimeout>
<ValidationFrequency>8000</ValidationFrequency>
<MaximumPendingWriteBytes>0</MaximumPendingWriteBytes>
<MaximumSetBufferTime>60000</MaximumSetBufferTime>
<MaximumStorageDirDepth>25</MaximumStorageDirDepth>
-->
<Connections>
<AutoAccept>true</AutoAccept>
<AllowDomains></AllowDomains>
</Connections>
<!--
StorageDir path variables
${com.wowza.wms.AppHome} - Application home directory
${com.wowza.wms.ConfigHome} - Configuration home directory
${com.wowza.wms.context.VHost} - Virtual host name
${com.wowza.wms.context.VHostConfigHome} - Virtual host config directory
${com.wowza.wms.context.Application} - Application name
${com.wowza.wms.context.ApplicationInstance} - Application instance name
-->
<Streams>
<StreamType>live</StreamType>
<StorageDir>${com.wowza.wms.context.VHostConfigHome}/content</StorageDir>
<KeyDir>${com.wowza.wms.context.VHostConfigHome}/keys</KeyDir>
<!-- LiveStreamPacketizers (separate with commas): cupertinostreamingpacketizer, smoothstreamingpacketizer, sanjosestreamingpacketizer, mpegdashstreamingpacketizer, cupertinostreamingrepeater, smoothstreamingrepeater, sanjosestreamingrepeater, mpegdashstreamingrepeater -->
<LiveStreamPacketizers>cupertinostreamingpacketizer, mpegdashstreamingpacketizer, sanjosestreamingpacketizer, smoothstreamingpacketizer</LiveStreamPacketizers>
<!-- Properties defined here will override any properties defined in conf/Streams.xml for any streams types loaded by this application -->
<Properties>
</Properties>
</Streams>
<Transcoder>
<!-- To turn on transcoder set to: transcoder -->
<LiveStreamTranscoder></LiveStreamTranscoder>
<!-- [templatename].xml or ${SourceStreamName}.xml -->
<Templates>${SourceStreamName}.xml,transrate.xml</Templates>
<ProfileDir>${com.wowza.wms.context.VHostConfigHome}/transcoder/profiles</ProfileDir>
<TemplateDir>${com.wowza.wms.context.VHostConfigHome}/transcoder/templates</TemplateDir>
<Properties>
</Properties>
</Transcoder>
<DVR>
<!-- As a single server or as an origin, use dvrstreamingpacketizer in LiveStreamPacketizers above -->
<!-- Or, in an origin-edge configuration, edges use dvrstreamingrepeater in LiveStreamPacketizers above -->
<!-- As an origin, also add dvrchunkstreaming to HTTPStreamers below -->
<!-- If this is a dvrstreamingrepeater, define Application/Repeater/OriginURL to point back to the origin -->
<!-- To turn on DVR recording set Recorders to dvrrecorder. This works with dvrstreamingpacketizer -->
<Recorders></Recorders>
<!-- As a single server or as an origin, set the Store to dvrfilestorage-->
<!-- edges should have this empty -->
<Store></Store>
<!-- Window Duration is length of live DVR window in seconds. 0 means the window is never trimmed. -->
<WindowDuration>0</WindowDuration>
<!-- Storage Directory is top level location where dvr is stored. e.g. c:/temp/dvr -->
<StorageDir>${com.wowza.wms.context.VHostConfigHome}/dvr</StorageDir>
<!-- valid ArchiveStrategy values are append, version, delete -->
<ArchiveStrategy>append</ArchiveStrategy>
<!-- Properties for DVR -->
<Properties>
</Properties>
</DVR>
<TimedText>
<!-- VOD caption providers (separate with commas): vodcaptionprovidermp4_3gpp, vodcaptionproviderttml, vodcaptionproviderwebvtt, vodcaptionprovidersrt, vodcaptionproviderscc -->
<VODTimedTextProviders></VODTimedTextProviders>
<!-- Properties for TimedText -->
<Properties>
</Properties>
</TimedText>
<!-- HTTPStreamers (separate with commas): cupertinostreaming, smoothstreaming, sanjosestreaming, mpegdashstreaming, dvrchunkstreaming -->
<HTTPStreamers>cupertinostreaming, smoothstreaming, sanjosestreaming, mpegdashstreaming</HTTPStreamers>
<MediaCache>
<MediaCacheSourceList></MediaCacheSourceList>
</MediaCache>
<SharedObjects>
<StorageDir>${com.wowza.wms.context.VHostConfigHome}/applications/${com.wowza.wms.context.Application}/sharedobjects/${com.wowza.wms.context.ApplicationInstance}</StorageDir>
</SharedObjects>
<Client>
<IdleFrequency>-1</IdleFrequency>
<Access>
<StreamReadAccess>*</StreamReadAccess>
<StreamWriteAccess>*</StreamWriteAccess>
<StreamAudioSampleAccess></StreamAudioSampleAccess>
<StreamVideoSampleAccess></StreamVideoSampleAccess>
<SharedObjectReadAccess>*</SharedObjectReadAccess>
<SharedObjectWriteAccess>*</SharedObjectWriteAccess>
</Access>
</Client>
<RTP>
<!-- RTP/Authentication/[type]Methods defined in Authentication.xml. Default setup includes; none, basic, digest -->
<Authentication>
<PublishMethod>digest</PublishMethod>
<PlayMethod>none</PlayMethod>
</Authentication>
<!-- RTP/AVSyncMethod. Valid values are: senderreport, systemclock, rtptimecode -->
<AVSyncMethod>senderreport</AVSyncMethod>
<MaxRTCPWaitTime>12000</MaxRTCPWaitTime>
<IdleFrequency>75</IdleFrequency>
<RTSPSessionTimeout>90000</RTSPSessionTimeout>
<RTSPMaximumPendingWriteBytes>0</RTSPMaximumPendingWriteBytes>
<RTSPBindIpAddress></RTSPBindIpAddress>
<RTSPConnectionIpAddress>0.0.0.0</RTSPConnectionIpAddress>
<RTSPOriginIpAddress>127.0.0.1</RTSPOriginIpAddress>
<IncomingDatagramPortRanges>*</IncomingDatagramPortRanges>
<!-- Properties defined here will override any properties defined in conf/RTP.xml for any depacketizers loaded by this application -->
<Properties>
</Properties>
</RTP>
<MediaCaster>
<RTP>
<RTSP>
<!-- udp, interleave -->
<RTPTransportMode>interleave</RTPTransportMode>
</RTSP>
</RTP>
<StreamValidator>
<Enable>true</Enable>
<ResetNameGroups>true</ResetNameGroups>
<StreamStartTimeout>20000</StreamStartTimeout>
<StreamTimeout>12000</StreamTimeout>
<VideoStartTimeout>0</VideoStartTimeout>
<VideoTimeout>0</VideoTimeout>
<AudioStartTimeout>0</AudioStartTimeout>
<AudioTimeout>0</AudioTimeout>
<VideoTCToleranceEnable>false</VideoTCToleranceEnable>
<VideoTCPosTolerance>3000</VideoTCPosTolerance>
<VideoTCNegTolerance>-500</VideoTCNegTolerance>
<AudioTCToleranceEnable>false</AudioTCToleranceEnable>
<AudioTCPosTolerance>3000</AudioTCPosTolerance>
<AudioTCNegTolerance>-500</AudioTCNegTolerance>
<DataTCToleranceEnable>false</DataTCToleranceEnable>
<DataTCPosTolerance>3000</DataTCPosTolerance>
<DataTCNegTolerance>-500</DataTCNegTolerance>
<AVSyncToleranceEnable>false</AVSyncToleranceEnable>
<AVSyncTolerance>1500</AVSyncTolerance>
<DebugLog>false</DebugLog>
</StreamValidator>
<!-- Properties defined here will override any properties defined in conf/MediaCasters.xml for any MediaCasters loaded by this applications -->
<Properties>
</Properties>
</MediaCaster>
<MediaReader>
<!-- Properties defined here will override any properties defined in conf/MediaReaders.xml for any MediaReaders loaded by this applications -->
<Properties>
</Properties>
</MediaReader>
<MediaWriter>
<!-- Properties defined here will override any properties defined in conf/MediaWriter.xml for any MediaWriter loaded by this applications -->
<Properties>
</Properties>
</MediaWriter>
<LiveStreamPacketizer>
<!-- Properties defined here will override any properties defined in conf/LiveStreamPacketizers.xml for any LiveStreamPacketizers loaded by this applications -->
<Properties>
<Property>
<Name>cupertinoChunkDurationTarget</Name>
<Value>2000</Value>
<Type>Integer</Type>
</Property>
<Property>
<Name>httpRandomizeMediaName</Name>
<Value>true</Value>
<Type>Boolean</Type>
</Property>
</Properties>
</LiveStreamPacketizer>
<HTTPStreamer>
<!-- Properties defined here will override any properties defined in conf/HTTPStreamers.xml for any HTTPStreamer loaded by this applications -->
<Properties>
</Properties>
</HTTPStreamer>
<Manager>
<!-- Properties defined are used by the Manager -->
<Properties>
</Properties>
</Manager>
<Repeater>
<OriginURL></OriginURL>
<QueryString><![CDATA[]]></QueryString>
</Repeater>
<StreamRecorder>
<Properties>
</Properties>
</StreamRecorder>
<Modules>
<Module>
<Name>base</Name>
<Description>Base</Description>
<Class>com.wowza.wms.module.ModuleCore</Class>
</Module>
<Module>
<Name>logging</Name>
<Description>Client Logging</Description>
<Class>com.wowza.wms.module.ModuleClientLogging</Class>
</Module>
<Module>
<Name>flvplayback</Name>
<Description>FLVPlayback</Description>
<Class>com.wowza.wms.module.ModuleFLVPlayback</Class>
</Module>
<Module>
<Name>ModuleSecureUrlParams</Name>
<Description>Legacy security</Description>
<Class>com.wowza.wms.security.ModuleSecureURLParams</Class>
</Module>
</Modules>
<!-- Properties defined here will be added to the IApplication.getProperties() and IApplicationInstance.getProperties() collections -->
<Properties>
<Property>
<Name>securityPublishRequirePassword</Name>
<Value>false</Value>
<Type>Boolean</Type>
</Property>
<Property>
<Name>secureurlparams.publish</Name>
<Value>{{ live_pwd }}.doPublish</Value>
<Type>String</Type>
</Property>
</Properties>
</Application>
</Root>
#!/bin/bash
SELF=$( basename $0 )
usage () {
cat >&2 <<EOF
usage: $SELF [-h] [-f] wowza-archive
-h, --help This help message!
-f, --force Disable dry run mode (default is enabled).
Use this to really run command(s) instead of print them.
-x, --extract ONLY extract Debian package from official binary archive.
wowza-archive Could be (local or remote):
- an official binary archive from Wowza Media Systems, or
- a Debian package extracted from official binary archive.
http://www.wowza.com/downloads/WowzaStreamingEngine-4-1-2/WowzaStreamingEngine-4.1.2.deb.bin
or
http://ubicast.eu/medias/downloads/packages/WowzaStreamingEngine-4.1.2.deb.bin
or
./WowzaStreamingEngine-4.1.2.deb
EOF
exit 1
}
check_root () {
if [ $( id -u ) -ne 0 ]; then
echo "This script MUST be run as root." >&2
echo "Try: sudo $0 $@" >&2
exit 1
fi
}
error () {
echo "Error: $1" >&2
exit 1
}
DRYRUN=1
run () {
case "$DRYRUN" in
0) "$@" ;;
1) echo "$@" >&2 ;;
esac
return $?
}
exit_script () {
if [ "$DRYRUN" = "1" ]; then
echo "Warning: Dry run is enabled. Use '-f' to really run commands." >&2
fi
exit $1
}
parse () {
while [ -n "$1" ]; do
case "$1" in
-h|--help) usage ;;
-f|--force) DRYRUN=0 ;;
-x|--extract) ONLY_EXTRACT='yes' ;;
*) WOWZA_SRC="$1" ;;
esac
shift
done
[ -n "$WOWZA_SRC" ] || usage
}
is_url () {
echo "$1" | grep -q '^https\?://.*'
}
get_url () {
run wget -q "$1" -O "$2"
[ $? -eq 0 ] || error "Error: Could not download $1"
}
is_debian_pkg () {
file "$1" | grep -q '.*: Debian binary package .*'
}
stop_wowza () {
run /etc/init.d/WowzaStreamingEngineManager stop
run /etc/init.d/WowzaStreamingEngine stop
}
start_wowza () {
run /etc/init.d/WowzaStreamingEngine start
run /etc/init.d/WowzaStreamingEngineManager start
}
get_wowza_path () {
[ -e "$1" -a -L "$1" ] && readlink -f "$1"
}
WOWZA_DEB_OFFSET=1410
extract_wowza_deb () {
run /bin/sh -c "tail -n +$WOWZA_DEB_OFFSET $1 > $2"
[ $? -eq 0 ] || error "Could not extract Debian package from $1"
}
install_wowza_deb () {
run dpkg --install "$1"
[ $? -eq 0 ] || error "Could not install Debian package $1"
}
# Preambule
parse $@
[ "$DRYRUN" = "0" -a -z "$ONLY_EXTRACT" ] && check_root $@
# Get Wowza archive from url
if is_url "$WOWZA_SRC"; then
WOWZA_TMP="${WOWZA_SRC##*/}"
get_url "$WOWZA_SRC" "$WOWZA_TMP"
elif [ -f "$WOWZA_SRC" ]; then
WOWZA_TMP="$WOWZA_SRC"
else
error "$WOWZA_SRC is not a regular file."
fi
# Extract Debian package from Wowza binary archive
if ! is_debian_pkg "$WOWZA_TMP"; then
WOWZA_DEB="${WOWZA_TMP%.deb.bin}.deb"
extract_wowza_deb "$WOWZA_TMP" "$WOWZA_DEB"
[ "$WOWZA_SRC" != "$WOWZA_TMP" ] && run rm -f "$WOWZA_TMP"
[ -n "$ONLY_EXTRACT" ] && exit_script 0
else
WOWZA_DEB="$WOWZA_TMP"
fi
# Search previous version
WOWZA_SYMLINK='/usr/local/WowzaStreamingEngine'
WOWZA_CURRENT="$( get_wowza_path "$WOWZA_SYMLINK" )"
[ -n "$WOWZA_CURRENT" ] || error "Could not found previous install of Wowza."
# Stop Wowza services
stop_wowza
# Install new version
install_wowza_deb "$WOWZA_DEB"
[ "$WOWZA_TMP" != "$WOWZA_DEB" ] && run rm -f "$WOWZA_DEB"
if [ "$DRYRUN" = "0" ]; then
WOWZA_NEW="$( get_wowza_path "$WOWZA_SYMLINK" )"
if [ -n "$WOWZA_NEW" -a "$WOWZA_NEW" != "$WOWZA_CURRENT" ]; then
echo "$( basename "$WOWZA_CURRENT" ) -> $( basename "$WOWZA_NEW" )" >&2
else
error "Wowza update failed!"
fi
fi
# Restore configuration of previous version
run cp -a "$WOWZA_CURRENT/conf/" "$WOWZA_SYMLINK/"
run cp -a "$WOWZA_CURRENT/applications/" "$WOWZA_SYMLINK/"
if [ -d "/home/ftp/storage/www" ]; then
[ -d "$WOWZA_SYMLINK/content" ] && run rm -rf "$WOWZA_SYMLINK/content"
run ln -s "/home/ftp/storage/www" "$WOWZA_SYMLINK/content"
fi
# Restart Wowza services
start_wowza
exit_script 0
#!/bin/bash
source /root/envsetup/envsetup.conf
#APT_CACHE_PASSWD=$(cat ${CONF} | egrep ^APT_CACHE_PASSWD | head -1 | awk -F "=" '{print$2}')
APT_CACHE_PASSWD=$(pwgen 12)
# installation cm
aptitude install -y campus-manager
# installation cache local
aptitude install -y apt-cacher-ng
# secure it
echo "AdminAuth: ${APT_CACHE_USER}:${APT_CACHE_PASSWD}" >> /etc/apt-cacher-ng/security.conf
service apt-cacher-ng restart
# proxy
if [ ${PROXY} = "1" ]
then
if [ ${PROXY_AUTHENTICATION} = "1" ]
then
# general settings
echo "Proxy: http://${PROXY_USER}:${PROXY_PASSWD}@${PROXY_HTTP}:${PROXY_PORT}" >> /etc/apt-cacher-ng/acng.conf
else
# general settings
echo "Proxy: http://${PROXY_HTTP}:${PROXY_PORT}" >> /etc/apt-cacher-ng/acng.conf
fi
fi
# configure nginx
python3 /root/envsetup/envsetup.py 7
# devrait être inutile mais pb constaté avec jenkins
sed -i "s@server_name skyreach;@server_name ${CM};@" /etc/nginx/sites-available/skyreach.conf
#~mv /etc/nginx/sites-enabled/skyreach.conf.tmp /etc/nginx/sites-enabled/skyreach.conf
service nginx restart
# iptables rules for port 3142
DEBIAN_FRONTEND=noninteractive aptitude install -y iptables-persistent
update-rc.d iptables-persistent enable
iptables -A INPUT -p tcp -s localhost --destination-port 3142 -j ACCEPT
iptables -A INPUT -p tcp --destination-port 3142 -j DROP
service iptables-persistent save
LIG=$(grep -n "^iface lo inet loopback" /etc/network/interfaces | awk -F ":" '{print$1}')
LIG=$(( ${LIG} + 1 ))
sed -i "${LIG}i\pre-up iptables-restore < /etc/iptables/rules.v4" /etc/network/interfaces
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import utils
def setup(interactive=True):
dir_path = utils.get_dir(__file__)
cmds = []
# http.ini
ftpmsuploader = utils.get_conf('ftp_ftpmsuploader')
ftpstorage = utils.get_conf('ftp_ftpstorage')
ftpadmin = utils.get_conf('ftp_ftpadmin')
if ftpmsuploader and ftpstorage and ftpadmin:
cmds.append('mkdir -p /etc/hca')
cmds.append(dict(line='write', template='%s/http.ini' % dir_path, target='/etc/hca/http.ini', params=(
('{{ ms_server_name }}', utils.get_conf('ms_server_name', 'mediaserver')),
('{{ ftp_server_name }}', utils.get_conf('ftp_server_name', 'videos')),
('{{ ftp_storage_pwd }}', ftpstorage),
('{{ ftp_msuploader_pwd }}', ftpmsuploader),
('{{ ftp_admin_pwd }}', ftpadmin),
)))
else:
print('Configuration of HCA http.ini file skipped (no FTP passwords in config).')
# rtmp.ini
streaming_pwd = utils.get_conf('wowza_live_pwd')
if streaming_pwd:
cmds.append('mkdir -p /etc/hca')
cmds.append(dict(line='write', template='%s/rtmp.ini' % dir_path, target='/etc/hca/rtmp.ini', params=(
('{{ ms_server_name }}', utils.get_conf('ms_server_name', 'mediaserver')),
('{{ streaming_pwd }}', streaming_pwd),
)))
else:
print('Configuration of HCA rtmp.ini file skipped (no live password in config).')
if cmds:
utils.run_commands(cmds)
[http]
base_url = "https://{{ ftp_server_name }}"
pattern = "%(video_path)s"
[storage]
type = "ftp"
host = "{{ ftp_server_name }}"
user = "ftpstorage"
password = "{{ ftp_storage_pwd }}"
#[rtmp]
#server = "rtmp://{{ ms_server_name }}/vod"
#pattern = "%(video_path)s"
#[hls]
# requires a valid rtmp server that supports dynamic hls fragmenting
#enable = "true"
#pattern = "https://%(rtmp_host)s/_definst_/%(video_path)s/Playlist.m3u8"
[mediaserver]
username = "ftpmsuploader"
password = "{{ ftp_msuploader_pwd }}"
admin_username = "ftpadmin"
admin_password = "{{ ftp_admin_pwd }}"
base_dir = "/home/ftp/storage/"
www_dir_name = "www"
uploads_dir_name = "msuploads"
is_local = "true"
allow_ftp_upload = "true"
port=1935
server="{{ ms_server_name }}"
app="live/_definst_?doPublish={{ streaming_pwd }}"
enable_hls="yes"
hls_uri_template="https://{{ ms_server_name }}/streaming/%(stream_id)s/Playlist.m3u8"
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import utils
def setup(interactive=True):
dir_path = utils.get_dir(__file__)
cmds = [
'apt-get install --yes celerity-server',
dict(line='write', template='%s/celerity-config.py' % dir_path, target='/etc/celerity/config.py', params=(
('{{ signing_key }}', utils.get_conf('celerity_signing_key', 'undefined')),
('{{ ms_server_name }}', utils.get_conf('ms_server_name', 'undefined')),
('{{ ms_id }}', utils.get_conf('ms_id', 'ms_id')),
('{{ ms_api_key }}', utils.get_conf('ms_api_key', 'ms_api_key')),
)),
'service celerity-server restart',
]
utils.run_commands(cmds)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
SIGNING_KEY = '{{ signing_key }}'
# MediaServer interactions
MEDIASERVERS = {
'{{ ms_id }}': {'url': 'https://{{ ms_server_name }}', 'api_key': '{{ ms_api_key }}'},
}
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import utils
def setup(interactive=True):
dir_path = utils.get_dir(__file__)
cmds = [
'apt-get install --yes celerity-workers',
dict(line='write', template='%s/celerity-config.py' % dir_path, target='/etc/celerity/config.py', params=(
('{{ signing_key }}', utils.get_conf('celerity_signing_key', 'undefined')),
('{{ ms_server_name }}', utils.get_conf('ms_server_name', 'undefined')),
('{{ ms_id }}', utils.get_conf('ms_id', 'ms_id')),
('{{ ms_api_key }}', utils.get_conf('ms_api_key', 'ms_api_key')),
)),
'service celerity-workers restart',
]
utils.run_commands(cmds)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment