|
|
@@ -0,0 +1,120 @@ |
|
|
# install and configure Wowza Streaming Engine |
|
|
class profile::wowza { |
|
|
# Placeholder to install Wowza Streaming Engine (WowzaStreamingEngine-4.7.1-linux-x64-installer.run) |
|
|
|
|
|
$config = hiera('wowza') |
|
|
$audio_upstream = 'http://localhost:1935' |
|
|
$wowza_upstream = 'http://localhost:8088' |
|
|
$shoutcast_upstream = 'http://localhost:8000' |
|
|
|
|
|
# The following URLs are for management: |
|
|
# http://redwave-wowza.swmdigital.io/enginemanager/ |
|
|
# http://redwave-shoutcast.swmdigital.io/index.html |
|
|
# |
|
|
# The following URLs are our public API and must be preserved: |
|
|
# SHOUTcast playlist: |
|
|
# http://audio.redfm.com.au/listen.pls |
|
|
# http://audio.spiritradio.com.au/listen.pls |
|
|
# AAC stream (audio/aacp): |
|
|
# http://audio.redfm.com.au/shoutcast/redfmaudio/ |
|
|
# http://audio.spiritradio.com.au/shoutcast/spiritradioaudio/ |
|
|
# HLS (HTTP Live Streaming): |
|
|
# http://audio.redfm.com.au/live/RedFMAudio_aac128/playlist.m3u8 |
|
|
# http://audio.spiritradio.com.au/live/SpiritAudio_aac128/playlist.m3u8 |
|
|
|
|
|
# These are 'Resource default statements' which provide default values |
|
|
# for the three different vhosts (.conf files) in this manifest. |
|
|
Nginx::Resource::Vhost { |
|
|
ensure => 'present', |
|
|
listen_port => '80', |
|
|
ssl_port => '443', |
|
|
ssl => true, |
|
|
ssl_cert => "/etc/pki/tls/certs/${::fqdn}.crt", |
|
|
ssl_key => "/etc/pki/tls/private/${::fqdn}.key", |
|
|
use_default_location => false, |
|
|
proxy_set_header => [ |
|
|
'Host $host:$server_port', |
|
|
'X-Real-IP $remote_addr', |
|
|
'X-Forwarded-Host $http_host', |
|
|
'X-Forwarded-For $proxy_add_x_forwarded_for', |
|
|
'X-Forwarded-Proto $scheme', |
|
|
'Proxy ""', |
|
|
], |
|
|
} |
|
|
Nginx::Resource::Location { |
|
|
ensure => 'present', |
|
|
ssl => true, |
|
|
} |
|
|
|
|
|
# SHOUTcast management console |
|
|
nginx::resource::vhost { 'shoutcast' : |
|
|
server_name => $config['server_name_shoutcast'], |
|
|
proxy => $shoutcast_upstream, |
|
|
use_default_location => true, |
|
|
} |
|
|
|
|
|
# Wowza engine manager |
|
|
nginx::resource::vhost { 'wowza' : |
|
|
server_name => $config['server_name_wowza'], |
|
|
} |
|
|
nginx::resource::location { 'wowza /enginemanager/' : |
|
|
vhost => 'wowza', |
|
|
location => '/enginemanager/', |
|
|
proxy => $wowza_upstream, |
|
|
} |
|
|
nginx::resource::location { 'wowza = /' : |
|
|
vhost => 'wowza', |
|
|
location => '= /', |
|
|
location_custom_cfg => { |
|
|
'add_header' => 'Content-Type "text/plain" always', |
|
|
'return' => '404 "I have nothing for you\r\n"', |
|
|
}, |
|
|
} |
|
|
|
|
|
# The audio subdomains provide both HLS and SHOUTcast from different paths as |
|
|
# well as /listen.pls , the SHOUTcast playlist file. |
|
|
nginx::resource::vhost { 'audio' : |
|
|
server_name => $config['server_name_audio'], |
|
|
} |
|
|
nginx::resource::location { 'audio /live/' : |
|
|
vhost => 'audio', |
|
|
location => '/live/', |
|
|
proxy => $audio_upstream, |
|
|
} |
|
|
nginx::resource::location { 'audio /shoutcast/' : |
|
|
vhost => 'audio', |
|
|
location => '/shoutcast/', |
|
|
proxy => $shoutcast_upstream, |
|
|
} |
|
|
nginx::resource::location { 'audio = /listen.pls' : |
|
|
vhost => 'audio', |
|
|
location => '= /listen.pls', |
|
|
proxy => $shoutcast_upstream, |
|
|
location_cfg_append => { |
|
|
rewrite => '^(.*)$ /listen.pls?sid=$shoutcast_stream_id break', |
|
|
}, |
|
|
} |
|
|
nginx::resource::location { 'audio = /' : |
|
|
vhost => 'audio', |
|
|
location => '= /', |
|
|
location_custom_cfg => { |
|
|
'add_header' => 'Content-Type "text/plain" always', |
|
|
'return' => '404 "I have nothing for you\r\n"', |
|
|
}, |
|
|
} |
|
|
|
|
|
# For listen.pls (the SHOUTcast playlist) we need to add the 'sid' query |
|
|
# parameter (either '1' for RedFM or '2' for Spirit Radio). I chose to use |
|
|
# an Nginx map instead of a whole new vhost. |
|
|
nginx::resource::map { 'shoutcast_stream_id': |
|
|
ensure => 'present', |
|
|
default => '1', |
|
|
string => '$host', |
|
|
mappings => { |
|
|
'audio.redfm.com.au' => '1', |
|
|
'audio.spiritradio.com.au' => '2', |
|
|
'dev-audio.redfm.com.au' => '1', |
|
|
'dev-audio.spiritradio.com.au' => '2', |
|
|
} |
|
|
} |
|
|
} |