-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #542 from CodingCattwo/dev
merge community doc into dev
- Loading branch information
Showing
8 changed files
with
427 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# 区块链教程 | 使用达梦数据库(DM)对WeBASE进行适配 | ||
|
||
作者:梁锦辉 | ||
|
||
作为一个开放、功能丰富的区块链平台, WeBASE致力于提高区块链开发者的运维与管理效率。同时为使用者提供可以适配达梦数据库(DM)(信创环境)的兼容特性; | ||
以下演示,我们通过WeBASE-Sign,为例子做的适配改造。 | ||
|
||
### |前期准备 | ||
|
||
#### 达数据库的安装 | ||
安装指南可以从达梦数据库(DM)官网获取:https://eco.dameng.com/document/dm/zh-cn/start/install-dm-linux-prepare.html | ||
|
||
#### 获取达蒙数据库依赖配置 | ||
可以在maven或者gradle配置中引入 | ||
|
||
``` maven依赖配置示例 | ||
<dependency>H | ||
<groupId>com.dameng</groupId> | ||
<artifactId>DmJdbcDriver18</artifactId> | ||
<version>8.1.1.193</version> | ||
</dependency> | ||
``` | ||
|
||
如果不同DM版本可以从数据库的安装目录下相关说明文档下获取到, | ||
配置方法也可以在数据库安装目录下的\dmdbms\drivers\jdbc\readme.txt中看到依赖配置信息。 | ||
|
||
### DM结合WeBASE-SIGN的适配实现 | ||
当前WeBase-SIGN是使用的MYSQL作为数据库,达梦数据对MYSQL的兼容性也是比较优化,但存在有些关键语法的问题导致SQL执行不通过; | ||
设计思路,此次改造通过增加使用开关来决定是否达启用达梦数据库(DM),同时也不影响原来WeBase-SIGN支持MYSQL的能力,改造结果就是同时能支持MYSQL或者达梦数据库(DM); | ||
|
||
修改配置文件:src/main/resources/application.yml | ||
``` | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
driver-class-name: dm.jdbc.driver.DmDriver | ||
hikari: | ||
connection-test-query: SELECT 1 FROM DUAL | ||
connection-timeout: 30000 | ||
mybatis: | ||
mapper-locations: classpath:mapper/*.xml | ||
configuration: | ||
variables: | ||
isDm8: true | ||
``` | ||
|
||
修改映射文件:src/main/resources/mapper/UserDao.xml | ||
``` | ||
<choose> | ||
<when test="${isDm8}"> | ||
CREATE TABLE IF NOT EXISTS tb_user | ||
( | ||
user_id INT NOT NULL AUTO_INCREMENT COMMENT '用户编号', | ||
sign_user_id VARCHAR(64) NOT NULL COMMENT '用户唯一的业务编号', | ||
app_id varchar(64) NOT NULL COMMENT '用户对应的应用编号', | ||
address varchar(64) NOT NULL COMMENT '用户地址', | ||
public_key varchar(256) NOT NULL COMMENT '公钥', | ||
private_key varchar(256) NOT NULL COMMENT '私钥', | ||
description varchar(128) DEFAULT NULL COMMENT '描述', | ||
encrypt_type int NOT NULL COMMENT '加密类型,1:国密;0:ECDSA', | ||
gmt_create datetime DEFAULT NULL COMMENT '创建时间', | ||
gmt_modify datetime DEFAULT NULL COMMENT '修改时间', | ||
status char(1) NOT NULL DEFAULT '1' COMMENT '状态: 1 有效 0 无效', | ||
NOT CLUSTER PRIMARY KEY (user_id), | ||
CONSTRAINT unique_uuid UNIQUE(sign_user_id) | ||
) STORAGE(ON "webase", CLUSTERBTR); | ||
</when> | ||
<otherwise> | ||
CREATE TABLE IF NOT EXISTS tb_user ( | ||
user_id int(11) NOT NULL AUTO_INCREMENT COMMENT '用户编号', | ||
sign_user_id varchar(64) NOT NULL COMMENT '用户唯一的业务编号', | ||
app_id varchar(64) NOT NULL COMMENT '用户对应的应用编号', | ||
address varchar(64) NOT NULL COMMENT '用户地址', | ||
public_key varchar(256) NOT NULL COMMENT '公钥', | ||
private_key varchar(256) NOT NULL COMMENT '私钥', | ||
description varchar(128) DEFAULT NULL COMMENT '描述', | ||
encrypt_type int NOT NULL COMMENT '加密类型,1:国密;0:ECDSA', | ||
gmt_create datetime DEFAULT NULL COMMENT '创建时间', | ||
gmt_modify datetime DEFAULT NULL COMMENT '修改时间', | ||
status char(1) NOT NULL DEFAULT '1' COMMENT '状态: 1 有效 0 无效', | ||
PRIMARY KEY (user_id), | ||
UNIQUE KEY unique_uuid (sign_user_id) | ||
) ENGINE=InnoDB AUTO_INCREMENT=100001 DEFAULT CHARSET=utf8 COMMENT='用户信息表'; | ||
</otherwise> | ||
</choose> | ||
``` | ||
|
||
使用开关"${isDm8}"适配MYSQL和DMDB; | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# 修改WeBASE-Front前端项目中的logo | ||
|
||
## task11:修改WeBASE-Front前端项目中的logo | ||
|
||
### 第一步:克隆WeBASE-Front项目 | ||
|
||
``git clone https://github.com/WeBankBlockchain/WeBASE-Front.git`` | ||
|
||
或者 | ||
|
||
``git clone https://gitee.com/WeBank/WeBASE-Front.git`` | ||
|
||
### 第二步:修改WeBASE-Front前端项目logo | ||
|
||
> 注意:修改的logo图片类型以及名称需要跟原来的一致 | ||
在 /WeBASE-Front/src/main/resources/static/static/image 目录下找到 logo.jpg 将其替换调即可 | ||
|
||
如果是浏览器显示的logo则修改 /WeBASE-Front/src/main/resources/static/static/image 目录下的 webase_35x35.png | ||
|
||
### 第三步:编译代码 | ||
|
||
在 WeBASE-Front 目录下运行命令: | ||
|
||
```bash | ||
chmod +x ./gradlew && ./gradlew build -x test | ||
``` | ||
|
||
### 第四步:修改配置 | ||
|
||
按照[官方的配置说明](https://webasedoc.readthedocs.io/zh_CN/latest/docs/WeBASE-Front/install.html#id6)即可 | ||
|
||
#### 第五步:启动 | ||
|
||
返回到dist目录执行: | ||
|
||
```bash | ||
启动: bash start.sh | ||
停止: bash stop.sh | ||
检查: bash status.sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
docs/WeBASE-Console-Suit/articles/webase_deploy_listen_check/webase-listen.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
#!/bin/bash | ||
#获取webase系统路径 | ||
wb_path=$(pwd) #默认脚本与WeBase子系统处于同级目录,如有不同,自行修改 | ||
port=0 | ||
web_Port=5000 #默认5000 | ||
|
||
function webase_front(){ | ||
echo "check webase-front..." #在同级目录下查找webase-front文件夹 | ||
wabse_front_path=$(find $wb_path -name 'webase-front' -type d) | ||
cd $wabse_front_path #进入WeBase-Front目录 | ||
status="$(bash status.sh)" #运行状态脚本 | ||
if [[ $status == *"running"* ]] | ||
then | ||
msg=`echo ${status#*Port}` | ||
port=`echo ${msg%%i*}` #进行字符串截取获得端口(默认5002) | ||
fi | ||
|
||
port_msg=`lsof -i:$port` #lsof -i:port 查看端口连接 | ||
if [[ $port_msg == *"LISTEN"* ]] #判断端口是否被监听,是则正常运行,否则运行有误 | ||
then #后续两个子系统方法大致相同 | ||
echo "WeBase-Front is Successful" | ||
else | ||
echo "WeBase-Front is Fail" | ||
return | ||
fi | ||
echo -e "Check webase-front finish\n" | ||
} | ||
|
||
function webase_node_mgr(){ | ||
#查找webase-node-mgr文件夹 | ||
echo "check webase-node-mgr..." | ||
webase_node_mgr_path=$(find $wb_path -name 'webase-node-mgr' -type d) | ||
cd $webase_node_mgr_path | ||
status=$(bash status.sh) | ||
if [[ $status == *"running"* ]] | ||
then | ||
msg=`echo ${status#*Port}` | ||
port=`echo ${msg%%i*}` #获得端口 | ||
fi | ||
port_msg=`lsof -i:$port` | ||
if [[ $port_msg == *"LISTEN"* ]] | ||
then | ||
echo "WeBase-Node-Mgr is Successful" | ||
else | ||
echo "WeBase-Node-Mgr is Fail" | ||
return | ||
fi | ||
echo -e "Check WeBase-Node-Mgr finish\n" | ||
} | ||
|
||
function webase_sign(){ | ||
#查找webase_sign文件夹 | ||
echo "check webase_sign..." | ||
webase_sign_path=$(find $wb_path -name 'webase-sign' -type d) | ||
cd $webase_sign_path | ||
status=$(bash status.sh) | ||
if [[ $status == *"running"* ]] | ||
then | ||
msg=`echo ${status#*Port}` | ||
port=`echo ${msg%%i*}` #获得端口 | ||
else | ||
echo "no running" | ||
fi | ||
|
||
port_msg=`lsof -i:$port` | ||
if [[ $port_msg == *"LISTEN"* ]] | ||
then | ||
echo "WeBase-Sign is Successful" | ||
else | ||
echo "WeBase-Sign is Fail" | ||
fi | ||
echo -e "Check WeBase-Sign finish\n" | ||
} | ||
function webase_web(){ | ||
echo "check webase_web..." | ||
nginx_conf=$wb_path/comm/nginx.conf #获取nginx.conf的工作路径 | ||
nginx_msg="`ps -ef |grep nginx`" #ps(英文全拼:process status)命令用于显示当前进程的状态 ps -ef -e显示所有进程,-f全格式。 | ||
|
||
if [[ $nginx_msg == *$nginx_conf* ]] #进行匹配查看,nginx服务有无使用webase-web自带的nginx配置 | ||
then | ||
echo "WeBase-Web is Successful" | ||
else | ||
echo "WeBase-Web is Fail" | ||
fi | ||
echo -e "Check WeBase-Web finish\n" | ||
} | ||
# WeBase-Front子系统测试 | ||
sleep 3 | ||
webase_front | ||
# WeBase-Node-Msg子系统测试 | ||
sleep 3 | ||
webase_node_mgr | ||
# WeBase-Sign子系统测试 | ||
sleep 3 | ||
webase_sign | ||
# WeBase-Web子系统测试 | ||
sleep 3 | ||
webase_web |
Oops, something went wrong.