From 3534268854a60d5c0272b324d7a141f890e1adb5 Mon Sep 17 00:00:00 2001 From: xiaoxie Date: Fri, 5 Nov 2021 11:37:11 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E5=B0=9D=E8=AF=95docker-compose=E5=90=AF?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/assist/Dockerfile | 26 ++++++ docker/docker-compose.yml | 45 +++++++++++ docker/redis/redis.conf | 2 + docker/wvp/Dockerfile | 24 ++++++ docker/zlm/Dockerfile | 63 +++++++++++++++ src/main/resources/application-docker.yml | 97 +++++++++++++++++++++++ 6 files changed, 257 insertions(+) create mode 100644 docker/assist/Dockerfile create mode 100644 docker/docker-compose.yml create mode 100644 docker/redis/redis.conf create mode 100644 docker/wvp/Dockerfile create mode 100644 docker/zlm/Dockerfile create mode 100644 src/main/resources/application-docker.yml diff --git a/docker/assist/Dockerfile b/docker/assist/Dockerfile new file mode 100644 index 00000000..c64775df --- /dev/null +++ b/docker/assist/Dockerfile @@ -0,0 +1,26 @@ +FROM openjdk:11-jre-buster AS build +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get update && \ + DEBIAN_FRONTEND="noninteractive" && \ + apt-get install -y --no-install-recommends git maven && \ + cd /home && \ + git clone https://gitee.com/18010473990/maven.git && \ + cp maven/settings.xml /usr/share/maven/conf/ && \ + git clone https://gitee.com/xieyu1989/wvp-pro-assist.git &&\ + cd /home/wvp-pro-assist + mvn clean package -Dmaven.test.skip=true && \ + cp /home/wvp-pro-assist/target/*.jar /opt/assist/ + cp /home/wvp-pro-assist/src/main/resources/application-docker.yml /opt/assist/conf/application.yml + +FROM ubuntu:20.04 +ARG DEBIAN_FRONTEND=noninteractive +EXPOSE 18081/tcp +RUN apt-get update && \ + DEBIAN_FRONTEND="noninteractive" && \ + apt-get install -y --no-install-recommends openjdk-11-jre-headless ca-certificates ffmpeg && \ + apt-get autoremove -y && \ + apt-get clean -y && \ + rm -rf /var/lib/apt/lists/*dic +COPY --from=build /opt /opt +WORKDIR /opt/wvp +CMD ["java", "-jar","*.jar","--spring.config.location=/opt/assist/conf/application.yml"] diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 00000000..8c6c1769 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,45 @@ +version: '3' +services: + redis: + image: redis + restart: always + volumes: + - ./redis/redis.conf:/etc/redis/redis_default.conf + - ./redis/data/:/data + environment: + TZ: "Asia/Shanghai" + command: redis-server /etc/redis/redis_default.conf --appendonly yes + zlm: + image: panjjo/zlmediakit + restart: always + volumes: + - ../video:/home/lin/server/ZLMediaKit/release/linux/Debug/www/record/ + ports: + - "80:80" + - "10000:10000/tcp" + - "10000:10000/udp" + - "30000-30500:30000-30500/tcp" + - "30000-30500:30000-30500/udp" + environment: + TZ: "Asia/Shanghai" + assist: + build: + context: ./assist + restart: always + volumes: + - ./conf:/opt/assist/conf + - ../video:/home/lin/server/ZLMediaKit/release/linux/Debug/www/record/ + environment: + TZ: "Asia/Shanghai" + wvp: + build: + context: ./wvp + restart: always + volumes: + - ./conf:/opt/wvp/conf + ports: + - "5060:5060" + - "5060:5060/udp" + - "18080:18080" + environment: + TZ: "Asia/Shanghai" diff --git a/docker/redis/redis.conf b/docker/redis/redis.conf new file mode 100644 index 00000000..c211f137 --- /dev/null +++ b/docker/redis/redis.conf @@ -0,0 +1,2 @@ +requirepass root +bind 0.0.0.0 diff --git a/docker/wvp/Dockerfile b/docker/wvp/Dockerfile new file mode 100644 index 00000000..4278c9f9 --- /dev/null +++ b/docker/wvp/Dockerfile @@ -0,0 +1,24 @@ +FROM ubuntu:20.04 AS build +RUN apt-get update && \ + DEBIAN_FRONTEND="noninteractive" && \ + apt-get install -y --no-install-recommends openjdk-11-jre-headless git maven nodejs npm &&\ + cd /home &&\ + git clone https://gitee.com/18010473990/maven.git && \ + cp maven/settings.xml /usr/share/maven/conf/ && \ + git clone https://gitee.com/xieyu1989/wvp-GB28181.git && \ + cd /home/wvp-GB28181/web_src && \ + npm install && \ + npm run build && \ + mkdir -p /opt/wvp/config && \ + cd /home/wvp-GB28181 && \ + mvn clean package -Dmaven.test.skip=true && \ + cp src/main/resources/application-docker.yml /opt/wvp/conf/application.yml && \ + cp target/wvp*.jar /opt/wvp/ + +FROM openjdk:11-jre-buster +EXPOSE 18080/tcp +EXPOSE 5060:5060/tcp +EXPOSE 5060:5060/udp +COPY --from=build /opt /opt +WORKDIR /opt/wvp +CMD ["java", "-jar","*.jar","--spring.config.location=/opt/wvp/conf/application.yml"] diff --git a/docker/zlm/Dockerfile b/docker/zlm/Dockerfile new file mode 100644 index 00000000..ce3b6496 --- /dev/null +++ b/docker/zlm/Dockerfile @@ -0,0 +1,63 @@ +FROM ubuntu:18.04 AS build +#shell,rtmp,rtsp,rtsps,http,https,rtp +EXPOSE 9000/tcp +EXPOSE 1935/tcp +EXPOSE 554/tcp +EXPOSE 322/tcp +EXPOSE 80/tcp +EXPOSE 443/tcp +EXPOSE 10000/udp +EXPOSE 10000/tcp + +RUN apt-get update && \ + DEBIAN_FRONTEND="noninteractive" \ + apt-get install -y --no-install-recommends \ + build-essential \ + cmake \ + git \ + curl \ + vim \ + ca-certificates \ + tzdata \ + libssl-dev \ + libmysqlclient-dev \ + libx264-dev \ + libfaac-dev \ + libmp4v2-dev && \ + apt-get autoremove -y && \ + apt-get clean -y && \ + rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /opt/media + +WORKDIR /opt/media +RUN git clone --depth=1 https://github.com/xia-chu/ZLMediaKit && \ + cd ZLMediaKit && git submodule update --init --recursive && \ + mkdir -p build release/linux/Release/ + +WORKDIR /opt/media/ZLMediaKit/build +RUN cmake -DCMAKE_BUILD_TYPE=Release .. && \ + make + +FROM ubuntu:18.04 +LABEL maintainer "Gemfield " + +RUN apt-get update && \ + DEBIAN_FRONTEND="noninteractive" \ + apt-get install -y --no-install-recommends \ + vim \ + ca-certificates \ + tzdata \ + libssl-dev \ + libx264-dev \ + libfaac-dev \ + ffmpeg \ + libmp4v2-dev && \ + apt-get autoremove -y && \ + apt-get clean -y && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /opt/media/bin/ +COPY --from=build /opt/media/ZLMediaKit/release/linux/Release/MediaServer /opt/media/bin/MediaServer +ENV PATH /opt/media/bin:$PATH +CMD MediaServer diff --git a/src/main/resources/application-docker.yml b/src/main/resources/application-docker.yml new file mode 100644 index 00000000..ba59e684 --- /dev/null +++ b/src/main/resources/application-docker.yml @@ -0,0 +1,97 @@ +spring: + # REDIS数据库配置 + redis: + # [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 + host: redis + # [必须修改] 端口号 + port: 6379 + # [可选] 数据库 DB + database: 6 + # [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接 + password: root + # [可选] 超时时间 + timeout: 10000 + # [可选] jdbc数据库配置, 项目使用sqlite作为数据库,一般不需要配置 + datasource: + # 使用mysql 打开23-28行注释, 删除29-36行 + # name: wvp + # url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true + # username: + # password: + # type: com.alibaba.druid.pool.DruidDataSource + # driver-class-name: com.mysql.cj.jdbc.Driver + name: eiot + url: jdbc:sqlite::resource:wvp.sqlite + username: + password: + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name: org.sqlite.JDBC + max-active: 1 + min-idle: 1 + +# [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 +server: + port: 18080 + +# 作为28181服务器的配置 +sip: + # [必须修改] 本机的IP + ip: ${WVP_HOST:127.0.0.1} + # [可选] 28181服务监听的端口 + port: 5060 + # 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007) + # 后两位为行业编码,定义参照附录D.3 + # 3701020049标识山东济南历下区 信息行业接入 + # [可选] + domain: 6101130049 + # [可选] + id: 61011300490000000001 + # [可选] 默认设备认证密码,后续扩展使用设备单独密码, 移除密码将不进行校验 + password: admin123 + +#zlm 默认服务器配置 +media: + # [必须修改] zlm服务器的内网IP + ip: zlm + # [必须修改] zlm服务器的http.port + http-port: 80 + # [可选] zlm服务器的hook.admin_params=secret + secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc + # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试 + rtp: + # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输 + enable: true + # [可选] 在此范围内选择端口用于媒体流传输, + port-range: 30000,30500 # 端口范围 + # [可选] 国标级联在此范围内选择端口发送媒体流, + send-port-range: 30000,30500 # 端口范围 + # 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载, 0 表示不使用 + record-assist-port: 18081 + +# [可选] 日志配置, 一般不需要改 +logging: + file: + name: logs/wvp.log + max-history: 30 + max-size: 10MB + total-size-cap: 300MB + level: + com.genersoft.iot: debug + com.genersoft.iot.vmp.storager.dao: info + com.genersoft.iot.vmp.gb28181: info + +# [根据业务需求配置] +user-settings: + # 推流直播是否录制 + record-push-live: true + auto-apply-play: false + +# 在线文档: swagger-ui(生产环境建议关闭) +swagger-ui: + enabled: true + +# 版本信息, 不需修改 +version: + version: "@project.version@" + description: "@project.description@" + artifact-id: "@project.artifactId@" From 460bd4f9aa9225fbf25175b7287f7debfc87c9c6 Mon Sep 17 00:00:00 2001 From: xiaoxie Date: Fri, 5 Nov 2021 20:02:58 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E5=B0=9D=E8=AF=95docker-compose=E5=90=AF?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/assist/Dockerfile | 26 ------ docker/docker-compose.yml | 34 +++----- docker/wvp/Dockerfile | 90 ++++++++++++++++----- docker/zlm/Dockerfile | 63 --------------- src/main/resources/application-docker.yml | 97 ----------------------- 5 files changed, 80 insertions(+), 230 deletions(-) delete mode 100644 docker/assist/Dockerfile delete mode 100644 docker/zlm/Dockerfile delete mode 100644 src/main/resources/application-docker.yml diff --git a/docker/assist/Dockerfile b/docker/assist/Dockerfile deleted file mode 100644 index c64775df..00000000 --- a/docker/assist/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM openjdk:11-jre-buster AS build -ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get update && \ - DEBIAN_FRONTEND="noninteractive" && \ - apt-get install -y --no-install-recommends git maven && \ - cd /home && \ - git clone https://gitee.com/18010473990/maven.git && \ - cp maven/settings.xml /usr/share/maven/conf/ && \ - git clone https://gitee.com/xieyu1989/wvp-pro-assist.git &&\ - cd /home/wvp-pro-assist - mvn clean package -Dmaven.test.skip=true && \ - cp /home/wvp-pro-assist/target/*.jar /opt/assist/ - cp /home/wvp-pro-assist/src/main/resources/application-docker.yml /opt/assist/conf/application.yml - -FROM ubuntu:20.04 -ARG DEBIAN_FRONTEND=noninteractive -EXPOSE 18081/tcp -RUN apt-get update && \ - DEBIAN_FRONTEND="noninteractive" && \ - apt-get install -y --no-install-recommends openjdk-11-jre-headless ca-certificates ffmpeg && \ - apt-get autoremove -y && \ - apt-get clean -y && \ - rm -rf /var/lib/apt/lists/*dic -COPY --from=build /opt /opt -WORKDIR /opt/wvp -CMD ["java", "-jar","*.jar","--spring.config.location=/opt/assist/conf/application.yml"] diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 8c6c1769..6fa43ceb 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -9,37 +9,23 @@ services: environment: TZ: "Asia/Shanghai" command: redis-server /etc/redis/redis_default.conf --appendonly yes - zlm: - image: panjjo/zlmediakit - restart: always - volumes: - - ../video:/home/lin/server/ZLMediaKit/release/linux/Debug/www/record/ - ports: - - "80:80" - - "10000:10000/tcp" - - "10000:10000/udp" - - "30000-30500:30000-30500/tcp" - - "30000-30500:30000-30500/udp" - environment: - TZ: "Asia/Shanghai" - assist: - build: - context: ./assist - restart: always - volumes: - - ./conf:/opt/assist/conf - - ../video:/home/lin/server/ZLMediaKit/release/linux/Debug/www/record/ - environment: - TZ: "Asia/Shanghai" wvp: build: context: ./wvp restart: always - volumes: - - ./conf:/opt/wvp/conf ports: - "5060:5060" - "5060:5060/udp" - "18080:18080" + - "80:80" + - "10000:10000/tcp" + - "10000:10000/udp" + - "30000-30500:30000-30500/tcp" + - "30000-30500:30000-30500/udp" + volumes: + - ./video:/opt/media/www/record/ environment: TZ: "Asia/Shanghai" + WVP_HOST: 172.18.0.61 + depends_on: + - redis diff --git a/docker/wvp/Dockerfile b/docker/wvp/Dockerfile index 4278c9f9..334c559b 100644 --- a/docker/wvp/Dockerfile +++ b/docker/wvp/Dockerfile @@ -1,24 +1,74 @@ FROM ubuntu:20.04 AS build -RUN apt-get update && \ - DEBIAN_FRONTEND="noninteractive" && \ - apt-get install -y --no-install-recommends openjdk-11-jre-headless git maven nodejs npm &&\ - cd /home &&\ - git clone https://gitee.com/18010473990/maven.git && \ - cp maven/settings.xml /usr/share/maven/conf/ && \ - git clone https://gitee.com/xieyu1989/wvp-GB28181.git && \ - cd /home/wvp-GB28181/web_src && \ - npm install && \ - npm run build && \ - mkdir -p /opt/wvp/config && \ - cd /home/wvp-GB28181 && \ - mvn clean package -Dmaven.test.skip=true && \ - cp src/main/resources/application-docker.yml /opt/wvp/conf/application.yml && \ - cp target/wvp*.jar /opt/wvp/ - -FROM openjdk:11-jre-buster + +RUN export DEBIAN_FRONTEND=noninteractive &&\ + apt-get update && \ + apt-get install -y --no-install-recommends openjdk-11-jre git maven nodejs npm build-essential \ + cmake ca-certificates openssl ffmpeg && \ + + cd /home && \ + git clone https://gitee.com/18010473990/maven.git && \ + cp maven/settings.xml /usr/share/maven/conf/ && \ + git clone https://gitee.com/18010473990/wvp-GB28181.git && \ + git clone https://gitee.com/18010473990/wvp-pro-assist.git && \ + git clone --depth=1 https://gitee.com/xia-chu/ZLMediaKit && \ + mkdir -p /opt/wvp/config /opt/assist/config /opt/media/www/record && \ + + cd /home/wvp-GB28181/web_src && \ + npm install && \ + npm run build && \ + + cd /home/wvp-GB28181 && \ + mvn clean package -Dmaven.test.skip=true && \ + cp /home/wvp-GB28181/target/*.jar /opt/wvp/ && \ + cp /home/wvp-GB28181/src/main/resources/application-dev.yml /opt/wvp/config/application.yml && \ + + cd /home/wvp-pro-assist && \ + mvn clean package -Dmaven.test.skip=true && \ + cp /home/wvp-pro-assist/target/*.jar /opt/assist/ && \ + cp /home/wvp-pro-assist/src/main/resources/application-dev.yml /opt/assist/config/application.yml && \ + + cd /home/ZLMediaKit && \ + git submodule update --init --recursive && \ + mkdir -p build release/linux/Release/ &&\ + cd build && \ + cmake -DCMAKE_BUILD_TYPE=Release .. && \ + make -j4 && \ + rm -rf ../release/linux/Release/config.ini && \ + cp -r ../release/linux/Release/* /opt/media && \ + + cd /opt/wvp && \ + echo '#!/bin/bash' > run.sh && \ + echo 'echo ${WVP_IP}' >> run.sh && \ + echo 'echo ${WVP_CONFIG}' >> run.sh && \ + echo 'redis-server --daemonize yes --bind 0.0.0.0' >> run.sh && \ + echo 'cd /opt/assist' >> run.sh && \ + echo 'nohup java -jar *.jar --spring.config.location=/opt/assist/config/application.yml --userSettings.record=/opt/media/www/record/ --media.record-assist-port=18081 ${ASSIST_CONFIG} &' >> run.sh && \ + echo 'nohup /opt/media/MediaServer -d -m 3 &' >> run.sh && \ + echo 'cd /opt/wvp' >> run.sh && \ + echo 'java -jar *.jar --spring.config.location=/opt/wvp/config/application.yml --media.record-assist-port=18081 ${WVP_CONFIG}' >> run.sh && \ + chmod +x run.sh + +FROM ubuntu:20.04 + EXPOSE 18080/tcp -EXPOSE 5060:5060/tcp -EXPOSE 5060:5060/udp +EXPOSE 5060/tcp +EXPOSE 5060/udp +EXPOSE 6379/tcp +EXPOSE 18081/tcp +EXPOSE 80/tcp +EXPOSE 1935/tcp +EXPOSE 554/tcp +EXPOSE 554/udp +EXPOSE 30000-30500/tcp +EXPOSE 30000-30500/udp + +RUN export DEBIAN_FRONTEND=noninteractive &&\ + apt-get update && \ + apt-get install -y --no-install-recommends openjdk-11-jre ca-certificates ffmpeg language-pack-zh-hans && \ + apt-get autoremove -y && \ + apt-get clean -y && \ + rm -rf /var/lib/apt/lists/*dic + COPY --from=build /opt /opt WORKDIR /opt/wvp -CMD ["java", "-jar","*.jar","--spring.config.location=/opt/wvp/conf/application.yml"] +CMD ["sh", "run.sh"] diff --git a/docker/zlm/Dockerfile b/docker/zlm/Dockerfile deleted file mode 100644 index ce3b6496..00000000 --- a/docker/zlm/Dockerfile +++ /dev/null @@ -1,63 +0,0 @@ -FROM ubuntu:18.04 AS build -#shell,rtmp,rtsp,rtsps,http,https,rtp -EXPOSE 9000/tcp -EXPOSE 1935/tcp -EXPOSE 554/tcp -EXPOSE 322/tcp -EXPOSE 80/tcp -EXPOSE 443/tcp -EXPOSE 10000/udp -EXPOSE 10000/tcp - -RUN apt-get update && \ - DEBIAN_FRONTEND="noninteractive" \ - apt-get install -y --no-install-recommends \ - build-essential \ - cmake \ - git \ - curl \ - vim \ - ca-certificates \ - tzdata \ - libssl-dev \ - libmysqlclient-dev \ - libx264-dev \ - libfaac-dev \ - libmp4v2-dev && \ - apt-get autoremove -y && \ - apt-get clean -y && \ - rm -rf /var/lib/apt/lists/* - -RUN mkdir -p /opt/media - -WORKDIR /opt/media -RUN git clone --depth=1 https://github.com/xia-chu/ZLMediaKit && \ - cd ZLMediaKit && git submodule update --init --recursive && \ - mkdir -p build release/linux/Release/ - -WORKDIR /opt/media/ZLMediaKit/build -RUN cmake -DCMAKE_BUILD_TYPE=Release .. && \ - make - -FROM ubuntu:18.04 -LABEL maintainer "Gemfield " - -RUN apt-get update && \ - DEBIAN_FRONTEND="noninteractive" \ - apt-get install -y --no-install-recommends \ - vim \ - ca-certificates \ - tzdata \ - libssl-dev \ - libx264-dev \ - libfaac-dev \ - ffmpeg \ - libmp4v2-dev && \ - apt-get autoremove -y && \ - apt-get clean -y && \ - rm -rf /var/lib/apt/lists/* - -WORKDIR /opt/media/bin/ -COPY --from=build /opt/media/ZLMediaKit/release/linux/Release/MediaServer /opt/media/bin/MediaServer -ENV PATH /opt/media/bin:$PATH -CMD MediaServer diff --git a/src/main/resources/application-docker.yml b/src/main/resources/application-docker.yml deleted file mode 100644 index ba59e684..00000000 --- a/src/main/resources/application-docker.yml +++ /dev/null @@ -1,97 +0,0 @@ -spring: - # REDIS数据库配置 - redis: - # [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 - host: redis - # [必须修改] 端口号 - port: 6379 - # [可选] 数据库 DB - database: 6 - # [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接 - password: root - # [可选] 超时时间 - timeout: 10000 - # [可选] jdbc数据库配置, 项目使用sqlite作为数据库,一般不需要配置 - datasource: - # 使用mysql 打开23-28行注释, 删除29-36行 - # name: wvp - # url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true - # username: - # password: - # type: com.alibaba.druid.pool.DruidDataSource - # driver-class-name: com.mysql.cj.jdbc.Driver - name: eiot - url: jdbc:sqlite::resource:wvp.sqlite - username: - password: - type: com.alibaba.druid.pool.DruidDataSource - driver-class-name: org.sqlite.JDBC - max-active: 1 - min-idle: 1 - -# [可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 -server: - port: 18080 - -# 作为28181服务器的配置 -sip: - # [必须修改] 本机的IP - ip: ${WVP_HOST:127.0.0.1} - # [可选] 28181服务监听的端口 - port: 5060 - # 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007) - # 后两位为行业编码,定义参照附录D.3 - # 3701020049标识山东济南历下区 信息行业接入 - # [可选] - domain: 6101130049 - # [可选] - id: 61011300490000000001 - # [可选] 默认设备认证密码,后续扩展使用设备单独密码, 移除密码将不进行校验 - password: admin123 - -#zlm 默认服务器配置 -media: - # [必须修改] zlm服务器的内网IP - ip: zlm - # [必须修改] zlm服务器的http.port - http-port: 80 - # [可选] zlm服务器的hook.admin_params=secret - secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc - # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试 - rtp: - # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输 - enable: true - # [可选] 在此范围内选择端口用于媒体流传输, - port-range: 30000,30500 # 端口范围 - # [可选] 国标级联在此范围内选择端口发送媒体流, - send-port-range: 30000,30500 # 端口范围 - # 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载, 0 表示不使用 - record-assist-port: 18081 - -# [可选] 日志配置, 一般不需要改 -logging: - file: - name: logs/wvp.log - max-history: 30 - max-size: 10MB - total-size-cap: 300MB - level: - com.genersoft.iot: debug - com.genersoft.iot.vmp.storager.dao: info - com.genersoft.iot.vmp.gb28181: info - -# [根据业务需求配置] -user-settings: - # 推流直播是否录制 - record-push-live: true - auto-apply-play: false - -# 在线文档: swagger-ui(生产环境建议关闭) -swagger-ui: - enabled: true - -# 版本信息, 不需修改 -version: - version: "@project.version@" - description: "@project.description@" - artifact-id: "@project.artifactId@" From fa54f00a9d04c5823be1a38d20ca1f70dbcd3508 Mon Sep 17 00:00:00 2001 From: xiaoxie Date: Fri, 5 Nov 2021 20:25:29 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=B0=9D=E8=AF=95docker-compose=E5=90=AF?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/docker-compose.yml | 15 +++++++++++++++ docker/wvp/Dockerfile | 12 ++++++++---- src/main/resources/application-dev.yml | 22 ++++++++++++---------- src/main/resources/application.yml | 2 +- 4 files changed, 36 insertions(+), 15 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 6fa43ceb..eefb8da7 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -12,6 +12,9 @@ services: wvp: build: context: ./wvp + args: + gitUrl: "https://gitee.com/xieyu1989" + zlmGitUrl: "https://gitee.com/xia-chu/ZLMediaKit" restart: always ports: - "5060:5060" @@ -24,8 +27,20 @@ services: - "30000-30500:30000-30500/udp" volumes: - ./video:/opt/media/www/record/ + - ./logs/wvp:/opt/wvp/logs/ + - ./logs/assist:/opt/assist/logs/ + - ./logs/media:/opt/media/logs/ environment: TZ: "Asia/Shanghai" + REDIS_HOST: redis + REDIS_PORT: 6379 + REDIS_PWD: root + WVP_DOMAIN: 6101130049 + WVP_ID: 61011300490000000001 + # [必须修改] 本机的IP WVP_HOST: 172.18.0.61 + WVP_PWD: aseqw_+hiy123 + ASSIST_CONFIG: + WVP_CONFIG: depends_on: - redis diff --git a/docker/wvp/Dockerfile b/docker/wvp/Dockerfile index 334c559b..e60a93b4 100644 --- a/docker/wvp/Dockerfile +++ b/docker/wvp/Dockerfile @@ -1,16 +1,19 @@ FROM ubuntu:20.04 AS build +ARG gitUrl="https://gitee.com/18010473990" +ARG zlmGitUrl="https://gitee.com/xia-chu/ZLMediaKit" + RUN export DEBIAN_FRONTEND=noninteractive &&\ apt-get update && \ apt-get install -y --no-install-recommends openjdk-11-jre git maven nodejs npm build-essential \ cmake ca-certificates openssl ffmpeg && \ cd /home && \ - git clone https://gitee.com/18010473990/maven.git && \ + git clone ${gitUrl}/maven.git && \ cp maven/settings.xml /usr/share/maven/conf/ && \ - git clone https://gitee.com/18010473990/wvp-GB28181.git && \ - git clone https://gitee.com/18010473990/wvp-pro-assist.git && \ - git clone --depth=1 https://gitee.com/xia-chu/ZLMediaKit && \ + git clone ${gitUrl}/wvp-GB28181.git && \ + git clone ${gitUrl}/wvp-pro-assist.git && \ + git clone --depth=1 ${zlmGitUrl} && \ mkdir -p /opt/wvp/config /opt/assist/config /opt/media/www/record && \ cd /home/wvp-GB28181/web_src && \ @@ -63,6 +66,7 @@ EXPOSE 30000-30500/tcp EXPOSE 30000-30500/udp RUN export DEBIAN_FRONTEND=noninteractive &&\ + export LANG=zh_CN.UTF-8 apt-get update && \ apt-get install -y --no-install-recommends openjdk-11-jre ca-certificates ffmpeg language-pack-zh-hans && \ apt-get autoremove -y && \ diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 44f70e6e..4f7d5f3c 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -2,13 +2,13 @@ spring: # REDIS数据库配置 redis: # [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 - host: 127.0.0.1 + host: ${REDIS_HOST:127.0.0.1} # [必须修改] 端口号 - port: 6379 + port: ${REDIS_PORT:6379} # [可选] 数据库 DB database: 6 # [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接 - password: + password: ${REDIS_PWD} # [可选] 超时时间 timeout: 10000 # [可选] jdbc数据库配置, 项目使用sqlite作为数据库,一般不需要配置 @@ -36,18 +36,18 @@ server: # 作为28181服务器的配置 sip: # [必须修改] 本机的IP - ip: 192.168.0.100 + ip: ${WVP_HOST} # [可选] 28181服务监听的端口 port: 5060 # 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007) # 后两位为行业编码,定义参照附录D.3 # 3701020049标识山东济南历下区 信息行业接入 # [可选] - domain: 4401020049 + domain: ${WVP_DOMAIN:4401020049} # [可选] - id: 44010200492000000001 + id: ${WVP_ID:44010200492000000001} # [可选] 默认设备认证密码,后续扩展使用设备单独密码, 移除密码将不进行校验 - password: admin123 + password: ${WVP_PWD:admin123} #zlm 默认服务器配置 media: @@ -66,8 +66,9 @@ media: # [可选] 国标级联在此范围内选择端口发送媒体流, send-port-range: 30000,30500 # 端口范围 # 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载, 0 表示不使用 - record-assist-port: 0 - + record-assist-port: 18081 + sdp-ip: ${WVP_HOST} + stream-ip: ${WVP_HOST} # [可选] 日志配置, 一般不需要改 logging: file: @@ -84,6 +85,7 @@ logging: user-settings: # 推流直播是否录制 record-push-live: true + auto-apply-play: false # 在线文档: swagger-ui(生产环境建议关闭) swagger-ui: @@ -93,4 +95,4 @@ swagger-ui: version: version: "@project.version@" description: "@project.description@" - artifact-id: "@project.artifactId@" \ No newline at end of file + artifact-id: "@project.artifactId@" diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ef46c2ad..3d7808a0 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,3 +1,3 @@ spring: profiles: - active: local \ No newline at end of file + active: dev From 30f71e531aa0ceb6d130e2710dde1454b69aed38 Mon Sep 17 00:00:00 2001 From: xiaoxie Date: Fri, 5 Nov 2021 20:39:32 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=B0=9D=E8=AF=95docker-compose=E5=90=AF?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/docker-compose.yml | 11 ++++++----- src/main/resources/application-dev.yml | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index eefb8da7..5c9374a0 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -32,14 +32,15 @@ services: - ./logs/media:/opt/media/logs/ environment: TZ: "Asia/Shanghai" - REDIS_HOST: redis - REDIS_PORT: 6379 - REDIS_PWD: root - WVP_DOMAIN: 6101130049 - WVP_ID: 61011300490000000001 # [必须修改] 本机的IP WVP_HOST: 172.18.0.61 WVP_PWD: aseqw_+hiy123 + WVP_DOMAIN: 6101130049 + WVP_ID: 61011300490000000001 + REDIS_HOST: redis + REDIS_PORT: 6379 + REDIS_DB: 6 + REDIS_PWD: root ASSIST_CONFIG: WVP_CONFIG: depends_on: diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 4f7d5f3c..98866b83 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -6,7 +6,7 @@ spring: # [必须修改] 端口号 port: ${REDIS_PORT:6379} # [可选] 数据库 DB - database: 6 + database: ${REDIS_DB:6} # [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接 password: ${REDIS_PWD} # [可选] 超时时间 From 08a439e37e357f08b24c3b012d1f76ee95d2035a Mon Sep 17 00:00:00 2001 From: xiaoxie Date: Fri, 5 Nov 2021 20:42:57 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E5=B0=9D=E8=AF=95docker-compose=E5=90=AF?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/wvp/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/wvp/Dockerfile b/docker/wvp/Dockerfile index e60a93b4..1386989d 100644 --- a/docker/wvp/Dockerfile +++ b/docker/wvp/Dockerfile @@ -66,7 +66,7 @@ EXPOSE 30000-30500/tcp EXPOSE 30000-30500/udp RUN export DEBIAN_FRONTEND=noninteractive &&\ - export LANG=zh_CN.UTF-8 + export LANG=zh_CN.UTF-8 && \ apt-get update && \ apt-get install -y --no-install-recommends openjdk-11-jre ca-certificates ffmpeg language-pack-zh-hans && \ apt-get autoremove -y && \ From d8c3638ac856ae24838457e461a1672e6e4ae70b Mon Sep 17 00:00:00 2001 From: xiaoxie Date: Fri, 5 Nov 2021 20:45:44 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E5=B0=9D=E8=AF=95docker-compose=E5=90=AF?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/wvp/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/wvp/Dockerfile b/docker/wvp/Dockerfile index 1386989d..c6c7b0e1 100644 --- a/docker/wvp/Dockerfile +++ b/docker/wvp/Dockerfile @@ -43,7 +43,6 @@ RUN export DEBIAN_FRONTEND=noninteractive &&\ echo '#!/bin/bash' > run.sh && \ echo 'echo ${WVP_IP}' >> run.sh && \ echo 'echo ${WVP_CONFIG}' >> run.sh && \ - echo 'redis-server --daemonize yes --bind 0.0.0.0' >> run.sh && \ echo 'cd /opt/assist' >> run.sh && \ echo 'nohup java -jar *.jar --spring.config.location=/opt/assist/config/application.yml --userSettings.record=/opt/media/www/record/ --media.record-assist-port=18081 ${ASSIST_CONFIG} &' >> run.sh && \ echo 'nohup /opt/media/MediaServer -d -m 3 &' >> run.sh && \ From 792008ab4ee250b971f70cdfe1f4359eedeaa0d3 Mon Sep 17 00:00:00 2001 From: xiaoxie Date: Fri, 5 Nov 2021 22:37:32 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E5=B0=9D=E8=AF=95docker-compose=E5=90=AF?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/wvp/Dockerfile | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/docker/wvp/Dockerfile b/docker/wvp/Dockerfile index c6c7b0e1..6728e4ab 100644 --- a/docker/wvp/Dockerfile +++ b/docker/wvp/Dockerfile @@ -6,40 +6,40 @@ ARG zlmGitUrl="https://gitee.com/xia-chu/ZLMediaKit" RUN export DEBIAN_FRONTEND=noninteractive &&\ apt-get update && \ apt-get install -y --no-install-recommends openjdk-11-jre git maven nodejs npm build-essential \ - cmake ca-certificates openssl ffmpeg && \ + cmake ca-certificates openssl ffmpeg - cd /home && \ - git clone ${gitUrl}/maven.git && \ +RUN cd /home && \ + git clone "https://gitee.com/18010473990/maven.git" && \ cp maven/settings.xml /usr/share/maven/conf/ && \ - git clone ${gitUrl}/wvp-GB28181.git && \ - git clone ${gitUrl}/wvp-pro-assist.git && \ - git clone --depth=1 ${zlmGitUrl} && \ - mkdir -p /opt/wvp/config /opt/assist/config /opt/media/www/record && \ + git clone "${gitUrl}/wvp-GB28181.git" && \ + git clone "${gitUrl}/wvp-pro-assist.git" && \ + git clone --depth=1 "${zlmGitUrl}" && \ + mkdir -p /opt/wvp/config /opt/assist/config /opt/media/www/record - cd /home/wvp-GB28181/web_src && \ +RUN cd /home/wvp-GB28181/web_src && \ npm install && \ - npm run build && \ + npm run build - cd /home/wvp-GB28181 && \ +RUN cd /home/wvp-GB28181 && \ mvn clean package -Dmaven.test.skip=true && \ cp /home/wvp-GB28181/target/*.jar /opt/wvp/ && \ - cp /home/wvp-GB28181/src/main/resources/application-dev.yml /opt/wvp/config/application.yml && \ + cp /home/wvp-GB28181/src/main/resources/application-dev.yml /opt/wvp/config/application.yml - cd /home/wvp-pro-assist && \ +RUN cd /home/wvp-pro-assist && \ mvn clean package -Dmaven.test.skip=true && \ cp /home/wvp-pro-assist/target/*.jar /opt/assist/ && \ - cp /home/wvp-pro-assist/src/main/resources/application-dev.yml /opt/assist/config/application.yml && \ + cp /home/wvp-pro-assist/src/main/resources/application-dev.yml /opt/assist/config/application.yml - cd /home/ZLMediaKit && \ +RUN cd /home/ZLMediaKit && \ git submodule update --init --recursive && \ mkdir -p build release/linux/Release/ &&\ cd build && \ cmake -DCMAKE_BUILD_TYPE=Release .. && \ make -j4 && \ rm -rf ../release/linux/Release/config.ini && \ - cp -r ../release/linux/Release/* /opt/media && \ + cp -r ../release/linux/Release/* /opt/media - cd /opt/wvp && \ +RUN cd /opt/wvp && \ echo '#!/bin/bash' > run.sh && \ echo 'echo ${WVP_IP}' >> run.sh && \ echo 'echo ${WVP_CONFIG}' >> run.sh && \ @@ -64,8 +64,9 @@ EXPOSE 554/udp EXPOSE 30000-30500/tcp EXPOSE 30000-30500/udp +ENV LC_ALL zh_CN.UTF-8 + RUN export DEBIAN_FRONTEND=noninteractive &&\ - export LANG=zh_CN.UTF-8 && \ apt-get update && \ apt-get install -y --no-install-recommends openjdk-11-jre ca-certificates ffmpeg language-pack-zh-hans && \ apt-get autoremove -y && \ From 78b39ebd5a99da3dca367b4ed3ee2c97e91a333c Mon Sep 17 00:00:00 2001 From: xiaoxie Date: Fri, 5 Nov 2021 22:44:10 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=B0=9D=E8=AF=95docker-compose=E5=90=AF?= =?UTF-8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 5c9374a0..9dc61413 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -29,7 +29,7 @@ services: - ./video:/opt/media/www/record/ - ./logs/wvp:/opt/wvp/logs/ - ./logs/assist:/opt/assist/logs/ - - ./logs/media:/opt/media/logs/ + - ./logs/media:/opt/media/log/ environment: TZ: "Asia/Shanghai" # [必须修改] 本机的IP