mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-24 05:57:49 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d96faa2459
19
docker/.env
Normal file
19
docker/.env
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
MediaRtmp=10001
|
||||||
|
MediaRtsp=10002
|
||||||
|
MediaRtp=10003
|
||||||
|
|
||||||
|
WebHttp=8080
|
||||||
|
WebHttps=8081
|
||||||
|
|
||||||
|
Stream_IP=127.0.0.1
|
||||||
|
SDP_IP=127.0.0.1
|
||||||
|
|
||||||
|
SIP_ShowIP=127.0.0.1
|
||||||
|
SIP_Port=8160
|
||||||
|
SIP_Domain=3502000000
|
||||||
|
SIP_Id=35020000002000000001
|
||||||
|
SIP_Password=wvp_sip_password
|
||||||
|
|
||||||
|
|
||||||
|
RecordSip=true
|
||||||
|
RecordPushLive=
|
||||||
10
docker/README.md
Normal file
10
docker/README.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
可以在当前目录下:
|
||||||
|
使用`docker compose up -d`直接运行。
|
||||||
|
使用`docker compose up -d -build -force-recreate`强制重新构建所有服务的镜像并删除旧容器重新运行
|
||||||
|
|
||||||
|
`.env`用来配置环境变量,在这里配好之后,其它的配置会自动联动的。
|
||||||
|
|
||||||
|
`build.sh`用来以日期为tag构建镜像,推送到指定的容器注册表内(Windows下可以使用`Git Bash`运行)
|
||||||
|
|
||||||
|
|
||||||
|
其它的文件的作用暂不明确
|
||||||
114
docker/build.sh
114
docker/build.sh
@ -1,45 +1,79 @@
|
|||||||
#/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
|
||||||
|
|
||||||
version=2.7.3
|
# 获取当前日期作为标签(格式:YYYYMMDD)
|
||||||
|
date_tag=$(date +%Y%m%d)
|
||||||
|
|
||||||
git clone https://gitee.com/pan648540858/wvp-GB28181-pro.git
|
# 切换到脚本所在目录的上一级目录作为工作目录
|
||||||
cd wvp-GB28181-pro/web_src && \
|
cd "$(dirname "$0")/.." || {
|
||||||
npm install && \
|
echo "错误:无法切换到上级目录"
|
||||||
npm run build
|
exit 1
|
||||||
|
}
|
||||||
|
echo "已切换工作目录到:$(pwd)"
|
||||||
|
|
||||||
|
# 检查私有仓库环境变量
|
||||||
|
if [ -z "$DOCKER_REGISTRY" ]; then
|
||||||
|
echo "未设置DOCKER_REGISTRY环境变量"
|
||||||
|
read -p "请输入私有Docker注册库地址(如不推送请留空): " input_registry
|
||||||
|
docker_registry="$input_registry"
|
||||||
|
else
|
||||||
|
docker_registry="$DOCKER_REGISTRY"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 定义要构建的镜像和对应的Dockerfile路径(相对当前工作目录)
|
||||||
|
images=(
|
||||||
|
"wvp-service:docker/wvp/Dockerfile"
|
||||||
|
"wvp-nginx:docker/nginx/Dockerfile"
|
||||||
|
)
|
||||||
|
|
||||||
|
# 构建镜像的函数
|
||||||
|
build_image() {
|
||||||
|
local image_name="$1"
|
||||||
|
local dockerfile_path="$2"
|
||||||
|
|
||||||
cd ../../
|
# 检查Dockerfile是否存在
|
||||||
mkdir -p ./nginx/dist
|
if [ ! -f "$dockerfile_path" ]; then
|
||||||
cp -r wvp-GB28181-pro/src/main/resources/static/* ./nginx/dist
|
echo "错误:未找到Dockerfile - \"$dockerfile_path\",跳过构建"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 构建镜像
|
||||||
|
local full_image_name="${image_name}:${date_tag}"
|
||||||
|
echo
|
||||||
|
echo "=============================================="
|
||||||
|
echo "开始构建镜像:${full_image_name}"
|
||||||
|
echo "Dockerfile路径:${dockerfile_path}"
|
||||||
|
|
||||||
|
docker build -t "${full_image_name}" -f "${dockerfile_path}" .
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "镜像${full_image_name}构建失败"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 推送镜像(如果设置了仓库地址)
|
||||||
|
if [ -n "$docker_registry" ]; then
|
||||||
|
local registry_image="${docker_registry}/${full_image_name}"
|
||||||
|
echo "给镜像打标签:${registry_image}"
|
||||||
|
docker tag "${full_image_name}" "${registry_image}"
|
||||||
|
|
||||||
|
echo "推送镜像到注册库"
|
||||||
|
docker push "${registry_image}"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "镜像${registry_image}推送成功"
|
||||||
|
else
|
||||||
|
echo "镜像${registry_image}推送失败"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "未提供注册库地址,不执行推送"
|
||||||
|
fi
|
||||||
|
echo "=============================================="
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
echo "构建ZLM容器"
|
# 循环构建所有镜像
|
||||||
cd ./media/
|
for item in "${images[@]}"; do
|
||||||
chmod +x ./build.sh
|
IFS=':' read -r image_name dockerfile_path <<< "$item"
|
||||||
./build.sh
|
build_image "$image_name" "$dockerfile_path"
|
||||||
cd ../
|
done
|
||||||
|
|
||||||
echo "构建数据库容器"
|
echo "所有镜像处理完成"
|
||||||
cd ./mysql/
|
exit 0
|
||||||
chmod +x ./build.sh
|
|
||||||
./build.sh
|
|
||||||
cd ../
|
|
||||||
|
|
||||||
echo "构建Redis容器"
|
|
||||||
cd ./redis/
|
|
||||||
chmod +x ./build.sh
|
|
||||||
./build.sh
|
|
||||||
cd ../
|
|
||||||
|
|
||||||
echo "构建WVP容器"
|
|
||||||
cd ./wvp/
|
|
||||||
chmod +x ./build.sh
|
|
||||||
./build.sh
|
|
||||||
cd ../
|
|
||||||
|
|
||||||
echo "构建Nginx容器"
|
|
||||||
cd ./nginx/
|
|
||||||
chmod +x ./build.sh
|
|
||||||
./build.sh
|
|
||||||
cd ../
|
|
||||||
|
|
||||||
./push.sh
|
|
||||||
|
|||||||
@ -59,11 +59,18 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- media-net
|
- media-net
|
||||||
ports:
|
ports:
|
||||||
- "10935:10935"
|
#- "6080:80/tcp" # [播流]HTTP 安全考虑-非测试阶段需要注释掉,改为由nginx代理播流地址
|
||||||
- "5540:5540"
|
#- "4443:443/tcp" # [播流]HTTPS 安全考虑-非测试阶段需要注释掉,改为由nginx代理播流地址
|
||||||
- "6080:6080"
|
- "${MediaRtmp:-10935}:${MediaRtmp:-10935}/tcp" # [收流]RTMP
|
||||||
|
- "${MediaRtmp:-10935}:${MediaRtmp:-10935}/udp" # [收流]RTMP
|
||||||
|
#- "41935:41935/tcp" # [收流]RTMPS 无效
|
||||||
|
- "${MediaRtsp:-5540}:${MediaRtsp:-5540}/tcp" # [收流]RTSP
|
||||||
|
- "${MediaRtsp:-5540}:${MediaRtsp:-5540}/udp" # [收流]RTSP
|
||||||
|
#- "45540:45540/tcp" # [收流]RTSPS 无效
|
||||||
|
- "${MediaRtp:-10000}:${MediaRtp:-10000}/tcp" # [收流]RTP
|
||||||
|
- "${MediaRtp:-10000}:${MediaRtp:-10000}/udp" # [收流]RTP
|
||||||
volumes:
|
volumes:
|
||||||
- ./volumes/video:/opt/media/www/record/
|
- ./volumes/video:/opt/media/bin/www/record/
|
||||||
- ./logs/media:/opt/media/log/
|
- ./logs/media:/opt/media/log/
|
||||||
- ./media/config.ini:/conf/config.ini
|
- ./media/config.ini:/conf/config.ini
|
||||||
command: [
|
command: [
|
||||||
@ -82,35 +89,48 @@ services:
|
|||||||
- media-net
|
- media-net
|
||||||
ports:
|
ports:
|
||||||
- "18978:18978"
|
- "18978:18978"
|
||||||
- "8116:8116/udp"
|
- "${SIP_Port:-8116}:${SIP_Port:-8116}/udp"
|
||||||
- "8116:8116/tcp"
|
- "${SIP_Port:-8116}:${SIP_Port:-8116}/tcp"
|
||||||
depends_on:
|
depends_on:
|
||||||
- polaris-redis
|
- polaris-redis
|
||||||
- polaris-mysql
|
- polaris-mysql
|
||||||
- polaris-media
|
- polaris-media
|
||||||
links:
|
|
||||||
- polaris-redis
|
|
||||||
- polaris-mysql
|
|
||||||
- polaris-media
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./wvp/wvp/:/opt/ylcx/wvp/
|
- ./wvp/wvp/:/opt/ylcx/wvp/
|
||||||
- ./logs/wvp:/opt/wvp/logs/
|
- ./logs/wvp:/opt/wvp/logs/
|
||||||
environment:
|
environment:
|
||||||
TZ: "Asia/Shanghai"
|
TZ: "Asia/Shanghai"
|
||||||
# 本机的IP
|
# 流链接的IP
|
||||||
SIP_HOST: 127.0.0.1
|
Stream_IP: ${Stream_IP}
|
||||||
STREAM_HOST: 127.0.0.1
|
# SDP里的IP
|
||||||
|
SDP_IP: ${SDP_IP}
|
||||||
|
# [可选] zlm服务器访问WVP所使用的IP, 默认使用127.0.0.1,zlm和wvp没有部署在同一台服务器时必须配置
|
||||||
|
ZLM_HOOK_HOST: polaris-wvp
|
||||||
ZLM_HOST: polaris-media
|
ZLM_HOST: polaris-media
|
||||||
ZLM_PORT: 6080
|
|
||||||
ZLM_SERCERT: su6TiedN2rVAmBbIDX0aa0QTiBJLBdcf
|
ZLM_SERCERT: su6TiedN2rVAmBbIDX0aa0QTiBJLBdcf
|
||||||
|
|
||||||
|
MediaHttp: ${WebHttp:-8080}
|
||||||
|
#MediaHttps: ${WebHttps:-8081}
|
||||||
|
MediaRtmp: ${MediaRtmp:-10935}
|
||||||
|
MediaRtsp: ${MediaRtsp:-5540}
|
||||||
|
MediaRtp: ${MediaRtp:-10000}
|
||||||
|
|
||||||
REDIS_HOST: polaris-redis
|
REDIS_HOST: polaris-redis
|
||||||
REDIS_PORT: 6379
|
REDIS_PORT: 6379
|
||||||
|
|
||||||
DATABASE_HOST: polaris-mysql
|
DATABASE_HOST: polaris-mysql
|
||||||
DATABASE_PORT: 3306
|
DATABASE_PORT: 3306
|
||||||
DATABASE_USER: wvp_user
|
DATABASE_USER: wvp_user
|
||||||
DATABASE_PASSWORD: wvp_password
|
DATABASE_PASSWORD: wvp_password
|
||||||
# 前端跨域配置,nginx容器所在物理机IP
|
|
||||||
NGINX_HOST: http://127.0.0.1:8080
|
SIP_ShowIP: ${SIP_ShowIP}
|
||||||
|
SIP_Port: ${SIP_Port:-8116}
|
||||||
|
SIP_Domain: ${SIP_Domain}
|
||||||
|
SIP_Id: ${SIP_Id}
|
||||||
|
SIP_Password: ${SIP_Password}
|
||||||
|
|
||||||
|
RecordSip: ${RecordSip}
|
||||||
|
RecordPushLive: ${RecordPushLive}
|
||||||
|
|
||||||
polaris-nginx:
|
polaris-nginx:
|
||||||
# 显式指定构建上下文和Dockerfile路径
|
# 显式指定构建上下文和Dockerfile路径
|
||||||
@ -118,17 +138,15 @@ services:
|
|||||||
context: .. # 构建上下文的根路径
|
context: .. # 构建上下文的根路径
|
||||||
dockerfile: ./docker/nginx/Dockerfile # 相对于上下文路径的Dockerfile位置
|
dockerfile: ./docker/nginx/Dockerfile # 相对于上下文路径的Dockerfile位置
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "${WebHttp:-8080}:8080"
|
||||||
depends_on:
|
depends_on:
|
||||||
- polaris-wvp
|
- polaris-wvp
|
||||||
links:
|
|
||||||
- polaris-wvp
|
|
||||||
environment:
|
|
||||||
WVP_HOST: polaris-wvp
|
|
||||||
WVP_PORT: 18978
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
|
- ./nginx/templates/:/etc/nginx/templates
|
||||||
- ./logs/nginx:/var/log/nginx
|
- ./logs/nginx:/var/log/nginx
|
||||||
|
environment:
|
||||||
|
# 流链接的IP
|
||||||
|
Stream_IP: ${Stream_IP}
|
||||||
networks:
|
networks:
|
||||||
- media-net
|
- media-net
|
||||||
|
|
||||||
|
|||||||
@ -52,21 +52,21 @@ alive_interval=10.0
|
|||||||
enable=1
|
enable=1
|
||||||
on_flow_report=
|
on_flow_report=
|
||||||
on_http_access=
|
on_http_access=
|
||||||
on_play=http://127.0.0.1:18978/index/hook/on_play
|
on_play=http://polaris-wvp:18978/index/hook/on_play
|
||||||
on_publish=http://127.0.0.1:18978/index/hook/on_publish
|
on_publish=http://polaris-wvp:18978/index/hook/on_publish
|
||||||
on_record_mp4=http://127.0.0.1:18978/index/hook/on_record_mp4
|
on_record_mp4=http://polaris-wvp:18978/index/hook/on_record_mp4
|
||||||
on_record_ts=
|
on_record_ts=
|
||||||
on_rtp_server_timeout=http://127.0.0.1:18978/index/hook/on_rtp_server_timeout
|
on_rtp_server_timeout=http://polaris-wvp:18978/index/hook/on_rtp_server_timeout
|
||||||
on_rtsp_auth=
|
on_rtsp_auth=
|
||||||
on_rtsp_realm=
|
on_rtsp_realm=
|
||||||
on_send_rtp_stopped=http://127.0.0.1:18978/index/hook/on_send_rtp_stopped
|
on_send_rtp_stopped=http://polaris-wvp:18978/index/hook/on_send_rtp_stopped
|
||||||
on_server_exited=
|
on_server_exited=
|
||||||
on_server_keepalive=http://127.0.0.1:18978/index/hook/on_server_keepalive
|
on_server_keepalive=http://polaris-wvp:18978/index/hook/on_server_keepalive
|
||||||
on_server_started=http://127.0.0.1:18978/index/hook/on_server_started
|
on_server_started=http://polaris-wvp:18978/index/hook/on_server_started
|
||||||
on_shell_login=
|
on_shell_login=
|
||||||
on_stream_changed=http://127.0.0.1:18978/index/hook/on_stream_changed
|
on_stream_changed=http://polaris-wvp:18978/index/hook/on_stream_changed
|
||||||
on_stream_none_reader=http://127.0.0.1:18978/index/hook/on_stream_none_reader
|
on_stream_none_reader=http://polaris-wvp:18978/index/hook/on_stream_none_reader
|
||||||
on_stream_not_found=http://127.0.0.1:18978/index/hook/on_stream_not_found
|
on_stream_not_found=http://polaris-wvp:18978/index/hook/on_stream_not_found
|
||||||
retry=1
|
retry=1
|
||||||
retry_delay=3.0
|
retry_delay=3.0
|
||||||
stream_changed_schemas=rtsp/rtmp/fmp4/ts/hls/hls.fmp4
|
stream_changed_schemas=rtsp/rtmp/fmp4/ts/hls/hls.fmp4
|
||||||
@ -82,10 +82,10 @@ forwarded_ip_header=
|
|||||||
keepAliveSecond=30
|
keepAliveSecond=30
|
||||||
maxReqSize=40960
|
maxReqSize=40960
|
||||||
notFound=<html><head><title>404 Not Found</title></head><body bgcolor="white"><center><h1>您访问的资源不存在!</h1></center><hr><center>ZLMediaKit(git hash:8ccb4e9/%aI,branch:master,build time:2024-11-07T10:34:19)</center></body></html>
|
notFound=<html><head><title>404 Not Found</title></head><body bgcolor="white"><center><h1>您访问的资源不存在!</h1></center><hr><center>ZLMediaKit(git hash:8ccb4e9/%aI,branch:master,build time:2024-11-07T10:34:19)</center></body></html>
|
||||||
port=6080
|
port=80
|
||||||
rootPath=./www
|
rootPath=./www
|
||||||
sendBufSize=65536
|
sendBufSize=65536
|
||||||
sslport=4443
|
sslport=443
|
||||||
virtualPath=
|
virtualPath=
|
||||||
|
|
||||||
[multicast]
|
[multicast]
|
||||||
@ -99,7 +99,7 @@ auto_close=0
|
|||||||
continue_push_ms=3000
|
continue_push_ms=3000
|
||||||
enable_audio=1
|
enable_audio=1
|
||||||
enable_fmp4=1
|
enable_fmp4=1
|
||||||
enable_hls=1
|
enable_hls=0
|
||||||
enable_hls_fmp4=0
|
enable_hls_fmp4=0
|
||||||
enable_mp4=0
|
enable_mp4=0
|
||||||
enable_rtmp=1
|
enable_rtmp=1
|
||||||
@ -111,7 +111,7 @@ hls_save_path=./www
|
|||||||
modify_stamp=2
|
modify_stamp=2
|
||||||
mp4_as_player=0
|
mp4_as_player=0
|
||||||
mp4_max_second=3600
|
mp4_max_second=3600
|
||||||
mp4_save_path=/opt/media
|
mp4_save_path=/opt/media/bin/www
|
||||||
paced_sender_ms=0
|
paced_sender_ms=0
|
||||||
rtmp_demand=0
|
rtmp_demand=0
|
||||||
rtsp_demand=0
|
rtsp_demand=0
|
||||||
@ -119,7 +119,7 @@ ts_demand=0
|
|||||||
|
|
||||||
[record]
|
[record]
|
||||||
appName=record
|
appName=record
|
||||||
enableFmp4=0
|
enableFmp4=1
|
||||||
fastStart=0
|
fastStart=0
|
||||||
fileBufSize=65536
|
fileBufSize=65536
|
||||||
fileRepeat=0
|
fileRepeat=0
|
||||||
@ -151,7 +151,7 @@ directProxy=1
|
|||||||
enhanced=0
|
enhanced=0
|
||||||
handshakeSecond=15
|
handshakeSecond=15
|
||||||
keepAliveSecond=15
|
keepAliveSecond=15
|
||||||
port=10935
|
port=10001
|
||||||
sslport=0
|
sslport=0
|
||||||
|
|
||||||
[rtp]
|
[rtp]
|
||||||
@ -168,7 +168,7 @@ h264_pt=98
|
|||||||
h265_pt=99
|
h265_pt=99
|
||||||
merge_frame=1
|
merge_frame=1
|
||||||
opus_pt=100
|
opus_pt=100
|
||||||
port=10000
|
port=10003
|
||||||
port_range=30000-30500
|
port_range=30000-30500
|
||||||
ps_pt=96
|
ps_pt=96
|
||||||
rtp_g711_dur_ms=100
|
rtp_g711_dur_ms=100
|
||||||
@ -181,7 +181,7 @@ directProxy=1
|
|||||||
handshakeSecond=15
|
handshakeSecond=15
|
||||||
keepAliveSecond=15
|
keepAliveSecond=15
|
||||||
lowLatency=0
|
lowLatency=0
|
||||||
port=5540
|
port=10002
|
||||||
rtpTransportType=-1
|
rtpTransportType=-1
|
||||||
sslport=0
|
sslport=0
|
||||||
|
|
||||||
|
|||||||
@ -1,55 +0,0 @@
|
|||||||
#user nobody;
|
|
||||||
worker_processes 1;
|
|
||||||
|
|
||||||
#error_log logs/error.log;
|
|
||||||
#error_log logs/error.log notice;
|
|
||||||
#error_log logs/error.log info;
|
|
||||||
|
|
||||||
#pid logs/nginx.pid;
|
|
||||||
|
|
||||||
|
|
||||||
events {
|
|
||||||
worker_connections 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
http {
|
|
||||||
include mime.types;
|
|
||||||
default_type application/octet-stream;
|
|
||||||
|
|
||||||
sendfile on;
|
|
||||||
#tcp_nopush on;
|
|
||||||
|
|
||||||
#keepalive_timeout 0;
|
|
||||||
keepalive_timeout 65;
|
|
||||||
|
|
||||||
#gzip on;
|
|
||||||
|
|
||||||
server {
|
|
||||||
listen 8080;
|
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
root /opt/dist;
|
|
||||||
index index.html index.htm;
|
|
||||||
}
|
|
||||||
location /record_proxy/{
|
|
||||||
proxy_set_header Host $http_host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header REMOTE-HOST $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_pass http://polaris-wvp:18978/;
|
|
||||||
}
|
|
||||||
location /api/ {
|
|
||||||
proxy_set_header Host $http_host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header REMOTE-HOST $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_pass http://polaris-wvp:18978;
|
|
||||||
}
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
|
||||||
location = /50x.html {
|
|
||||||
root html;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
110
docker/nginx/templates/nginx.conf.template
Normal file
110
docker/nginx/templates/nginx.conf.template
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
server {
|
||||||
|
listen 8080;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /opt/dist;
|
||||||
|
index index.html index.htm;
|
||||||
|
}
|
||||||
|
location /record_proxy/{
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header REMOTE-HOST $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_pass http://polaris-wvp:18978/;
|
||||||
|
}
|
||||||
|
location /api/ {
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header REMOTE-HOST $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_pass http://polaris-wvp:18978;
|
||||||
|
|
||||||
|
|
||||||
|
# 从环境变量获取原始主机地址(x.x.x.x)
|
||||||
|
set $original_host ${Stream_IP};
|
||||||
|
|
||||||
|
# 执行字符串替换
|
||||||
|
# 将媒体资源文件替换为Nginx输出的相对地址
|
||||||
|
sub_filter "http://$original_host/index/api/downloadFile" "mediaserver/api/downloadFile";
|
||||||
|
sub_filter "http://$original_host:80/index/api/downloadFile" "mediaserver/api/downloadFile";
|
||||||
|
sub_filter "https://$original_host/index/api/downloadFile" "mediaserver/api/downloadFile";
|
||||||
|
sub_filter "https://$original_host:443/index/api/downloadFile" "mediaserver/api/downloadFile";
|
||||||
|
sub_filter "http://$original_host/mp4_record" "mp4_record";
|
||||||
|
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";
|
||||||
|
|
||||||
|
# 设置为off表示替换所有匹配项,而不仅仅是第一个
|
||||||
|
sub_filter_once off;
|
||||||
|
|
||||||
|
# 确保响应被正确处理
|
||||||
|
sub_filter_types application/json; # 只对JSON响应进行处理
|
||||||
|
}
|
||||||
|
|
||||||
|
# 将mediaserver/record转发到目标地址
|
||||||
|
location /mediaserver/api/downloadFile {
|
||||||
|
# 目标服务器地址
|
||||||
|
proxy_pass http://polaris-media:80/index/api/downloadFile;
|
||||||
|
|
||||||
|
# 以下是常用的反向代理设置
|
||||||
|
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;
|
||||||
|
|
||||||
|
# 超时设置,根据需要调整
|
||||||
|
proxy_connect_timeout 300s;
|
||||||
|
proxy_send_timeout 300s;
|
||||||
|
proxy_read_timeout 300s;
|
||||||
|
}
|
||||||
|
|
||||||
|
# 仅允许代理/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;
|
||||||
|
}
|
||||||
|
|
||||||
|
# 仅允许代理/rtp/开头的路径
|
||||||
|
location ^~ /mp4_record/ {
|
||||||
|
# 代理到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;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root html;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,73 +1,107 @@
|
|||||||
spring:
|
spring:
|
||||||
# 设置接口超时时间
|
cache:
|
||||||
mvc:
|
type: redis
|
||||||
async:
|
thymeleaf:
|
||||||
request-timeout: 20000
|
cache: false
|
||||||
thymeleaf:
|
# 设置接口超时时间
|
||||||
cache: false
|
mvc:
|
||||||
# [可选]上传文件大小限制
|
async:
|
||||||
servlet:
|
request-timeout: 20000
|
||||||
multipart:
|
# [可选]上传文件大小限制
|
||||||
max-file-size: 10MB
|
servlet:
|
||||||
max-request-size: 100MB
|
multipart:
|
||||||
# REDIS数据库配置
|
max-file-size: 10MB
|
||||||
redis:
|
max-request-size: 100MB
|
||||||
# [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1
|
# REDIS数据库配置
|
||||||
host: ${REDIS_HOST:127.0.0.1}
|
redis:
|
||||||
# [必须修改] 端口号
|
# [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1
|
||||||
port: ${REDIS_PORT:6379}
|
host: ${REDIS_HOST:127.0.0.1}
|
||||||
# [可选] 数据库 DB
|
# [必须修改] 端口号
|
||||||
database: 1
|
port: ${REDIS_PORT:6379}
|
||||||
# [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接
|
# [可选] 数据库 DB
|
||||||
password:
|
database: 1
|
||||||
# [可选] 超时时间
|
# [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接
|
||||||
timeout: 30000
|
password:
|
||||||
# mysql数据源
|
# [可选] 超时时间
|
||||||
datasource:
|
timeout: 10000
|
||||||
type: com.zaxxer.hikari.HikariDataSource
|
## [可选] 一个pool最多可分配多少个jedis实例
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
#poolMaxTotal: 1000
|
||||||
url: jdbc:mysql://${DATABASE_HOST:127.0.0.1}:${DATABASE_PORT:3306}/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true
|
## [可选] 一个pool最多有多少个状态为idle(空闲)的jedis实例
|
||||||
username: ${DATABASE_USER:root}
|
#poolMaxIdle: 500
|
||||||
password: ${DATABASE_PASSWORD:root}
|
## [可选] 最大的等待时间(秒)
|
||||||
|
#poolMaxWait: 5
|
||||||
|
# [必选] jdbc数据库配置
|
||||||
|
datasource:
|
||||||
|
# mysql数据源
|
||||||
|
type: com.zaxxer.hikari.HikariDataSource
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://${DATABASE_HOST:127.0.0.1}:${DATABASE_PORT:3306}/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true
|
||||||
|
username: ${DATABASE_USER:root}
|
||||||
|
password: ${DATABASE_PASSWORD:root}
|
||||||
|
|
||||||
#[可选] 监听的HTTP端口, 网页和接口调用都是这个端口
|
#[可选] 监听的HTTP端口, 网页和接口调用都是这个端口
|
||||||
server:
|
server:
|
||||||
port: 18978
|
port: 18978
|
||||||
ssl:
|
ssl:
|
||||||
# [可选] 是否开启HTTPS访问
|
# [可选] 是否开启HTTPS访问
|
||||||
enabled: false
|
# docker里运行,内部不需要HTTPS
|
||||||
|
enabled: false
|
||||||
# 作为28181服务器的配置
|
# 作为28181服务器的配置
|
||||||
sip:
|
sip:
|
||||||
# [必须修改] 本机的IP
|
# [必须修改] 本机的IP,对应你的网卡,监听什么ip就是使用什么网卡,
|
||||||
ip: ${SIP_HOST:127.0.0.1}
|
# 如果要监听多张网卡,可以使用逗号分隔多个IP, 例如: 192.168.1.4,10.0.0.4
|
||||||
# [可选]
|
# 如果不明白,就使用0.0.0.0,大部分情况都是可以的
|
||||||
port: 8116
|
# 请不要使用127.0.0.1,任何包括localhost在内的域名都是不可以的。
|
||||||
# [可选]
|
ip: 0.0.0.0
|
||||||
domain: 3402000000
|
# [可选] 没有任何业务需求,仅仅是在前端展示的时候用
|
||||||
# [可选]
|
show-ip: ${SIP_ShowIP}
|
||||||
id: 34020000002000000001
|
# [可选]
|
||||||
password:
|
port: ${SIP_Port:8116}
|
||||||
alarm: true
|
# 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007)
|
||||||
|
# 后两位为行业编码,定义参照附录D.3
|
||||||
|
# 3701020049标识山东济南历下区 信息行业接入
|
||||||
|
# [可选]
|
||||||
|
domain: ${SIP_Domain:3402000000}
|
||||||
|
# [可选]
|
||||||
|
id: ${SIP_Id:34020000002000000001}
|
||||||
|
# [可选] 默认设备认证密码,后续扩展使用设备单独密码, 移除密码将不进行校验
|
||||||
|
password: ${SIP_Password}
|
||||||
|
# [可选] 国标级联注册失败,再次发起注册的时间间隔。 默认60秒
|
||||||
|
register-time-interval: 60
|
||||||
|
# [可选] 云台控制速度
|
||||||
|
ptz-speed: 50
|
||||||
|
# TODO [可选] 收到心跳后自动上线, 重启服务后会将所有设备置为离线,默认false,等待注册后上线。设置为true则收到心跳设置为上线。
|
||||||
|
# keepalliveToOnline: false
|
||||||
|
# 是否存储alarm信息
|
||||||
|
alarm: true
|
||||||
|
# 命令发送等待回复的超时时间, 单位:毫秒
|
||||||
|
timeout: 1000
|
||||||
|
|
||||||
# 默认服务器配置
|
# 默认服务器配置
|
||||||
media:
|
media:
|
||||||
id: polaris
|
id: polaris
|
||||||
# [必须修改] ZLM 内网IP与端口
|
# [必须修改] ZLM 内网IP与端口
|
||||||
ip: ${ZLM_HOST:127.0.0.1}
|
ip: ${ZLM_HOST:127.0.0.1}
|
||||||
http-port: ${ZLM_PORT:6080}
|
http-port: 80
|
||||||
# [可选] 返回流地址时的ip,置空使用 media.ip
|
# [可选] 返回流地址时的ip,置空使用 media.ip
|
||||||
stream-ip: ${STREAM_HOST:127.0.0.1}
|
stream-ip: ${Stream_IP}
|
||||||
# [可选] wvp在国标信令中使用的ip,此ip为摄像机可以访问到的ip, 置空使用 media.ip
|
# [可选] wvp在国标信令中使用的ip,此ip为摄像机可以访问到的ip, 置空使用 media.ip
|
||||||
sdp-ip: ${SIP_HOST:127.0.0.1}
|
sdp-ip: ${SDP_IP}
|
||||||
# [可选] Hook IP, 默认使用sip.ip
|
# [可选] zlm服务器访问WVP所使用的IP, 默认使用127.0.0.1,zlm和wvp没有部署在同一台服务器时必须配置
|
||||||
hook-ip: ${SIP_HOST:127.0.0.1}
|
hook-ip: ${ZLM_HOOK_HOST}
|
||||||
# [可选] sslport
|
# [可选] sslport
|
||||||
http-ssl-port: 4443
|
http-ssl-port: 0
|
||||||
rtp-proxy-port: 10000
|
flv-port: ${MediaHttp:}
|
||||||
rtmp-port: 10935
|
flv-ssl-port: ${MediaHttps:}
|
||||||
rtmp-ssl-port: 41935
|
ws-flv-port: ${MediaHttp:}
|
||||||
rtsp-port: 5540
|
ws-flv-ssl-port: ${MediaHttps:}
|
||||||
rtsp-ssl-port: 45540
|
rtp-proxy-port: ${MediaRtp:}
|
||||||
|
rtmp-port: ${MediaRtmp:}
|
||||||
|
rtmp-ssl-port: 0
|
||||||
|
rtsp-port: ${MediaRtsp:}
|
||||||
|
rtsp-ssl-port: 0
|
||||||
|
# [可选] 是否自动配置ZLM, 如果希望手动配置ZLM, 可以设为false, 不建议新接触的用户修改
|
||||||
|
auto-config: true
|
||||||
# [可选]
|
# [可选]
|
||||||
secret: ${ZLM_SERCERT}
|
secret: ${ZLM_SERCERT}
|
||||||
# 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试
|
# 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试
|
||||||
@ -79,28 +113,28 @@ media:
|
|||||||
# [可选]
|
# [可选]
|
||||||
send-port-range: 50502,50506
|
send-port-range: 50502,50506
|
||||||
|
|
||||||
record-path: /opt/media/record
|
record-path: /opt/media/bin/www/record/
|
||||||
record-day: 7
|
record-day: 7
|
||||||
record-assist-port: 0
|
record-assist-port: 0
|
||||||
user-settings:
|
user-settings:
|
||||||
auto-apply-play: true
|
auto-apply-play: true
|
||||||
play-timeout: 30000
|
play-timeout: 30000
|
||||||
wait-track: false
|
wait-track: false
|
||||||
record-push-live: false
|
record-push-live: ${RecordPushLive:false}
|
||||||
record-sip: false
|
record-sip: ${RecordSip:false}
|
||||||
stream-on-demand: true
|
stream-on-demand: true
|
||||||
interface-authentication: false
|
interface-authentication: true
|
||||||
broadcast-for-platform: TCP-PASSIVE
|
broadcast-for-platform: TCP-PASSIVE
|
||||||
push-stream-after-ack: true
|
push-stream-after-ack: true
|
||||||
send-to-platforms-when-id-lost: true
|
send-to-platforms-when-id-lost: true
|
||||||
interface-authentication-excludes:
|
interface-authentication-excludes:
|
||||||
- /api/**
|
# - /api/**
|
||||||
push-authority: false
|
push-authority: true
|
||||||
allowed-origins:
|
# allowed-origins:
|
||||||
- http://localhost:8080
|
# - http://localhost:8080
|
||||||
- http://127.0.0.1:8080
|
# - http://127.0.0.1:8080
|
||||||
- http://0.0.0.0:8080
|
# - http://0.0.0.0:8080
|
||||||
- ${NGINX_HOST}
|
# - ${NGINX_HOST}
|
||||||
logging:
|
logging:
|
||||||
config: classpath:logback-spring.xml
|
config: classpath:logback-spring.xml
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user