Discuz! Board
标题: 重新按照规范,配置一次apprtc [打印本页]
作者: zangcf 时间: 2016-8-9 22:36
标题: 重新按照规范,配置一次apprtc
1,所有需要的东西,都现下载
2,每次尽量测试
作者: zangcf 时间: 2016-8-9 22:47
标题: 第一步,按照node.js环境
本帖最后由 zangcf 于 2016-8-10 06:18 编辑
参考https://github.com/webrtc/apprtc
nstall grunt by first installing npm. npm is distributed as part of nodejs.
sudo apt-get install nodejs
sudo npm install -g npm-->这一步时间非常长,可能和nodejs的网络有关系
On Ubuntu 14.04 the default packages installs /usr/bin/nodejs but the /usr/bin/node executable is required for grunt. This is installed on some Ubuntu package sets; if it is missing, you can add this by installing the nodejs-legacy package,
sudo apt-get install nodejs-legacyIt is easiest to install a shared version of grunt-cli from npm using the -g flag. This will allow you access the gruntcommand from /usr/local/bin. More information can be found on gruntjs Getting Started.
sudo npm -g install grunt-cli
全部完成之后,做一次磁盘快照
作者: zangcf 时间: 2016-8-10 06:31
标题: 准备apprtc的代码
本帖最后由 zangcf 于 2016-8-10 16:08 编辑
1,安装git2,同步代码
- git clone https://github.com/webrtc/apprtc.git apprtc_root
复制代码 3, 进入apprtc_root目录,安装依赖库
等待同步完成之后,进行一次快照
上面的方法一直是失败的,因此,我们需要一台翻墙的机器,同步完代码之后,打包上传到云端
作者: zangcf 时间: 2016-8-10 16:23
标题: 本地下载转运方式准备apprtc代码
本帖最后由 zangcf 于 2016-8-10 16:54 编辑
1,首先,准备VPN,保证google可以顺利上2,下载代码
- git clone https://github.com/webrtc/apprtc.git apprtc_root
复制代码
3,安装需求包
4, 编译代码
5, 打包上传到服务起,然后执行34步动作
服务器段执行环境缺少java执行环境,安装openjdk
sudo apt-get install openjdk-7-jdk
建立快照
作者: zangcf 时间: 2016-8-10 17:54
本帖最后由 zangcf 于 2016-8-10 18:19 编辑
google_appengine的开发环境准备
下载/media/ultranix/windows/windowsxpsharedata/swap/91xp/google_appengine_1.9.35.zip,push到服务器
解压缩
运行:
打开火狐浏览器,输入http://120.76.203.222:8080/可以链接但是没有内容但是windows下面的火狐是ok的
使用chrome浏览器可以看到登录界面写一个房间服务器的批处理:
export PATH=$PATH:$HOME/google_appengineexport APPRTC_APP=$HOME/apprtc_root/out/app_engine/export HOST="--host=0.0.0.0"export ICE_SERVER_API_KEY="AIzaSyAJdh2HkajseEIltlZ3SIXO02Tze9sO3NY"dev_appserver.py $HOST $APPRTC_APP
作者: zangcf 时间: 2016-8-10 18:28
标题: 安装nginx的https的反向代理
本帖最后由 zangcf 于 2016-8-10 19:06 编辑
准备ssl的Key和crt文件
- root@iZ949sqo4m3Z:~/singalserver# ls
- signalmaster-master signalmaster-master.zip test
- root@iZ949sqo4m3Z:~/singalserver# cd signalmaster-master/
- root@iZ949sqo4m3Z:~/singalserver/signalmaster-master# ls
- config LICENSE package.json README.md server.js test.js
- Dockerfile node_modules Procfile scripts sockets.js
- root@iZ949sqo4m3Z:~/singalserver/signalmaster-master# cd ..
- root@iZ949sqo4m3Z:~/singalserver# ls
- signalmaster-master signalmaster-master.zip test
- root@iZ949sqo4m3Z:~/singalserver# cd signalmaster-master/
- root@iZ949sqo4m3Z:~/singalserver/signalmaster-master# ls
- config LICENSE package.json README.md server.js test.js
- Dockerfile node_modules Procfile scripts sockets.js
- root@iZ949sqo4m3Z:~/singalserver/signalmaster-master# ./scripts/generate-ssl-certs.sh
- Generating self-signed certificates...
- Generating RSA private key, 1024 bit long modulus
- ..........++++++
- ..........++++++
- e is 65537 (0x10001)
- You are about to be asked to enter information that will be incorporated
- into your certificate request.
- What you are about to enter is what is called a Distinguished Name or a DN.
- There are quite a few fields but you can leave some blank
- For some fields there will be a default value,
- If you enter '.', the field will be left blank.
- -----
- Country Name (2 letter code) [AU]:CN
- State or Province Name (full name) [Some-State]:GD
- Locality Name (eg, city) []:SZ
- Organization Name (eg, company) [Internet Widgits Pty Ltd]:91xuepai
- Organizational Unit Name (eg, section) []:91xuepai
- Common Name (e.g. server FQDN or YOUR name) []:91xuepai
- Email Address []:710833814@qq.com
- Please enter the following 'extra' attributes
- to be sent with your certificate request
- A challenge password []:123456
- An optional company name []:91xuepai
- Signature ok
- subject=/C=CN/ST=GD/L=SZ/O=91xuepai/OU=91xuepai/CN=91xuepai/emailAddress=710833814@qq.com
- Getting Private key
- root@iZ949sqo4m3Z:~/singalserver/signalmaster-master#
复制代码
第二步,安装nginx
第三步,配置反向代理站点
- #/etc/nginx/sites-enabled/apprtc.91xuepai.com
- upstream roomserver {
- server localhost:8080;
- }
- server {
- listen 80 ;
- server_name 91xuepai.com;
- return 301 https://$server_name$request_uri;
- }
- server {
- listen 443 ;
- ssl on;
- # 域名为apprtc.diveinedu.com的SSL证书文件
- ssl_certificate /etc/nginx/apprtc.91xuepai.com.crt;
- ssl_certificate_key /etc/nginx/apprtc.91xuepai.com.key;
- server_name apprtc.91xuepai.com;
- access_log /var/log/nginx/apprtc.91xuepai.com.log;
- location / {
- proxy_pass http://roomserver$request_uri;
- proxy_set_header Host $host;
- }
- }
复制代码
测试,反向代理失败了。为什么?
作者: zangcf 时间: 2016-8-10 19:58
恢复快照
使用我下载完全的nginx.tar.gz包,push到服务器上面
第一步,compile and intall pcre- cd pcre-8.32/
- ./configure --prefix=/usr/local/pcre
- make
- make install
复制代码 第二步,配置编译nginx
首先,打开文件/usr/bin/pod2man
注释掉第71行
接着,设定配置选项
- ./configure --with-pcre=../pcre-8.32 --with-http_ssl_module --with-zlib=../zlib/1.2.3 --prefix=/usr/local/nginx --with-http_stub_status_module --with-cc-opt='-O3' --with-openssl=../openssl-1.0.1f
复制代码 修改C语言编译规则,修改为
- CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-func
- tion -Wunused-variable -Wunused-value -g -O3
复制代码 编译安装
第三步,生成sll的key和crt文件
利用simplewebrtc的信令服务的源码singlemaster去生成该文件
把信令服务器的源码不是到服务器上,或者下载
生成过程:
- root@iZ949sqo4m3Z:~/singalserver/signalmaster-master# ./scripts/generate-ssl-certs.sh
- Generating self-signed certificates...
- Generating RSA private key, 1024 bit long modulus
- ............................++++++
- .........................++++++
- e is 65537 (0x10001)
- You are about to be asked to enter information that will be incorporated
- into your certificate request.
- What you are about to enter is what is called a Distinguished Name or a DN.
- There are quite a few fields but you can leave some blank
- For some fields there will be a default value,
- If you enter '.', the field will be left blank.
- -----
- Country Name (2 letter code) [AU]:CN
- State or Province Name (full name) [Some-State]:GD
- Locality Name (eg, city) []:SZ
- Organization Name (eg, company) [Internet Widgits Pty Ltd]:91xuepai
- Organizational Unit Name (eg, section) []:91xuepai
- Common Name (e.g. server FQDN or YOUR name) []:91xuepai
- Email Address []:710833814@qq.com
- Please enter the following 'extra' attributes
- to be sent with your certificate request
- A challenge password []:123456
- An optional company name []:91xuepai
- Signature ok
- subject=/C=CN/ST=GD/L=SZ/O=91xuepai/OU=91xuepai/CN=91xuepai/emailAddress=710833814@qq.com
- Getting Private key
- root@iZ949sqo4m3Z:~/singalserver/signalmaster-master# ls ./config/sslcerts/
- cert.pem key.pem
- root@iZ949sqo4m3Z:~/singalserver/signalmaster-master#
复制代码
第四步,修改nginx的配置文件
- add include /etc/nginx/sites-enabled/*; in http{}
复制代码
手工建立站点文件
- mkdir -p /etc/nginx/sites-enabled
复制代码 建立/etc/nginx/sites-enabled/apprtc.91xuepai.com文件
- #/etc/nginx/sites-enabled/apprtc.91xuepai.com
- upstream roomserver {
- server localhost:8080;
- }
- server {
- listen 80 ;
- server_name apprtc.91xuepai.com;
- return 301 https://$server_name$request_uri;
- }
- server {
- listen 443 ;
- ssl on;
- # 域名为apprtc.diveinedu.com的SSL证书文件
- ssl_certificate /etc/nginx/apprtc.91xuepai.com.crt;
- ssl_certificate_key /etc/nginx/apprtc.91xuepai.com.key;
- server_name apprtc.91xuepai.com;
- access_log /var/log/nginx/apprtc.91xuepai.com.log;
- location / {
- proxy_pass http://roomserver$request_uri;
- proxy_set_header Host $host;
- }
- }
复制代码 拷贝sll key到/etc/nginx/下
- root@iZ949sqo4m3Z:~/singalserver/signalmaster-master/config/sslcerts# cp cert.pem /etc/nginx/apprtc.91xuepai.com.crt
- root@iZ949sqo4m3Z:~/singalserver/signalmaster-master/config/sslcerts# cp key.pem /etc/nginx/apprtc.91xuepai.com.key
- root@iZ949sqo4m3Z:~/singalserver/signalmaster-master/config/sslcerts#
复制代码 nginx的配置文件如下:
重启nginx
OK
开始快照
作者: zangcf 时间: 2016-8-11 10:33
标题: 准备信令服务器
本帖最后由 zangcf 于 2016-8-11 10:34 编辑
因为go环境和collider的下载编译都需要翻墙,因为现在本地同步好,然后上传到云服务器
第一步,准备go环境
解压go包
- root@iZ949sqo4m3Z:~# tar xzvf go1.6.2.linux-amd64.tar.gz
复制代码
建立go工作目录
- mkdir -p $HOME/gopath/src
复制代码 修改环境文件.profile
- export GOROOT=$HOME/go
- export GOPATH=$HOME/gopath
- export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
复制代码 第二步,准备信令服务器源码
解压collider_root文件,然后copy到gopath下面
- root@iZ949sqo4m3Z:~# cp -r collider_root/src/* gopath/src/
复制代码
第三步修改源码:
编辑$GOPATH/src/collidermain/main.go,修改房间服务器为我们前面的房间服务器:
- var roomSrv = flag.String("room-server", "https://120.76.203.222", "The origin of the room server")
复制代码 修改https的证书,位置在
- root@iZ949sqo4m3Z:~# ls /etc/nginx/
- apprtc.91xuepai.com.crt cert.pem sites-enabled
- apprtc.91xuepai.com.key key.pem
复制代码 修改文件$GOPATH/src/collider/collider.go
- e = server.ListenAndServeTLS("/etc/nginx/cert.pem", "/etc/nginx/key.pem")
复制代码 第四步,安装信令服务器
- root@iZ949sqo4m3Z:~# go get collidermain
- root@iZ949sqo4m3Z:~# go install collidermain
复制代码 第五步,运行信令服务器
- root@iZ949sqo4m3Z:~# $GOPATH/bin/collidermain -port=8089 -tls=true
- 2016/08/11 10:32:17 Starting collider: tls = true, port = 8089, room-server=https://120.76.203.222
- 2016/08/11 10:32:17 Run: http2: TLSConfig.CipherSuites index 4 contains an HTTP/2-approved cipher suite (0xc030), but it comes after unapproved cipher suites. With this configuration, clients that don't support previous, approved cipher suites may be given an unapproved one and reject the connection.
复制代码
如何测试信令服务器是否OK呢?创建快照
作者: zangcf 时间: 2016-8-11 11:02
标题: 配置穿墙服务器
本帖最后由 zangcf 于 2016-8-11 11:29 编辑
下载版本:
- wget http://turnserver.open-sys.org/downloads/v4.4.1.2/turnserver-4.4.1.2-debian-wheezy-ubuntu-mint-x86-64bits.tar.gz
复制代码 解压缩:
- root@iZ949sqo4m3Z:~/turnserver# tar xzvf turnserver-4.4.1.2-debian-wheezy-ubuntu-mint-x86-64bits.tar.gz
- INSTALL
- coturn_4.4.1.2-1_amd64.deb
- root@iZ949sqo4m3Z:~/turnserver# ls
- coturn_4.4.1.2-1_amd64.deb
- INSTALL
- turnserver-4.4.1.2-debian-wheezy-ubuntu-mint-x86-64bits.tar.gz
- root@iZ949sqo4m3Z:~/turnserver#
复制代码 安装
编辑配置文件,打开系统默认启动配置:
- # Uncomment it if you want to have the turnserver running as
- # an automatic system service daemon
- #
- TURNSERVER_ENABLED=1
- "/etc/default/coturn" 6L, 125C written
复制代码
把上面打开编辑的文件中的这一行TURNSERVER_ENABLED=1去掉注释,保存退出.
准备用户名,域名和密码
用户名:91xuepai
域名:91xuepai
密码:91xuepai
- root@iZ949sqo4m3Z:~/turnserver# turnadmin -k -u 91xuepai -p 91xuepai -r 91xuepai
- 0x696abf1163c64258bd58039c6c70fe00
- root@iZ949sqo4m3Z:~/turnserver#
复制代码
修改/etc/turnserver.conf- listening-device=eth1
- listening-port=3478
- tls-listening-port=5349
- listening-ip=120.76.203.222
- relay-device=eth1
- relay-ip=120.76.203.222
- Verbose
- fingerprint
- lt-cred-mech
- use-auth-secret
- static-auth-secret=91xuepai
复制代码
- user=91xuepai:91xuepai
- user=91xuepai:0x696abf1163c64258bd58039c6c70fe00
- realm=91xuepai.com
- stale-nonce
- cert=/etc/nginx/cert.pem
- pkey=/etc/nginx/key.pem
- no-loopback-peers
- sha256
- mobility
- no-cli
复制代码 启动穿墙服务器
- root@iZ949sqo4m3Z:~/turnserver# service coturn start
- * Starting coturn turnserver
- 0: log file opened: /var/log/turn_24506_2016-08-11.log
- 0:
- RFC 3489/5389/5766/5780/6062/6156 STUN/TURN Server
- Version Coturn-4.4.1.2 'Ardee West'
- 0:
- Max number of open files/sockets allowed for this process: 65535
- 0:
- Due to the open files/sockets limitation,
- max supported number of TURN Sessions possible is: 32500 (approximately)
- 0:
- ==== Show him the instruments, Practical Frost: ====
- 0: TLS supported
- 0: DTLS supported
- 0: AEAD supported
- 0: SQLite supported, default database location is /var/lib/turn/turndb
- 0: Redis supported
- 0: PostgreSQL supported
- 0: MySQL supported
- 0: MongoDB is not supported
- 0: OpenSSL compile-time version: OpenSSL 1.0.1e 11 Feb 2013
- 0: Default Net Engine version: 2 (UDP thread per network endpoint)
- =====================================================
- 0: Listener address to use: 120.76.203.222
- 0: Relay address to use: 120.76.203.222
- 0: Domain name:
- 0: Default realm: 91xuepai.com
- 0: SSL23: Certificate file found: /etc/nginx/cert.pem
- 0: SSL23: Private key file found: /etc/nginx/key.pem
- 0: TLS1.0: Certificate file found: /etc/nginx/cert.pem
- 0: TLS1.0: Private key file found: /etc/nginx/key.pem
- 0: TLS1.1: Certificate file found: /etc/nginx/cert.pem
- 0: TLS1.1: Private key file found: /etc/nginx/key.pem
- 0: TLS1.2: Certificate file found: /etc/nginx/cert.pem
- 0: TLS1.2: Private key file found: /etc/nginx/key.pem
- 0: TLS cipher suite: DEFAULT
- 0: DTLS: Certificate file found: /etc/nginx/cert.pem
- 0: DTLS: Private key file found: /etc/nginx/key.pem
- 0: DTLS cipher suite: DEFAULT
- ...done.
- root@iZ949sqo4m3Z:~/turnserver#
复制代码 建立系统快照
作者: zangcf 时间: 2016-8-11 11:41
标题: 系统综合配置
1,修改房间的ICE配置
- ROOM_MEMCACHE_EXPIRATION_SEC = 60 * 60 * 24
- MEMCACHE_RETRY_LIMIT = 100
- LOOPBACK_CLIENT_ID = 'LOOPBACK_CLIENT_ID'
- # TODO: Remove once clients support ICE_SERVER.
- TURN_BASE_URL = 'https://120.76.203.222'
- TURN_URL_TEMPLATE = '%s/turn.php?username=%s&key=%s'
- CEOD_KEY = '91xuepai'
- ICE_SERVER_BASE_URL = 'https://120.76.203.222'
- ICE_SERVER_URL_TEMPLATE = '%s/apprtc/iceconfig.php?key=%s'
- ICE_SERVER_API_KEY = os.environ.get('ICE_SERVER_API_KEY')
复制代码 2,重新build一次
- root@iZ949sqo4m3Z:~/apprtc_root# grunt build
复制代码 3,修改房间服务的启动密码
作者: zangcf 时间: 2016-8-11 12:05
实际运行有错误:
0.854: Initializing; server= undefined.
apprtc.debug.js:4085 0.860: Initializing; room=undefined.
apprtc.debug.js:4085 20.789: Opening signaling channel.
apprtc.debug.js:4085 20.797: Got access to local media with mediaConstraints:
'{"video":{"optional":[{"minWidth":"1280"},{"minHeight":"720"}],"mandatory":{}},"audio":true}'
apprtc.debug.js:4085 20.798: User has granted access to local media.
apprtc.debug.js:4085 20.799: Attaching local stream.
apprtc.debug.js:3985 POST https://120.76.203.222/apprtc/iceconfig.php?key=none 404 (Not Found)(anonymous function) @ apprtc.debug.js:3985sendUrlRequest @ apprtc.debug.js:3966sendAsyncUrlRequest @ apprtc.debug.js:3963(anonymous function) @ apprtc.debug.js:3993requestIceServers @ apprtc.debug.js:3992Call.maybeGetIceServers_ @ apprtc.debug.js:2445Call.requestMediaAndIceServers_ @ apprtc.debug.js:2254Call @ apprtc.debug.js:2250AppController.createCall_ @ apprtc.debug.js:1895(anonymous function) @ apprtc.debug.js:1928RoomSelection.loadRoom_ @ apprtc.debug.js:3360RoomSelection.onJoinButton_ @ apprtc.debug.js:3349
apprtc.debug.js:4085 20.831: ICE server request error: Status=404, response=<html>
<head>
<title>404 Not Found</title>
</head>
<body>
<h1>404 Not Found</h1>
The resource could not be found.<br /><br />
</body>
</html>
apprtc.debug.js:4085 20.852: Joined the room.
apprtc.debug.js:4085 22.797: Signaling channel opened.
apprtc.debug.js:4085 22.799: Registering signaling channel.
apprtc.debug.js:4085 22.800: Signaling channel registered.
apprtc.debug.js:4085 22.801: Starting signaling.
apprtc.debug.js:4085 22.802: Failed to start signaling: Failed to execute 'pushState' on 'History': A history state object with URL 'http://120.76.203.222/r/434116090' cannot be created in a document with origin 'https://120.76.203.222' and URL 'https://120.76.203.222/'.
apprtc.debug.js:4085 77.700: WSS->C: {"msg":"{\"type\":\"bye\"}","error":""}
apprtc.debug.js:2561 Uncaught TypeError: Cannot read property 'receiveSignalingMessage' of nullCall.onRecvSignalingChannelMessage_ @ apprtc.debug.js:2561(anonymous function) @ apprtc.debug.js:3795
apprtc.debug.js:4085 77.745: ECDSA certificate generated successfully.
apprtc.debug.js:4085 77.746: Creating RTCPeerConnnection with:
config: '{"iceServers":[],"rtcpMuxPolicy":"require","bundlePolicy":"max-bundle","certificates":[{}]}';
constraints: '{"optional":[]}'.
apprtc.debug.js:4085 77.751: Created PeerConnectionClient
| 欢迎光临 Discuz! Board (http://47.89.242.157:9000/bbs/discuz/) |
Powered by Discuz! X3.2 |