diff --git a/.gitignore b/.gitignore index c937a5c..8fe9926 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ logs/* # BlueJ files *.ctxt +*.DS_Store* # Mobile Tools for Java (J2ME) .mtj.tmp/ diff --git a/.gitmodules b/.gitmodules index 00f3861..e3c4e68 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "wvpcode"] - path = wvpcode + path = docker/wvp/wvpcode url = http://th.local.t-aaron.com:13000/THENG/stream-wvp.git diff --git a/docker/build.sh b/docker/build.sh deleted file mode 100755 index 5dd3e8e..0000000 --- a/docker/build.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash - -# 获取当前日期作为标签(格式:YYYYMMDD) -date_tag=$(date +%Y%m%d) - -# 切换到脚本所在目录的上一级目录作为工作目录 -cd "$(dirname "$0")/.." || { - echo "错误:无法切换到上级目录" - 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" - - # 检查Dockerfile是否存在 - if [ ! -f "$dockerfile_path" ]; then - 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 -} - -# 循环构建所有镜像 -for item in "${images[@]}"; do - IFS=':' read -r image_name dockerfile_path <<< "$item" - build_image "$image_name" "$dockerfile_path" -done - -echo "所有镜像处理完成" -exit 0 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 9758161..73a9e58 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -80,57 +80,22 @@ services: ] polaris-wvp: - # 显式指定构建上下文和Dockerfile路径 - build: - context: .. # 构建上下文的根路径 - dockerfile: ./docker/wvp/Dockerfile # 相对于上下文路径的Dockerfile位置 + image: polaris-wvp:2.7.6 restart: always networks: - media-net ports: - "18978:18978" - - "${SIP_Port:-8116}:${SIP_Port:-8116}/udp" - - "${SIP_Port:-8116}:${SIP_Port:-8116}/tcp" + - "${SIP_Port:-8160}:8160/udp" + - "${SIP_Port:-8160}:8160/tcp" depends_on: - polaris-redis - polaris-mysql - polaris-media volumes: - - ./wvp/wvp/:/opt/ylcx/wvp/ - ./logs/wvp:/opt/wvp/logs/ environment: TZ: "Asia/Shanghai" - # 流链接的IP - Stream_IP: ${Stream_IP} - # 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_SERCERT: su6TiedN2rVAmBbIDX0aa0QTiBJLBdcf - - MediaHttp: ${WebHttp:-8080} - #MediaHttps: ${WebHttps:-8081} - MediaRtmp: ${MediaRtmp:-10935} - MediaRtsp: ${MediaRtsp:-5540} - MediaRtp: ${MediaRtp:-10000} - - REDIS_HOST: polaris-redis - REDIS_PORT: 6379 - - DATABASE_HOST: polaris-mysql - DATABASE_PORT: 3306 - DATABASE_USER: wvp_user - DATABASE_PASSWORD: wvp_password - - 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: # 显式指定构建上下文和Dockerfile路径 diff --git a/docker/wvp/Dockerfile b/docker/wvp/Dockerfile index 74c3968..58dd0bb 100644 --- a/docker/wvp/Dockerfile +++ b/docker/wvp/Dockerfile @@ -1,5 +1,4 @@ FROM eclipse-temurin:17-jdk AS builder - EXPOSE 18978/tcp EXPOSE 8116/tcp EXPOSE 8116/udp @@ -52,7 +51,7 @@ RUN apt-get update && \ rm -rf /var/lib/apt/lists/* -COPY . /build +COPY wvpcode /build WORKDIR /build RUN ls && mvn clean package -Dmaven.test.skip=true WORKDIR /build/target @@ -63,8 +62,7 @@ FROM eclipse-temurin:17-jre RUN mkdir -p /opt/wvp WORKDIR /opt/wvp COPY --from=builder /build/target /opt/wvp -COPY ./docker/wvp/wvp /opt/wvp -ENTRYPOINT ["java", "-Xms512m", "-Xmx1024m", "-XX:+HeapDumpOnOutOfMemoryError", "-XX:HeapDumpPath=/opt/ylcx/", "-jar", "wvp.jar", "--spring.config.location=/opt/ylcx/wvp/application.yml"] +ENTRYPOINT ["java", "-Xms512m", "-Xmx1024m", "-XX:+HeapDumpOnOutOfMemoryError", "-XX:HeapDumpPath=/opt/wvp/", "-jar", "wvp.jar"] diff --git a/docker/wvp/build.sh b/docker/wvp/build.sh index f45df29..56d3038 100755 --- a/docker/wvp/build.sh +++ b/docker/wvp/build.sh @@ -1,8 +1,9 @@ #/bin/bash set -e -version=2.7.3 +version=2.7.6 -docker build -t polaris-wvp:${version} . +# Use current directory as build context to access both wvpcode and wvp folders +docker build --no-cache -f ./Dockerfile -t polaris-wvp:${version} . docker tag polaris-wvp:${version} polaris-tian-docker.pkg.coding.net/qt/polaris/polaris-wvp:${version} docker tag polaris-wvp:${version} polaris-tian-docker.pkg.coding.net/qt/polaris/polaris-wvp:latest \ No newline at end of file diff --git a/docker/wvp/wvp/application-base.yml b/docker/wvp/wvp/application-base.yml deleted file mode 100755 index c15c6e5..0000000 --- a/docker/wvp/wvp/application-base.yml +++ /dev/null @@ -1,105 +0,0 @@ -spring: - # 设置接口超时时间 - mvc: - async: - request-timeout: 20000 - thymeleaf: - cache: false - # [可选]上传文件大小限制 - servlet: - multipart: - max-file-size: 10MB - max-request-size: 100MB - # REDIS数据库配置 - redis: - # [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 - host: 127.0.0.1 - # [必须修改] 端口号 - port: 6379 - # [可选] 数据库 DB - database: 1 - # [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接 - password: - # [可选] 超时时间 - timeout: 30000 - # mysql数据源 - datasource: - dynamic: - type: com.zaxxer.hikari.HikariDataSource - driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true - username: root - password: root -#[可选] 监听的HTTP端口, 网页和接口调用都是这个端口 -server: - port: 18978 - ssl: - # [可选] 是否开启HTTPS访问 - enabled: false -# 作为28181服务器的配置 -sip: - # [必须修改] 本机的IP - ip: 127.0.0.1 - # [可选] - port: 8116 - # [可选] - domain: 3402000000 - # [可选] - id: 34020000002000000001 - password: - alarm: true - -# 默认服务器配置 -media: - id: polaris - # [必须修改]内网IP - ip: 127.0.0.1 - http-port: 6080 - # [可选] 返回流地址时的ip,置空使用 media.ip - stream-ip: 127.0.0.1 - # [可选] wvp在国标信令中使用的ip,此ip为摄像机可以访问到的ip, 置空使用 media.ip - sdp-ip: 127.0.0.1 - # [可选] Hook IP, 默认使用sip.ip - hook-ip: 127.0.0.1 - # [可选] sslport - http-ssl-port: 4443 - rtp-proxy-port: 10000 - rtmp-port: 10935 - rtmp-ssl-port: 41935 - rtsp-port: 5540 - rtsp-ssl-port: 45540 - # [可选] - secret: su6TiedN2rVAmBbIDX0aa0QTiBJLBdcf - # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试 - rtp: - # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输 - enable: false - # [可选] - port-range: 30000,30500 - # [可选] - send-port-range: 50502,50506 - - record-path: /opt/media/record - record-day: 7 - record-assist-port: 0 -user-settings: - auto-apply-play: true - play-timeout: 30000 - wait-track: false - record-push-live: false - record-sip: false - stream-on-demand: true - interface-authentication: false - broadcast-for-platform: TCP-PASSIVE - push-stream-after-ack: true - send-to-platforms-when-id-lost: true - interface-authentication-excludes: - - /api/** - push-authority: false - allowed-origins: - - http://localhost:8080 - - http://127.0.0.1:8080 - - http://0.0.0.0:8080 -logging: - config: classpath:logback-spring.xml - diff --git a/docker/wvp/wvp/application-docker.yml b/docker/wvp/wvp/application-docker.yml deleted file mode 100644 index 04eeff8..0000000 --- a/docker/wvp/wvp/application-docker.yml +++ /dev/null @@ -1,140 +0,0 @@ -spring: - cache: - type: redis - thymeleaf: - cache: false - # 设置接口超时时间 - mvc: - async: - request-timeout: 20000 - # [可选]上传文件大小限制 - servlet: - multipart: - max-file-size: 10MB - max-request-size: 100MB - # REDIS数据库配置 - redis: - # [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 - host: ${REDIS_HOST:127.0.0.1} - # [必须修改] 端口号 - port: ${REDIS_PORT:6379} - # [可选] 数据库 DB - database: 1 - # [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接 - password: - # [可选] 超时时间 - timeout: 10000 - ## [可选] 一个pool最多可分配多少个jedis实例 - #poolMaxTotal: 1000 - ## [可选] 一个pool最多有多少个状态为idle(空闲)的jedis实例 - #poolMaxIdle: 500 - ## [可选] 最大的等待时间(秒) - #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端口, 网页和接口调用都是这个端口 -server: - port: 18978 - ssl: - # [可选] 是否开启HTTPS访问 - # docker里运行,内部不需要HTTPS - enabled: false -# 作为28181服务器的配置 -sip: - # [必须修改] 本机的IP,对应你的网卡,监听什么ip就是使用什么网卡, - # 如果要监听多张网卡,可以使用逗号分隔多个IP, 例如: 192.168.1.4,10.0.0.4 - # 如果不明白,就使用0.0.0.0,大部分情况都是可以的 - # 请不要使用127.0.0.1,任何包括localhost在内的域名都是不可以的。 - ip: 0.0.0.0 - # [可选] 没有任何业务需求,仅仅是在前端展示的时候用 - show-ip: ${SIP_ShowIP} - # [可选] - port: ${SIP_Port:8116} - # 根据国标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: - id: polaris - # [必须修改] ZLM 内网IP与端口 - ip: ${ZLM_HOST:127.0.0.1} - http-port: 80 - # [可选] 返回流地址时的ip,置空使用 media.ip - stream-ip: ${Stream_IP} - # [可选] wvp在国标信令中使用的ip,此ip为摄像机可以访问到的ip, 置空使用 media.ip - sdp-ip: ${SDP_IP} - # [可选] zlm服务器访问WVP所使用的IP, 默认使用127.0.0.1,zlm和wvp没有部署在同一台服务器时必须配置 - hook-ip: ${ZLM_HOOK_HOST} - # [可选] sslport - http-ssl-port: 0 - flv-port: ${MediaHttp:} - flv-ssl-port: ${MediaHttps:} - ws-flv-port: ${MediaHttp:} - ws-flv-ssl-port: ${MediaHttps:} - 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} - # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试 - rtp: - # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输 - enable: false - # [可选] - port-range: 30000,30500 - # [可选] - send-port-range: 50502,50506 - - record-path: /opt/media/bin/www/record/ - record-day: 7 - record-assist-port: 0 -user-settings: - auto-apply-play: true - play-timeout: 30000 - wait-track: false - record-push-live: ${RecordPushLive:false} - record-sip: ${RecordSip:false} - stream-on-demand: true - interface-authentication: true - broadcast-for-platform: TCP-PASSIVE - push-stream-after-ack: true - send-to-platforms-when-id-lost: true - interface-authentication-excludes: - # - /api/** - push-authority: true - # allowed-origins: - # - http://localhost:8080 - # - http://127.0.0.1:8080 - # - http://0.0.0.0:8080 - # - ${NGINX_HOST} -logging: - config: classpath:logback-spring.xml - diff --git a/docker/wvp/wvp/application.yml b/docker/wvp/wvp/application.yml deleted file mode 100755 index 4496fb6..0000000 --- a/docker/wvp/wvp/application.yml +++ /dev/null @@ -1,5 +0,0 @@ -spring: - application: - name: wvp - profiles: - active: docker \ No newline at end of file diff --git a/docker/wvp/wvpcode b/docker/wvp/wvpcode new file mode 160000 index 0000000..9164021 --- /dev/null +++ b/docker/wvp/wvpcode @@ -0,0 +1 @@ +Subproject commit 91640212232898147961fa84ccc4d82f99c5d64b diff --git a/reademe/help.md b/reademe/help.md new file mode 100644 index 0000000..f90cf7e --- /dev/null +++ b/reademe/help.md @@ -0,0 +1,2 @@ +1: 查看镜像内的配置文件 +docker run --rm --entrypoint cat polaris-wvp:2.7.3 /opt/ylcx/wvp/application.yml > /tmp/wvp-image-application.yml \ No newline at end of file diff --git a/wvpcode b/wvpcode deleted file mode 160000 index fca8e74..0000000 --- a/wvpcode +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fca8e742063459a3acbcef189eba2f118b7069a1