WCS in Amazon EC2¶
WCS server can be deployed in Amazon Elastic Compute Cloud (EC2) by one of the following ways:
Setting up Linux virtual machine and installing WCS from the scratch¶
This way is useful if you need fine OS tuning, additional modules installation and so on. Launch a Linux virtual machine by this AWS manual, set it up on your need, then install WCS by quick or detailed installation manual.
WCS automatic deployment from Amazon AWS Marketplace¶
-
Open Web Call Server page on Amazon AWS Marketplace and click
Continue to Subscribe
:
-
Product description page with hourly pricing depending on selected instance will be shown. Click
Continue to Configuration
:
-
Server configuration page will be shown. Select region and click
Continue to Launch
:
-
Instance launch page will be shown. Select the instance type:
-
Then scroll page down to
Security Group Settings
and clickCreate New Based On Seller Settings
: -
Security Group creation
page will be shown. Set the group name, description and clickSave
:
-
Select the new group in the drop-down list:
-
Click
Launch
:
-
A message will be displayed about instance deployment. It takes about a minute
-
Click on
EC2 Console
link. Find the launched virtual machine in theInstances
section. See thePublic DNS
column for the host name
-
Open WCS server web interface
https://host.amazonaws.com:8888
in your browser and accept security exception. Use the Instance ID of the launched virtual machine as the administrator password:
-
Check WebRTC streaming from web camera and playing the stream using Two-way Streaming web example:
WCS deployment from AWS Marketplace image with custom settings¶
AWS Marketplace image contains only basic WCS settings. To customize the server, it is necessary to connect to the instance via SSH and restart WCS. However, to get ready to launch server "out of the box", it is possible to set up user script to reconfigure the server during the first start. This can be useful, for example, to deploy autoscaling group.
-
In EC2 Console go to
Instances - Instances
section and clickLaunch instance
-
Choose Marketplace AMI "Web Call Server" using search string
-
Review AMI information
-
Choose instance type
-
Scroll down
Configure Instance Details
page to the end and insert custom update and setup script toUser data
text box
See the example script below -
Configure security group. By default, the security group will be created from AMI settings. Add the necessary ports
-
Click
Review and Launch
. If all the parameters are correct, clickLaunch
Server instance will be launched
-
Open WCS web interface, publish
test
stream in Two Way Streaming example and play it
The setup script example to update WCS to latest build and to configure Origin server for WebRTC and RTMP streams publishing
Origin setup script
#!/bin/bash
# Stop WCS before reconfiguring
PID="$(pgrep -f 'com.flashphoner.server.Server' | grep -v bash)"
if [ -n "$PID" ]; then
service webcallserver stop
fi
# Update WCS to the latest build (optionally, set to false if you don't)
UPDATE=true
if $UPDATE; then
cd /tmp
wget --timeout=10 --no-check-certificate https://flashphoner.com/download-wcs5.2-server.tar.gz -O wcs5-server.tar.gz
if [ $? -eq 0 ]; then
mkdir -p FlashphonerWebCallServer-5.2-latest && tar xzf wcs5-server.tar.gz -C FlashphonerWebCallServer-5.2-latest --strip-components 1
cd FlashphonerWebCallServer-5.2-latest
chmod +x install.sh
./install.sh -silent
cd ..
rm -rf FlashphonerWebCallServer-5.2-latest wcs5-server.tar.gz
fi
fi
# Configuration setup
WCS_CONFIG=/usr/local/FlashphonerWebCallServer/conf/flashphoner.properties
JVM_CONFIG=/usr/local/FlashphonerWebCallServer/conf/wcs-core.properties
#CDN settings
CDN_ROLE=origin
CDN_IP=0.0.0.0
echo -e "\ncdn_enabled=true" >> $WCS_CONFIG
echo -e "\ncdn_ip=$CDN_IP" >> $WCS_CONFIG
echo -e "\ncdn_role=$CDN_ROLE" >> $WCS_CONFIG
echo -e "\ncdn_nodes_resolve_ip=false" >> $WCS_CONFIG
# Request keyframes from WebRTC publishers every 5 seconds
echo -e "\nperiodic_fir_request=true" >> $WCS_CONFIG
# Disable RTMP keepalives to publish from OBS
echo -e "\nkeep_alive.enabled=websocket,rtmfp" >> $WCS_CONFIG
# Configure heap settings
HEAP_SIZE=512m
sed -i -e "s/^\(-Xmx\).*\$/\1$HEAP_SIZE/" $JVM_CONFIG
# Start WCS after reconfiguring
PID="$(pgrep -f 'com.flashphoner.server.Server' | grep -v bash)"
if [ -n "$PID" ]; then
service webcallserver restart
else
service webcallserver start
fi
# Disable internal firewall, ports are allowed/blocked on security group level
iptables -F
Known issues¶
1. After migration to Amazon Linux 2 AMI as basic image, systemd is used for services management¶
Symptoms
The command
returns
the command
does not work