Loading ...
close

Would you like to discuss your environment with a knowledgable engineer?

Preferred communication *

Thank you. We will be in touch with you shortly

Getting started with Adobe Media Server

This guide will help you get started with using aiScaler as a edge server for Adobe Media Server (AMS). If your target platform is Amazon AWS, please see Adobe Flash Media Server on AWS.

We’ll do some modifications to a standard AMS installation and then configure aiScaler.

Prerequisites

Preparations

Before starting we need to determine a few things about your setup. We’ll write these things down in a shell-friendly way which you can copy and paste it into the terminal. You will have to do on both servers.

A few of these variables you’ll need to change, others you can leave as-is if you installed Adobe Media Server with default settings.

Explanation of variables

DNSDomain Your DNS domain name, e.g. mycompany.com
EVENTNAME # The subdomain of your event page. “company-outing” as EVENTNAME and mycompany.com as DNSDomain will mean your AMS server will be available as company-outing.mycompany.com.
FMSIP The IP of the AMS server
AICACHE_LICENCE_FILE Full path to your aiScaler licence file
BITRATE Default bitrate for streams
export FMS=ams Current abbreviation used by AMS, which used to be Flash Media Server. If you have an old version you might have to change this to “fms”.
FMSPATH Path to your AMS installation
FMSUSER User which AMS runs as
FMSGROUP Group which AMS runs as
FQDN Fully Qualified Domain Name of your server. Change this if “hostname -f” does not return the correct hostname for your host.

 

export DNSDomain=”example.com”
export EVENTNAME=”myevent”
export FMSIP=192.168.122.22
export AISCALER_LICENCE_FILE=/usr/local/aicache/4176440773.demo
export BITRATE=”350″
export FMS=ams
export FMSPATH=/opt/adobe/$FMS
export FMSUSER=$FMS
export FMSGROUP=$FMS
export FQDN=$(hostname -f)

Configuration changes on the AMS server

Start off by logging on to your AMS server and becoming root. Copy and paste the variables above in to the shell. Fixed width code in this document can be pasted directly into your terminal.

First let’s change the default event Manifest.xml.

cat > $FMSPATH/applications/livepkgr/events/_definst_/liveevent/Manifest.xml << EOF
<manifest xmlns="http://ns.adobe.com/f4m/1.0">
<media streamId="livestream" bitrate="$BITRATE" url="http://$FQDN/live/streams/livepkgr/streams/_definst_/livestream/livestream" />
</manifest>
EOF

We then need to make sure AMS listens on port 80. You might have selected this during installation. If you’re unsure, just go ahead and do this anyway.


sed -i "s/^ADAPTOR.HOSTPORT.*=.*:1935,80/ADAPTOR.HOSTPORT = :1935/" $FMSPATH/conf/$FMS.ini
sed -i "s/^HTTPPROXY.HOST.*=.*:8134/HTTPPROXY.HOST = /" $FMSPATH/conf/$FMS.ini
sed -i "s/^Listen 8134/Listen 80/" $FMSPATH/Apache2.2/conf/httpd.conf

Lastly we need to set up a crossdomain.xml that allows us to serve video from a different URL.


cat > $FMSPATH/webroot/crossdomain.xml <<EOF
<?xml version="1.0"?>
<cross-domain-policy>
<site-control permitted-cross-domain-policies="master-only" />
<allow-access-from domain="*.$DNSDomain" />
<allow-access-from domain="$FQDN" />
<allow-access-from domain="*.osmf.org" />
<allow-access-from domain="*.adobe.com" />
<allow-access-from domain="*.macromedia.com" />
</cross-domain-policy>
EOF

chown $FMSUSER:$FMSGROUP $FMSPATH/webroot/crossdomain.xml

Let’s go ahead and restart the AMS server with our new configuration.

$FMSPATH/${FMS}mgr server $FMS restart

Configuring aiScaler

Now you can paste your variables into a root shell on your aiScaler server.

Let’s create our configuration.

cat > /usr/local/aicache/ams.cfg << EOF
###########################################################################
# Example Aicache Configuration file for Adobe Media Server
###########################################################################
server
listen http 0.0.0.0 80
if_name eth0 # MUST POINT TO VALID Interface name that you used to obtain the license

username aicache # Will run as this user, must be a valid user
groupname aicache # Will run as this group, must be a valid group

logdirectory /var/log/aicache # Log directory: access, error, stats, snmp.stat go there
drop_user_agent # Do not log user-agent information
log_healthcheck # Will log health check requests
logstats # Log global statistics

maxkeepalivereq 20 # Max # of keep-alive requests per client keep-alive connection
maxkeepalivetime 10 # Max lifespan of client keep-alive connection, seconds
maxclientidletime 4 # Max idle time of client keep-alive connection, seconds
maxosidletime 4 # Origin Server connection max idle time

snmp_stat_interval 4 # SNMP stats refresh interval, seconds

max_os_ka_conn 2 # Max number of origin server keep-alive connections, per origin server
max_os_ka_req 20 # Max number of origin server requests per os keep-alive connection
###########################################################################
# Website Section. You must define your hostname(s) and matching origin server(s)
###########################################################################
website

hostname $EVENTNAME.$DNSDomain

min_gzip_size 4000 # Will compress compressible responses over 4000 bytes in size
fallback # Will fall back to prev cached response if new one can not be obtained
logstats # Will log basic website stats to a dedicated stats log file

httpheader Connection keep-alive
httpheader Accept */*
httpheader Accept-Encoding gzip

# Health checking example, this will request /test.html every 5 seconds, match
# to “HTTP”, timeout 4 seconds

#healthcheck /test.html HTTP 5 4

# Required to reload aicache configuration without service interrupts
reload_watch_file /usr/local/aicache/reload
reload_success_file /var/run/aicache_reload_success
reload_fail_file /var/run/aicache_reload_fail

########################################################################
# Patterns: this is what sets up Time-to-Live (caching rules)
########################################################################
pattern .bootstrap simple 2
#pattern /$ regexp 1m # cache for 1 minute: “/”, “/news/” etc
#pattern \.html$ regexp 1m # cache for 1 minute
#pattern \.jsp regexp 1m # cache for 1 minute – dynamic content, must use caution
#pattern \.php regexp 1m # cache for 1 minute – must use caution
#pattern \.asp regexp 1m # cache for 1 minute – must use caution
#pattern \.asx regexp 1m # cache for 1 minute – must use caution
#pattern .js simple 7d no_log # cache for a week, do not log in access log file
#pattern .css simple 7d no_log # cache for a week, do not log in access log file
#pattern .jpg simple 7d no_log # cache for a week, do not log in access log file
#pattern .gif simple 7d no_log # cache for a week, do not log in access log file
#pattern .png simple 7d no_log # cache for a week, do not log in access log file

########################################################################
# Origin servers.
########################################################################
origin $FMSIP
EOF

Then we should be ready to start aiScaler.

export LD_LIBRARY_PATH=/usr/local/lib
ulimit -c 4000000000
ulimit -n 64000
/usr/local/aicache/aicache -f /usr/local/aicache/ams.cfg -l $AICACHE_LICENCE_FILE $@

Please see the aiScaler Admin Guide for more general information about setup and tuning.

US 1 (408) 744-6078   EU +44 20 7993 4587