webrtc apprtc full deployment

阿里云 CentOS 6.5 服务器 建议选择香港服务器

一、安装turn server

mkdir /root/src
cd /root/src/
wget “http://turnserver.open-sys.org/downloads/v4.5.0.3/turnserver-4.5.0.3-CentOS6.6-x86_64.tar.gz
tar zxvf turnserver-4.5.0.3-CentOS6.6-x86_64.tar.gz
cd turnserver-4.5.0.3
./install.sh
service turnserver start
chkconfig turnserver on
二、安装 Google App Engine SDK for Python

yum install -y https://centos6.iuscommunity.org/ius-release.rpm
yum install -y python27 python27-devel python27-libs python27-pip python27-setuptools python27-tools

mkdir -p /data/webrtc
cd /data/webrtc/
wget https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.40.zip
unzip google_appengine_1.9.40.zip
python2.7 /data/webrtc/google_appengine/dev_appserver.py

三、安装nodejs和grunt

curl –silent –location https://rpm.nodesource.com/setup_4.x | bash -
yum -y install nodejs
npm install -g grunt-cli

五、编译collidermain

yum install -y golang

cd /root/src
git clone https://github.com/webrtc/apprtc.git
mkdir -p /root/collider/src
cd /root/collider/src/
ln -sf /root/src/apprtc/src/collider/collider
ln -sf /root/src/apprtc/src/collider/collidermain
ln -sf /root/src/apprtc/src/collider/collidertest
export GOPATH=/root/collider/
cd /root/collider/
vim src/collider/collider.go #line 58 tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 },
go get collidermain
go install collidermain

ls -l bin

cp bin/collidermain /usr/local/bin

copy cert and key file to /cert/cert.pem /cert/key.pem

/usr/local/bin/collidermain -port 8089 -room-server https://webrtc.learndevops.cn -tls

nohup /usr/local/bin/collidermain -port 8089 -room-server https://webrtc.learndevops.cn -tls &

七、安装nginx服务

yum install -y https://centos6.iuscommunity.org/ius-release.rpm
yum install -y php70u-cli php70u-devel php70u-fpm php70u-fpm-nginx php70u-gd php70u-json php70u-mbstring php70u-mcrypt php70u-mysqlnd php70u-opcache php70u-pdo php70u-pecl-redis php70u-xml

vim /etc/php.ini #date.timezone = Asia/Shanghai
service php-fpm start
chkconfig php-fpm on

yum install -y nginx
cd /etc/nginx/conf.d/
mkdir backup
mv default.conf ssl.conf virtual.conf backup/

vim /etc/nginx/conf.d/webrtc.conf

#

upstream roomserver {
server 127.0.0.1:8080;
}

server {
listen 80 ;
server_name webrtc.learndevops.cn;
return 301 https:// servername request_uri;
}

server {
listen 443 ;
ssl on;
ssl_certificate /cert/cert.pem;
ssl_certificate_key /cert/key.pem;

    server_name webrtc.learndevops.cn;
    access_log  /var/log/nginx/webrtc.learndevops.log;

    location / {
            proxy_pass http://roomserver$request_uri;
            proxy_set_header Host $host;
    }

    location ~ ^(.+\.php)(.*)$ {
            root /data/www/api.learndevops.cn/current;
            fastcgi_index           index.php;
            fastcgi_split_path_info ^(.+\.php)(.*)$;
            fastcgi_param           SCRIPT_FILENAME         $document_root$fastcgi_script_name;
            fastcgi_param           PATH_INFO               $fastcgi_path_info;
            fastcgi_param           PATH_TRANSLATED         $document_root$fastcgi_path_info;
            fastcgi_pass            127.0.0.1:9000;
            include                 fastcgi_params;
     }

}

#

service nginx start
chkconfig nginx on

八、配置ICEServer

mkdir -p /data/www/api.learndevops.cn/current/
vim /data/www/api.learndevops.cn/current/ice.php

mkdir -p /data/webrtc/

cd /data/webrtc/
git clone https://github.com/webrtc/apprtc.git
cd /data/webrtc/apprtc/
npm install –unsafe-perm

http_proxy=http://139.59.226.58:3128/ npm install –unsafe-perm

grunt build

cd /data/webrtc/apprtc/
vim src/app_engine/constants.py

#

ICE_SERVER_BASE_URL = ‘https://webrtc.learndevops.cn
ICE_SERVER_URL_TEMPLATE = ‘%s/ice.php?key=%s’

ICE_SERVER_API_KEY = os.environ.get(‘ICE_SERVER_API_KEY’)

ICE_SERVER_API_KEY = ‘123456’

#
#

WSS_INSTANCES = [{
WSS_INSTANCE_HOST_KEY: ‘webrtc.learndevops.cn:8089’,
WSS_INSTANCE_NAME_KEY: ‘wsserver-std’,
WSS_INSTANCE_ZONE_KEY: ‘aliyun’
}]

#

grunt build
vim out/app_engine/js/apprtc.debug.js

comment line 2115

//window.history.pushState({“roomId”:roomId, “roomLink”:roomLink}, roomId, roomLink);

python2.7 /data/webrtc/google_appengine/dev_appserver.py /data/webrtc/apprtc/out/app_engine/

nohup python2.7 /data/webrtc/google_appengine/dev_appserver.py /data/webrtc/apprtc/out/app_engine/ &

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值