Skip to content

Commit

Permalink
Merge pull request #542 from CodingCattwo/dev
Browse files Browse the repository at this point in the history
merge community doc into dev
  • Loading branch information
CodingCattwo committed Jul 21, 2023
2 parents 95e08b7 + 3711505 commit ce92d2a
Show file tree
Hide file tree
Showing 8 changed files with 427 additions and 10 deletions.
11 changes: 9 additions & 2 deletions docs/WeBASE-APP-SDK/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ http://127.0.0.1:5001/WeBASE-Node-Manager/api/passwordUpdate?timestamp=161492885
#### 传输协议规范

* 网络传输协议:使用HTTP协议
* 请求地址: **/api/basicInfo?appKey={appKey}&signature={signature}&timestamp={timestamp}**
* 请求地址: **/api/basicInfo?appKey={appKey}&signature={signature}&timestamp={timestamp}&groupId={groupId}**
* 请求方式:GET
* 请求头:Content-type: application/json
* 返回格式:JSON
Expand All @@ -426,10 +426,17 @@ http://127.0.0.1:5001/WeBASE-Node-Manager/api/passwordUpdate?timestamp=161492885

***1)入参表***

| 序号 | 输入参数 | 类型 | 可为空 | 备注 |
| ---- | ------------- | ------ | ------ | ---------------- |
| 1 | appKey | String || app接入的key |
| 2 | signature | String || 签名密文值 |
| 3 | timestamp | String || 时间戳 |
| 4 | groupId | String || FISCO BCOS为2.x版本则可为空,**3.x版本不可以为空** |

***2)入参示例***

```
http://localhost:5001/WeBASE-Node-Manager/api/basicInfo?timestamp=1614928857832&appKey=fdsf78aW&signature=EEFD7CD030E6B311AA85B053A90E8A31
http://localhost:5001/WeBASE-Node-Manager/api/basicInfo?timestamp=1614928857832&appKey=fdsf78aW&signature=EEFD7CD030E6B311AA85B053A90E8A31&groupId=1
```


Expand Down
19 changes: 11 additions & 8 deletions docs/WeBASE-APP-SDK/appintegration.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ WeBASE-APP-SDK是应用集成SDK,提供调用WeBASE-Node-Manager的接口,

- `v1.5.1`及其以上版本,应用配置AppConfig的属性`isTransferEncrypt`需和WeBASE-Node-Manager的配置文件`/conf/application.yml`下的配置`constant.isTransferEncrypt`相同,默认为`true`
- 如果`v1.5.0`需要使用SDK,应用配置AppConfig的属性`isTransferEncrypt`需设置为`false``v1.5.1`及其以上版本新增的接口调用不了。
- `1.5.6`版本以上版本,既支持WeBASE 1.5.x及以上版本,同时支持WeBASE 3.1.0及以上版本(暂不支持WeBASE 3.0.2版本)

### 添加依赖

Expand All @@ -24,18 +25,20 @@ repositories {
maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
}
dependencies {
implementation 'com.webank:webase-app-sdk:1.5.1'
implementation 'com.webank:webase-app-sdk:1.5.6-SNAPSHOT'
implementation 'org.bouncycastle:bcprov-jdk15on:1.67'
implementation 'org.apache.commons:commons-lang3:3.8.1'
implementation 'com.squareup.okhttp3:okhttp:4.8.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.0'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.0'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.0'
implementation 'com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.14.2'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.2'
implementation 'com.fasterxml.jackson.module:jackson-module-parameter-names:2.14.2'
implementation 'org.projectlombok:lombok:1.18.12'
implementation 'org.apache.logging.log4j:log4j-api:2.13.3'
implementation 'org.apache.logging.log4j:log4j-core:2.13.3'
implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.13.3'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
implementation 'org.apache.logging.log4j:log4j-api:2.20.0'
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.20.0'
implementation 'org.slf4j:slf4j-api:1.7.36'
}
```

Expand Down
99 changes: 99 additions & 0 deletions docs/WeBASE-Console-Suit/articles/dameng_db_fit_in.md
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;








41 changes: 41 additions & 0 deletions docs/WeBASE-Console-Suit/articles/how_to_update_logo.md
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
```
3 changes: 3 additions & 0 deletions docs/WeBASE-Console-Suit/articles/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:maxdepth: 1
./two_phase_tx.md
./dameng_db_fit_in.md
./docker_install_webase_front/docker_install_webase_front.md
./docker_install_webase_front_2/docker_install_webase_front_2.md
./k8s_install_webase_all/deployment_steps.md
Expand All @@ -15,6 +16,7 @@
./shell_one_click_install_fisco_webase.md
./webase_deploy_of_macos_github.md
./install_webase_front_by_docker.md
./webase_deploy_listen_check/webase_deploy_listen_check.md
./build_docker_image_webase_front/build_docker_image_webase_front.md
./build_docker_images_webase_front_2.md
./webase_contract_ide_usage.md
Expand All @@ -36,5 +38,6 @@
./code_review_node_mgr_node_service.md
./code_review_node_mgr_node_status_check.md
./reset_fisco_webase_data_doc.md
./how_to_update_logo.md
```
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

0 comments on commit ce92d2a

Please sign in to comment.