WVP PRO Configuration Actual Combat

insert image description here

WEB VIDEO PLATFORM is an out-of-the-box network video platform based on the GB28181-2016 standard. It is responsible for implementing the core signaling and device management background part, supports NAT penetration, and supports IPCs of brands such as Hikvision, Dahua, and Uniview. , NVR access. Support national standard cascading, and support forwarding cameras/live streams/live push streams without national standard functions to other national standard platforms.

Streaming service based on @Xiachu ZLMediaKit https://github.com/ZLMediaKit/ZLMediaKit
player using @dexter jessibuca https://github.com/langhuihui/jessibuca/tree/v3
Front page based on @Kyle MediaServerUI https:// gitee.com/kkkkk5G/MediaServerUI for modification.

Application Scenario

Support browser to play camera video without plug-in. Supports access to national standard equipment (cameras, platforms, NVR, etc.) and supports non-national standard (onvif, rtsp, rtmp, live broadcast equipment, etc.) equipment access, making full use of old ones. Support national standard cascading. Multi-platform cascading. Cross-network video preview. Support cross-network gatekeeper platform interconnection.

official document

The official documentation is very clear. This article is also based on official documentation.

docker (pseudo virtual machine)

This deployment and installation is ready to be configured in the docker container. Why configure it in docker? Here I mainly use docker as a virtual machine. This configuration is convenient for porting and deployment. When running in Linux, the performance of docker is much better than that of virtual machines.

If you don’t use docker, you can skip this section directly. Looking back, it is basically an ordinary ubuntu Linux operation.

docker installation

The installation of docker is not the focus of this article. Please refer to the official documentation of docker:
https://docs.docker.com/engine/install/

For example: I refer to the installation of ubuntu:
https://docs.docker.com/engine/install/ubuntu/

create container

For the basic use of docker, you can refer to:
"Docker Usage Notes"
https://blog.csdn.net/lxyoucan/article/details/121572097

download mirror

Here I choose the ubuntu system, and in theory other distributions are the same.

docker pull ubuntu

Create a CONTAINER

Execute the following command:

docker run --name wvp -it ubuntu bash

This way we create a container named wvp and execute bash directly.
Here are some possible operations

Exit and enter CONTAINER

  • Shortcut key ctrl -p ctrl-qto exit and let CONTAINER run in the background
  • The command exit will directly shut down the CONTAINER

进入CONTAINER
docker attach $NAMES
docker attach $CONTAINER ID

For example, we should enter here:

docker attach wvp

The version of the system can be queried.

cat /etc/*-release

I am hereUbuntu 22.04.2 LTS

Simple Configuration Utility

Creating a container is equivalent to just installing a system. Let's do a simple configuration and utility installation first. This section is not required. It depends on personal preference.

unminimize

Because the ubuntu in docker is a simplified version, it is to restore the normal mode.
This step may not be necessary, but after this step, the container will be closer to a real ubuntu. The disadvantage is that the container will be larger .

Set domestic source

There are many domestic sources, just find what you like.
For the setting method, see: https://blog.csdn.net/lxyoucan/article/details/121691910

Install common software

The following software is the necessary software for my use of linux, for reference only.

apt-get update
# 安装文本编辑器
apt install vim
# 安装zsh ,本人比较喜爱zsh替换bash
apt install zsh
# 网络工具
apt install curl wget
apt install unzip ranger

Preparation

I am here Ubuntu 22.04.2 LTS, the operation steps basically refer to the official manual.
https://doc.wvp-pro.cn/#/_content/introduction/compile

install dependencies

rely Version use development environment needs Production environment needs
jdk >=1.8 Run and compile java code yes yes
maven >=3.3 Manage java code dependencies no no
git Download/Update/Submit Code no no
nodejs Compile and run front-end files no no
npm Manage front-end file dependencies no no
apt-get install -y openjdk-11-jre git maven nodejs npm

install mysql

Let me tell you here, I tried to install mysql, but it was not installed successfully in the container. I didn't spend any extra time on it.
I replaced it with mariadb, which is compatible with mysql anyway.
Official tutorial address:

https://mariadb.org/download/?t=repo-config&d=22.04+%22jammy%22&v=10.11&r_m=aliyun

I cut off the key part.
Here are the commands to run when importing the MariaDB repository key on an Ubuntu system:

sudo apt-get install apt-transport-https curl
sudo mkdir -p /etc/apt/keyrings
sudo curl -o /etc/apt/keyrings/mariadb-keyring.pgp 'https://mariadb.org/mariadb_release_signing_key.pgp'

EDIT /etc/apt/sources.list.d/mariadb.sources, reads as follows:

# MariaDB 10.11 repository list - created 2023-06-19 10:07 UTC
# https://mariadb.org/download/
X-Repolib-Name: MariaDB
Types: deb
# deb.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details.
# URIs: https://deb.mariadb.org/10.11/ubuntu
URIs: https://mirrors.aliyun.com/mariadb/repo/10.11/ubuntu
Suites: jammy
Components: main main/debug
Signed-By: /etc/apt/keyrings/mariadb-keyring.pgp

You can now install MariaDB 10.11 from the MariaDB repository with:

sudo apt-get update
sudo apt-get install mariadb-server

Manually start mysql (MariaDB)

mysqld_safe  --user=mysql &

The startup is successful, and the post-test is as follows:
insert image description here

install redis

apt install redis

Because we are doing it in a docker container, systemctl start rediswe cannot start it successfully.

Manually start the redis service

/usr/bin/redis-server /etc/redis/redis.conf

Compile ZLMediaKit

Refer to ZLMediaKitWIKI, and intercept the key steps:

# 国内用户推荐从同步镜像网站gitee下载 
git clone --depth 1 https://gitee.com/xia-chu/ZLMediaKit
cd ZLMediaKit
# 千万不要忘记执行这句命令
git submodule update --init

The gcc version that comes with ubuntu is generally new enough, you can install the gcc compiler like this:

sudo apt-get install build-essential

ZLMediaKit uses cmake to build the project, and the Makefile (or Xcode/VS project) can be generated only through cmake, so cmake must be installed first to complete the next steps.

If you are a debian-based operating system (including ubuntu-based users), the cmake version that comes with it is usually new enough, you can install cmake like this

sudo apt-get install cmake

The method of installing dependencies under the Debian system (including ubuntu) system:

In addition to openssl, others can actually not be installed

sudo apt-get install libssl-dev
sudo apt-get install libsdl-dev
sudo apt-get install libavcodec-dev
sudo apt-get install libavutil-dev
sudo apt-get install ffmpeg

Compile:

cd ZLMediaKit
mkdir build
cd build
cmake ..
make -j4

Start under linux:

cd ZLMediaKit/release/linux/Debug
#通过-h可以了解启动参数
./MediaServer -h
#以守护进程模式启动
./MediaServer -d &

Compile WVP-PRO

After working on it for a long time, I finally arrived at the text.

clone from gitee

git clone https://gitee.com/pan648540858/wvp-GB28181-pro.git

clone from github

git clone https://github.com/648540858/wvp-GB28181-pro.git

Here I cloned from github.

Compile the front-end page

cd wvp-GB28181-pro/web_src/
npm --registry=https://registry.npmmirror.com install
npm run build

If an error is reported during compilation, it is usually a network problem, resulting in a failure to download the dependent package.
If it doesn't work, use a computer that you can compile successfully, and compile it.
insert image description here

I have no success in docker here npm installand don't want to waste time. I compiled and copied it on mac.

PS: You can use taobao's source like thisnpx nrm use taobao

generate executable jar

cd wvp-GB28181-pro
mvn package

database initialization

Configure WVP-PRO
wvp supports multiple databases, including Mysql, Postgresql, Jincang, etc. You can choose one of them for configuration.

Initialize the database

First use create database, then use sql/initialize.sql to initialize the database, if it is upgraded from an old version, use upgrade sql to update.

Mysql database configuration
The database name takes wvp as an example, and
the configuration file of yml is as follows:

 spring:
  datasource:
    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&allowPublicKeyRetrieval=true
    username: root
    password: 12345678

mybatis:
  configuration:
    map-underscore-to-camel-case: true

We will use this later. This is for everyone to see, and it will be put into the configuration file later.

set root password

Here we take setting 12345678as an example.
Enter mysql in the command line to enter the command line of mysql.
Then execute the following command:

use mysql;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '12345678';

insert image description here
Because we set a password, we will bring the password next time we enter the mysql command line

mysql -uroot -p12345678

create database

First enter the command line of mysql:

mysql -uroot -p12345678

Then enter the following command to create the user.

CREATE DATABASE `wvp` CHARACTER SET UTF8;
use wvp;
set character_set_client=utf8;
set character_set_connection=utf8;
set character_set_database=utf8;
set character_set_results=utf8;
source /root/wvp-GB28181-pro/sql/初始化.sql;

insert image description here
The script will create the following table structure.

MySQL [wvp]> show tables;
+----------------------------+
| Tables_in_wvp              |
+----------------------------+
| wvp_device                 |
| wvp_device_alarm           |
| wvp_device_channel         |
| wvp_device_mobile_position |
| wvp_gb_stream              |
| wvp_log                    |
| wvp_media_server           |
| wvp_platform               |
| wvp_platform_catalog       |
| wvp_platform_gb_channel    |
| wvp_platform_gb_stream     |
| wvp_stream_proxy           |
| wvp_stream_push            |
| wvp_user                   |
| wvp_user_role              |
+----------------------------+
15 rows in set (0.002 sec)

Modify the yml configuration file

We directly copy the command wvp-GB28181-pro/src/main/resources/application-dev.ymlas
wvp-GB28181-pro/src/main/resources/application-local.yml
follows:

cd ~/wvp-GB28181-pro/src/main/resources
cp application-dev.yml application-local.yml

Then we can edit application-local.yml.
I edited the following content here:

mysql data source

url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&serverTimezone=PRC&useSSL=false&allowMultiQueries=true
    username: root
    password: 12345678

Because we did not set a password for redis
, we directly comment this line with #.

#password: face2020

After modifying the configuration file, we can run the project with the following command to see if there is any error.

cd /root/wvp-GB28181-pro
mvn spring-boot:run

Other places are basically according to the author's default configuration.

ZLMediaKit configuration

cd ZLMediaKit/release/linux/Debug
vim config.ini

The modification here is mainly the content corresponding to the above yml:

http port


Put port=8091 in the [http] configuration

mediaServerId

[general]

mediaServerId=FQ3TF8yT83wh5Wvz

start service

cd ZLMediaKit/release/linux/Debug
#以守护进程模式启动
./MediaServer -d &

run

The above configuration is completed, and the operation is also mentioned. Bring it up separately and say it again. Because the configuration is usually only once. The configuration is over. And running has to be done often.

Manually start mysql (MariaDB)

mysqld_safe  --user=mysql &

Manually start the redis service

/usr/bin/redis-server /etc/redis/redis.conf

Start ZLMediaKit

cd ZLMediaKit/release/linux/Debug
./MediaServer -d &

Start WVP

There are many ways to start, mine is direct start. Not packaged into a jar package.

cd /root/wvp-GB28181-pro
mvn spring-boot:run

Advantages: It is convenient to modify the configuration.
Cons: slightly slower to start. Theoretically, it does not affect performance.
If you like other methods, you can refer to the official documentation:
https://doc.wvp-pro.cn/#/_content/introduction/config
The jar package can be started like this:

java -jar wvp-pro-*.jar 

All of the above have been completed, and there are no errors reported. You can visit IP:18080 through a browser.

Remaining problem

It is not clear why the redis connection will always have problems after the docker container is restarted.
The following commands can be executed using redis-cli. solve the problem d.

FLUSHDB ASYNC

share my configuration

https://download.csdn.net/download/lxyoucan/87933896

Summarize

The deployment of this project is not difficult. But it's a bit of a hassle. The key is that the official documentation is not comprehensive, and some places are mentioned in one stroke. It will be difficult for students who don't know java.

reference

Guess you like

Origin blog.csdn.net/lxyoucan/article/details/131290902