commit 60b3c5714f90e4cb41420e26478eee5a4d3bb0ef Author: lgp Date: Thu Nov 6 16:42:21 2025 +0800 v1.1.0 diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..b6f26d0 Binary files /dev/null and b/.DS_Store differ diff --git a/bin/open-im-media-server b/bin/open-im-media-server new file mode 100755 index 0000000..4cde247 Binary files /dev/null and b/bin/open-im-media-server differ diff --git a/bin/open-im-signal-server b/bin/open-im-signal-server new file mode 100755 index 0000000..b684a26 Binary files /dev/null and b/bin/open-im-signal-server differ diff --git a/config/config.yaml b/config/config.yaml new file mode 100644 index 0000000..6f62b76 --- /dev/null +++ b/config/config.yaml @@ -0,0 +1,48 @@ +port: 7880 #不用修改,默认即可 + +redis: + address: 127.0.0.1:16379 #和IM保持一致 + db: 1 #不用修改,默认即可 + password: openIM123 #和IM保持一致 + +rtc: + # udp_port: 7882 #不用修改,默认即可,开放此外网udp端口 + port_range_start: 50000 + port_range_end: 60000 + tcp_port: 7881 #不用修改,默认即可,开放此外网tcp端口 + use_external_ip: true #不用修改,默认即可 + node_ip: 127.0.0.1 #需要修改为部署机器的外网IP + +keys: + APIGPW3gnFTzqHH: 23ztfSqsfQ8hKkHzHTl3Z4bvaxro0snjk5jwbp5p6Q3 #测试环境不修改,生产环境修改,生成方式scripts目录下执行./gen_key.sh + +room: + auto_create: false + enable_remote_unmute: true #会议系统,不用修改,默认即可 + empty_timeout: 72000 #如果视频会议的房间中人数为0,超过这个时间(秒)就自动关闭房间,不用修改,默认即可 + +rpc: + zookeeper: + schema: openim #默认即可 + zkAddr: [ 127.0.0.1:2181 ] #单机部署时,默认即可 + userName: + password: + port: 11300 #不用修改 默认即可 + live_url: ws://127.0.0.1:7880 #用户能通过此ip:7880访问 或者配置nginx 类似wss://web.rentsoft.cn/open_rtc + live_url_inner: ws://127.0.0.1:7880 + address: 0.0.0.0 #不用修改 默认即可 + external_ip: 127.0.0.1 #IM服务器能通过此ip:11300访问到的此服务器,不一定是外网ip,如果为空,则获取本机ip + register_name: + openImRtcName: Rtc + openImMsgName: Msg #不用修改,默认即可 + storage_location: ../logs + +file: + enable_file_save: false #是否保持音视频文件 如果为true则要配置s3,同时需要配置recorder.yaml + s3: + access_key: root #和IM保持一致 + secret: openIM123 #和IM保持一致 + region: us-east-1 #和IM保持一致 + endpoint: http://127.0.0.1:10005 #和IM保持一致 + bucket: video #需先手动创建 + layout: single-speaker \ No newline at end of file diff --git a/config/recorder.yaml b/config/recorder.yaml new file mode 100644 index 0000000..f0dc73c --- /dev/null +++ b/config/recorder.yaml @@ -0,0 +1,25 @@ +log_level: debug #日志级别 +api_key: APIGPW3gnFTzqHH #和config.yaml保持一致 +api_secret: 23ztfSqsfQ8hKkHzHTl3Z4bvaxro0snjk5jwbp5p6Q3 #和config.yaml保持一致 +ws_url: ws://127.0.0.1:7880 #和config.yaml保持一致 需要连接到音视频服务的7880端口 +insecure: false + +template_base: http://172.20.40.77:9096 + +redis: + address: 127.0.0.1:16379 #和config.yaml保持一致 + username: #和config.yaml保持一致 + password: openIM123 #和config.yaml保持一致 + db: 1 #和config.yaml保持一致 + +s3: + access_key: root #和config.yaml保持一致 + secret: openIM123 #和config.yaml保持一致 + region: us-east-1 #和config.yaml保持一致 + endpoint: http://127.0.0.1:10005 #和config.yaml保持一致 + bucket: video #和config.yaml保持一致 + +cpu_cost: + room_composite_cpu_cost: 3.0 #默认即可 + track_composite_cpu_cost: 2.0 #默认即可 + track_cpu_cost: 1.0 #默认即可 \ No newline at end of file diff --git a/open-im-media-server-Deployment.md b/open-im-media-server-Deployment.md new file mode 100644 index 0000000..3b7e62c --- /dev/null +++ b/open-im-media-server-Deployment.md @@ -0,0 +1,70 @@ +# open-im-media-server音视频服务部署文档 + +## 1.解压 + +tar -zxvf open-im-media-server.tar.gz + +## 2. 开放端口 + +| RTC端口 | 说明 | 操作 | +| --------- | -------------------- | -------------------------------------------------- | +| TCP: 7880 | ws协议,通话房间管理 | 端口放行或nginx反向代理(参考第5部分),关闭防火墙 | +| TCP: 7881 | 音视频通话 | 端口放行,关闭防火墙 | +| UDP: 7882 | 音视频通话 | 端口放行,关闭防火墙 | + +## 3. 配置说明 + +``` +查看config/config.ymal配置项说明 +``` + +## 4.修改scripts/re_start.sh启动脚本 + +``` +nohup ../bin/open-im-media-server --config ../config/config.yaml --node-ip 127.0.0.1 >> ../logs/open_im_media.log 2>&1 & +修改127.0.0.1为本机网外ip, 注意一定是本机所在的外网ip,不要通过nginx反代 +``` + +## 5.关于nginx配置模板 + +``` +upstream im_open_rtc{ + server 127.0.0.1:7880; #rtc 音视频通话 服务器地址 根据部署情况可指定多台 + } + +location ^~/open_rtc/ { #7880 rtc + + listen 443; + server_name web.rentsoft.cn; #1 web im 端 域名 + ssl on; + ssl_certificate /etc/nginx/conf.d/ssl/web.xx.xx.crt; #2 证书 + ssl_certificate_key /etc/nginx/conf.d/ssl/web.xx.xx.key; #3 证书 + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header X-real-ip $remote_addr; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_pass http://im_open_rtc/; + } + +``` + +### 6.启动、停止 + +``` +启动服务 +scripts下执行 +chmod +x re_start.sh +nohup ./re_start.sh >> ../logs/restart.log 2>&1 & +``` + +``` +停止服务 +scripts下执行 +chmod +x stop.sh +./stop.sh +``` + + + diff --git a/scripts/gen_key.sh b/scripts/gen_key.sh new file mode 100644 index 0000000..a427d65 --- /dev/null +++ b/scripts/gen_key.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +../bin/open-im-media-server generate-keys diff --git a/scripts/start.sh b/scripts/start.sh new file mode 100644 index 0000000..a1b3744 --- /dev/null +++ b/scripts/start.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +echo 5000000 > /proc/sys/net/core/rmem_max +ulimit -n 10000 + +echo "start openIM rtc server........" + +logs_dir="../logs" + +if [ ! -d "$logs_dir" ]; then + mkdir -p "$logs_dir" +fi + +time=`date +"%Y-%m-%d %H:%M:%S"` +echo "==========================================================">>../logs/open_im_media.log 2>&1 & +echo "==========================================================">>../logs/open_im_media.log 2>&1 & +echo "==========================================================">>../logs/open_im_media.log 2>&1 & +echo "==========server start time:${time}===========">>../logs/open_im_media.log 2>&1 & +echo "==========================================================">>../logs/open_im_media.log 2>&1 & +echo "==========================================================">>../logs/open_im_media.log 2>&1 & +echo "==========================================================">>../logs/open_im_media.log 2>&1 & + +echo "start media server">>../logs/open_im_media.log 2>&1 & +cd ../bin +nohup ./open-im-media-server --config ../config/config.yaml --node-ip 127.0.0.1 >> ../logs/open_im_media.log 2>&1 & + +echo "start signal server">>../logs/open_im_media.log 2>&1 & +nohup ./open-im-signal-server --config ../config/config.yaml >> ../logs/open_im_media.log 2>&1 & \ No newline at end of file diff --git a/scripts/stop.sh b/scripts/stop.sh new file mode 100644 index 0000000..c894063 --- /dev/null +++ b/scripts/stop.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +service_names=( + 'open-im-media-server' + 'open-im-signal-server' +) + +for i in ${service_names[*]}; do + #Check whether the service exists + name="ps -aux |grep -w $i |grep -v grep" + count="${name}| wc -l" + if [ $(eval ${count}) -gt 0 ]; then + pid="${name}| awk '{print \$2}'" + echo -e "${SKY_BLUE_PREFIX}Killing service:$i pid:$(eval $pid)${COLOR_SUFFIX}" + #kill the service that existed + kill -9 $(eval $pid) + echo -e "${SKY_BLUE_PREFIX}service:$i was killed ${COLOR_SUFFIX}" + fi +done \ No newline at end of file