-
Notifications
You must be signed in to change notification settings - Fork 76
RTVS阿里云部署测试
在阿里云创建一个Centos7的实例,我这里选择了Centos7.8。
创建完毕后修改网络安全组规则,将需要映射的端口允许访问,具体请查看https://github.com/vanjoge/RTVS/blob/master/script/README.md 映射端口部分,我这里为演示方便配置为全部允许。
配置完毕登陆此服务器,这里直接用root登陆了。
安装git和lsof。
yum install -y git lsof
安装docker
docker-ce版本
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
docker-io版本(不推荐)
yum install -y docker
启动docker和设置docker开机启动
sudo systemctl start docker
sudo systemctl enable docker
检查docker版本
docker version
输出
Client: Docker Engine - Community
Version: 20.10.18
API version: 1.41
Go version: go1.18.6
Git commit: b40c2f6
Built: Thu Sep 8 23:14:08 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.18
API version: 1.41 (minimum version 1.12)
Go version: go1.18.6
Git commit: e42327a
Built: Thu Sep 8 23:12:21 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.8
GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0
github经常打不开,建议直接拉gitee镜像,也是同步的
建议建立个单独的文件夹来放RTVS和启动脚本,如下
mkdir rtvs
cd rtvs
git clone https://gitee.com/vanjoge/RTVS
仅首次需要
仅首次需要
仅首次需要
重要的事情说三遍
RTVS/script/docker_network.sh
阿里云默认不用FirewallD,会报 FirewallD is not running ,没有太大影响,可继续。
Error: No such network: cvnetwork
创建docker自定义网络 cvnetwork 172.29.108.0/24
Error response from daemon: network cvnetwork not found
60d7be08bb9def481f1ada877f138c6f0deec2338bc2aec28316bf3f7c6b0186
FirewallD is not running
cp RTVS/script/run_all.sh .
vi run_all.sh
将IPADDRESS改为你的IP,我这里测试的服务器IP是47.99.237.207,改动后如下
#! /bin/bash
#DOCKER_HTTP_PORT HTTP映射端口 默认30888
export DOCKER_HTTP_PORT=30888
#DOCKER_WEBSOCKET_PORT 客户端连接端口 默认17000
export DOCKER_WEBSOCKET_PORT=17000
#服务端口范围(在这个范围找30个可用的端口)
export PORT_DEV_START=6001
export PORT_DEV_END=65535
#webrtc连接端口范围(此范围找CPU核心数+2个端口)
export Webrtc_Port_Start=14001
export Webrtc_Port_End=65535
#808测试网关连接端口
export DOCKER_808_PORT=9300
#设置服务器IP地址或域名(内网测试无需映射端口 外网请映射端口)
#此配置是RTVS下发给设备的连接地址和客户端连接服务器的地址,请注意公网时的端口映射
export IPADDRESS=47.99.237.207
#设置网关接口地址
export GatewayBaseAPI=http://172.29.108.249/api/
#设置redis连接字符串
export RedisExchangeHosts=172.29.108.245:6379,connectTimeout=20000,syncTimeout=20000,responseTimeout=20000
if [[ ! -f "./run_cluster.sh" ]]; then
cd RTVS/script
fi
./clear.sh
./run_cluster.sh
./run_gw.sh
./run_rtvs.sh
输入 :wq
保存退出
./run_all.sh
首次会下载几个docker镜像,可能需要等待一段时间。如果中途因为下载docker镜像失败报错,请再次执行./run_all.sh
即可。
等待脚本执行完毕,通过docker ps
就能看到在运行的镜像
[root@iZbp15w4ocqyod72xhv231Z rtvs]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
612c41d572b4 vanjoge/rtvs:1.3.0 "dotnet RTVSWeb.dll" 17 minutes ago Up 17 minutes 0.0.0.0:6006-6029->6006-6029/tcp, :::6006-6029->6006-6029/tcp, 0.0.0.0:6001->80/tcp, :::6001->80/tcp, 0.0.0.0:6002->443/tcp, :::6002->443/tcp rtvsweb-publish-1
9e3bb216d21b vanjoge/nginx-rtmp "/bin/sh -c /run.sh" 18 minutes ago Up 18 minutes 0.0.0.0:6005->6005/tcp, :::6005->6005/tcp, 0.0.0.0:6003->1935/tcp, :::6003->1935/tcp, 0.0.0.0:6004->8080/tcp, :::6004->8080/tcp nginx-rtmp-1
5b49ebdd9872 vanjoge/gw808 "dotnet 808GW.dll" 18 minutes ago Up 18 minutes 443/tcp, 0.0.0.0:9300->9300/tcp, :::9300->9300/tcp, 0.0.0.0:9080->80/tcp, :::9080->80/tcp tstgw808-1
85486dea569f vanjoge/cvcluster:1.3.0 "dotnet CVCluster.dll" 18 minutes ago Up 18 minutes 0.0.0.0:17000->17000/tcp, :::17000->17000/tcp, 0.0.0.0:30888->80/tcp, :::30888->80/tcp, 0.0.0.0:30443->443/tcp, :::30443->443/tcp cvcluster-1
2bc9f0401a63 vanjoge/mediasoup-demo:v3 "docker-entrypoint.s…" 19 minutes ago Up 18 minutes 0.0.0.0:14001-14002->14001-14002/tcp, :::14001-14002->14001-14002/tcp, 0.0.0.0:14003-14007->14003-14007/udp, :::14003-14007->14003-14007/udp sfu-mediasoup
4f279658be1d redis:4.0.10-alpine "docker-entrypoint.s…" 27 hours ago Up 27 hours 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp tstgw_redis
6c5dcd01b79e grafana/grafana:5.4.0 "/run.sh" 38 hours ago Up 27 hours 0.0.0.0:33000->3000/tcp, :::33000->3000/tcp grafana
4de428f18839 influxdb:1.7 "/entrypoint.sh infl…" 38 hours ago Up 27 hours 8086/tcp influxdb
3043850a6523 mysql:5.7 "docker-entrypoint.s…" 38 hours ago Up 27 hours 3306/tcp, 33060/tcp mysql5.7
将视频设备接入测试网关,我这里地址为47.99.237.207:9300
可在服务器通过 docker logs -f tstgw808-1
查看测试网关日志,会打印出与设备和网关的所有交互日志,如下:
2020-08-31 13:06:35,143 [52] DEBUG SQ [(null)] - [222.209.233.21:53686] Connected
2020-08-31 13:06:35,315 [52] DEBUG SQ [(null)] - [R 222.209.233.21:53686] 7E 01 00 00 2D 00 00 07 50 00 01 00 01 00 1F 00 6E 31 32 33 34 35 74 65 73 74 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 30 31 32 33 34 35 01 B2 E2 42 30 30 30 30 30 3F 7E
2020-08-31 13:06:35,315 [52] DEBUG SQ [(null)] - [S 222.209.233.21:53686] 7E 81 00 00 0B 00 00 07 50 00 01 00 01 00 01 00 31 32 33 34 35 36 37 38 D4 7E
2020-08-31 13:06:35,372 [54] DEBUG SQ [(null)] - [R 222.209.233.21:53686] 7E 01 02 00 08 00 00 07 50 00 01 00 02 31 32 33 34 35 36 37 38 57 7E
2020-08-31 13:06:35,372 [54] DEBUG SQ [(null)] - [S 222.209.233.21:53686] 7E 80 01 00 05 00 00 07 50 00 01 00 01 00 02 01 02 00 D2 7E
2020-08-31 13:06:35,372 [54] DEBUG SQ [(null)] - Sim[000007500001]上线
2020-08-31 13:06:35,372 [54] DEBUG SQ [(null)] - [S 222.209.233.21:53686] 7E 90 03 00 00 00 00 07 50 00 01 00 02 C7 7E
2020-08-31 13:06:35,469 [54] DEBUG SQ [(null)] - [R 222.209.233.21:53686] 7E 10 03 00 0A 00 00 07 50 00 01 00 03 1A 01 00 01 01 40 00 62 08 08 75 7E
2020-08-31 13:06:48,845 [56] DEBUG SQ [(null)] - VideoControl接口收到数据 Content=9101001500000750000100000D34372E39392E3233372E323037177A0000010001
2020-08-31 13:06:48,846 [56] DEBUG SQ [(null)] - [S 222.209.233.21:53686] 7E 91 01 00 15 00 00 07 50 00 01 00 03 0D 34 37 2E 39 39 2E 32 33 37 2E 32 30 37 17 7A 00 00 01 00 01 9E 7E
2020-08-31 13:06:48,983 [56] DEBUG SQ [(null)] - [R 222.209.233.21:53686] 7E 00 01 00 05 00 00 07 50 00 01 00 04 00 03 91 01 00 C5 7E
确定设备上线后,打开项目中RTVS/test/tstrtvs.html
页面或http://lib.cvtsp.com/video/CVNetVideoJs/test/tstrtvs.html,填入服务器地址47.99.237.207,端口17000,上线设备的SIM卡号,点击实时视频即可查看视频。
特别提醒:如果使用在线地址请不要使用https,https会验证证书,需要配置和证书匹配的域名,本文示例未配置证书,是用不了https的。如需https,请参考run_all_https.sh脚本或下面的链接
https://blog.csdn.net/vanjoge/article/details/121011581
如下图
如果RTVS有更新时,只需进入RTVS目录执行git pull即可更新
修改参数后重启也只需要执行./run_all.sh
即可
cd RTVS
git pull
cd ..
./run_all.sh
这一步非必须,可以在拉取镜像过慢时再切换。
为了之后拉取docker镜像速度更快,可以尝试用国内加速(如果你有阿里云加速会更好)。
修改vim /etc/docker/daemon.json
{
"registry-mirrors" : [
"http://hub-mirror.c.163.com",
"registry.docker-cn.com"
],
"insecure-registries" : [
"registry.docker-cn.com",
"docker.mirrors.ustc.edu.cn"
],
"debug" : true,
"experimental" : true
}
重新启动docker
systemctl restart docker