diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 5119cbe44..25662a38a 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -11,8 +11,8 @@ services: start_period: 10s networks: - media-net - # ports: - # - 6379:6379 + ports: + - 6379:6379 volumes: - ./redis/conf/redis.conf:/opt/polaris/redis/redis.conf - ./volumes/redis/data/:/data @@ -37,8 +37,8 @@ services: MYSQL_USER: wvp_user MYSQL_PASSWORD: wvp_password TZ: Asia/Shanghai - # ports: - # - 3306:3306 + ports: + - 3306:3306 volumes: - ./mysql/conf:/etc/mysql/conf.d - ./logs/mysql:/logs @@ -59,7 +59,7 @@ services: networks: - media-net ports: - #- "6080:80/tcp" # [播流]HTTP 安全考虑-非测试阶段需要注释掉,改为由nginx代理播流地址 + - "6080:80/tcp" # [播流]HTTP #- "4443:443/tcp" # [播流]HTTPS 安全考虑-非测试阶段需要注释掉,改为由nginx代理播流地址 - "${MediaRtmp:-10935}:${MediaRtmp:-10935}/tcp" # [收流]RTMP - "${MediaRtmp:-10935}:${MediaRtmp:-10935}/udp" # [收流]RTMP @@ -148,6 +148,7 @@ services: environment: # 流链接的IP Stream_IP: ${Stream_IP} + WebHttp: ${WebHttp:-8080} networks: - media-net diff --git a/docker/media/config.ini b/docker/media/config.ini index cc74281aa..8788fb699 100644 --- a/docker/media/config.ini +++ b/docker/media/config.ini @@ -196,4 +196,21 @@ pktBufSize=8192 port=9000 timeoutSec=5 -; } --- +[onvif] +port=3702 + +[rtc] +enableTurn=1 +icePort=3478 +icePwd=ZLMediaKit +iceTcpPort=3478 +iceTransportPolicy=0 +iceUfrag=ZLMediaKit +interfaces= +max_stun_retry=7 +nackAudioRtpSize=4 +port_range=49152-65535 +preferred_tcp=0 +signalingPort=3000 +signalingSslPort=3001 + diff --git a/docker/nginx/templates/nginx.conf.template b/docker/nginx/templates/nginx.conf.template index cf0de139e..e826ef701 100644 --- a/docker/nginx/templates/nginx.conf.template +++ b/docker/nginx/templates/nginx.conf.template @@ -34,6 +34,14 @@ server { sub_filter "http://$original_host:80/mp4_record" "mp4_record"; sub_filter "https://$original_host/mp4_record" "mp4_record"; sub_filter "https://$original_host:443/mp4_record" "mp4_record"; + + # 将流播放地址中的端口80替换为Nginx对外端口8080 + sub_filter "http://$original_host:80/" "http://$original_host:${WebHttp}/" ; + sub_filter "ws://$original_host:80/" "ws://$original_host:${WebHttp}/" ; + sub_filter "wss://$original_host:443/" "wss://$original_host:${WebHttp}/" ; + sub_filter "https://$original_host:443/" "https://$original_host:${WebHttp}/" ; + sub_filter "http://$original_host/" "http://$original_host:${WebHttp}/" ; + sub_filter "ws://$original_host/" "ws://$original_host:${WebHttp}/" ; # 设置为off表示替换所有匹配项,而不仅仅是第一个 sub_filter_once off; @@ -59,28 +67,57 @@ server { proxy_read_timeout 300s; } - # 仅允许代理/rtp/开头的路径 + # 代理/rtp/开头的路径(国标设备流) location ^~ /rtp/ { # 代理到ZLMediakit服务 proxy_pass http://polaris-media:80; - + # 基础HTTP代理配置 proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; - + # WebSocket支持配置 proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; - + # 超时设置,根据实际需求调整 proxy_connect_timeout 60s; proxy_read_timeout 3600s; proxy_send_timeout 60s; } + # 代理流媒体播放请求到ZLMediaKit(匹配 .flv/.mp4/.m3u8/.ts 等流媒体后缀) + location ~* \.(live\.flv|live\.mp4|live\.ts|m3u8|flv|ts)$ { + proxy_pass http://polaris-media:80; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # WebSocket支持 + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + proxy_connect_timeout 60s; + proxy_read_timeout 3600s; + proxy_send_timeout 60s; + } + + # 代理 ZLMediaKit WebRTC API + location ^~ /index/api/webrtc { + proxy_pass http://polaris-media:80; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + # 仅允许代理/rtp/开头的路径 location ^~ /mp4_record/ { # 代理到ZLMediakit服务 diff --git a/docker/wvp/Dockerfile b/docker/wvp/Dockerfile index 52e62d2fb..ed00642f0 100644 --- a/docker/wvp/Dockerfile +++ b/docker/wvp/Dockerfile @@ -1,4 +1,4 @@ -FROM ringcentral/jdk:11 AS builder +FROM eclipse-temurin:21-jdk AS builder EXPOSE 18978/tcp EXPOSE 8116/tcp @@ -56,11 +56,11 @@ COPY . /build WORKDIR /build RUN ls && mvn clean package -Dmaven.test.skip=true WORKDIR /build/target -#ȷļһ +#ȷ���ļ���һ�� RUN mv wvp-pro-*.jar wvp.jar -FROM ringcentral/jdk:11 +FROM eclipse-temurin:21-jre RUN mkdir -p /opt/wvp WORKDIR /opt/wvp COPY --from=builder /build/target /opt/wvp diff --git a/pom.xml b/pom.xml index 4ce45891a..73c833918 100644 --- a/pom.xml +++ b/pom.xml @@ -60,8 +60,8 @@ ${project.build.directory}/asciidoc/html ${project.build.directory}/asciidoc/pdf - 21 - 21 + 17 + 17 diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 4b10dc6a5..0cfdf6e6b 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -20,18 +20,18 @@ spring: # [必须修改] 端口号 port: 6379 # [可选] 数据库 DB - database: 7 + database: 0 # [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接 - password: luna + # password: # [可选] 超时时间 timeout: 10000 # mysql数据源 datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://127.0.0.1:3306/wvp273数据库统合?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true - username: root - password: 12345678 + url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true + username: wvp_user + password: wvp_password # h2数据库 # datasource: # driver-class-name: org.h2.Driver @@ -82,11 +82,11 @@ sip: media: id: zlmediakit-local # [必须修改] zlm服务器的内网IP - ip: 192.168.1.10 + ip: 127.0.0.1 # [必须修改] zlm服务器的http.port - http-port: 9092 + http-port: 6080 # [必选选] zlm服务器的hook.admin_params=secret - secret: TWSYFgYJOQWB4ftgeYut8DW4wbs7pQnj + secret: su6TiedN2rVAmBbIDX0aa0QTiBJLBdcf # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试 rtp: # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输 diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 67213e8a3..19e545b2a 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -2,4 +2,4 @@ spring: application: name: wvp profiles: - active: 274-dev + active: dev