IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 区块链 -> webase1.5.3离线企业部署教程 -> 正文阅读

[区块链]webase1.5.3离线企业部署教程


前言

WeBASE(WeBank Blockchain Application Software Extension) 是在区块链应用和FISCO-BCOS节点之间搭建的一套通用组件。围绕交易、合约、密钥管理,数据,可视化管理来设计各个模块,开发者可以根据业务所需,选择子系统进行部署。WeBASE屏蔽了区块链底层的复杂度,降低开发者的门槛,大幅提高区块链应用的开发效率,包含节点前置、节点管理、交易链路,数据导出,Web管理平台等子系统。 WeBASE四个服务的部署架构如下图:节点前置需要和区块链节点部署在同一台机器,签名服务可以和节点前置分开部署,也可以同机部署;节点管理和WeBASE管理平台可以同机部署,也可以分开部署。在企业生产环境,为了容灾往往会在多个节点上部署节点前置,也会部署多个签名服务、节点管理和WeBASE管理台,本文主要讲解如何在没有网络的服务器中部署WeBASE。

在这里插入图片描述


一、思路

先在在有网络的电脑上进行安装包的下载,然后上传至无网络的系统之中完成部署。

需要提前准备的环境(离线安装以下环境教程点这里):

环境版本
JavaJDK8或以上版本
MySQLMySQL-5.6或以上版本
Nginxnginx1.6或以上版本(本文选择1.17.8,不是硬性要求)

所以我们要安装webase之前得先离线安装上表中的环境。

一、版本及兼容

WeBASE v1.5.3

WeBASE v1.5.3 版本支持 FISCO-BCOS 2.5.x及以上版本。WeBASE 子系统推荐使用下表的版本搭配,FISCO-BCOS 推荐使用 FISCO BCOS 2.8.0版本。

WeBASE子系统名称配套版本地址FISCO-BCOS 2.X.X
节点前置服务WeBASE-Front Release v1.5.3FISCO BCOS 2.8.0
节点管理服务WeBASE-Node-Manager Release v1.5.3FISCO BCOS 2.8.0
WeBASE管理平台WeBASE-Web Release v1.5.3FISCO BCOS 2.8.0
签名服务WeBASE-Sign Release v1.5.3FISCO BCOS 2.8.0
交易服务WeBASE-Transaction Release v1.4.0FISCO BCOS 2.8.0

更多兼容版本见:https://webasedoc.readthedocs.io/zh_CN/latest/docs/WeBASE/ChangeLOG.html

三、安装步骤

1.在有网络的电脑上下载相关的安装包,如何上传到没有网络的服务器上

PS:有的服务器可能需要用专业的防泄密盘进行传输

1.1.下载WeBase v1.5.3相关的安装包

官方CDN加速下载地址:

wget https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/WeBASE/releases/download/v1.5.3/webase-front.zip
wget https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/WeBASE/releases/download/v1.5.3/webase-sign.zip
wget https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/WeBASE/releases/download/v1.5.3/webase-node-mgr.zip
wget https://osp-1257653870.cos.ap-guangzhou.myqcloud.com/WeBASE/releases/download/v1.5.3/webase-web.zip

在这里插入图片描述
在这里插入图片描述
请添加图片描述
在这里插入图片描述

1.2.把下载的安装包上传到没有网络的服务器中

在这里插入图片描述

2.配置安装WeBASE-Sign

2.1.重点修改数据库相关配置,需要提前创建好数据库

[root@localhost webase-sign]#  mysql -uroot -p
Enter password: 

mysql> create database webasesign;
Query OK, 1 row affected (0.01 sec)

2.2.进入webase-sign的文件夹.修改conf/application.yml

server: 
  # 本工程服务端口,端口被占用则修改
  port: 5004
  context-path: /WeBASE-Sign

spring: 
  datasource: 
    # 数据库连接信息
    url: jdbc:mysql://127.0.0.1:3306/webasesign?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8
    # 数据库用户名
    username: dbUsername
    # 数据库密码
    password: dbPassword
    driver-class-name: com.mysql.cj.jdbc.Driver
    
constant: 
  # aes加密key(16位),如启用,各互联的子系统的加密key需保持一致
  aesKey: EfdsW23D23d3df43

2.3.给运行权限,启动服务

[root@localhost webase-front]# cd ../webase-sign
[root@localhost webase-sign]# chmod +x *.sh
[root@localhost webase-sign]# ./start.sh 
===============================================================================================
Starting Server com.webank.webase.sign.Application Port 5004 ...PID(4175) [Starting]. Please check message through the log file (default path:./log/).
===============================================================================================

备注:服务进程起来后,需通过日志确认是否正常启动,出现以下内容表示正常;如果服务出现异常,确认修改配置后,重启提示服务进程在运行,则先执行stop.sh,再执行start.sh。

[root@localhost webase-sign]# tail -f log/WeBASE-Sign.log
2021-10-19 11:43:46.497 [main] INFO  SimpleUrlHandlerMapping() - Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2021-10-19 11:43:46.986 [main] INFO  AnnotationMBeanExporter() - Registering beans for JMX exposure on startup
2021-10-19 11:43:47.003 [main] INFO  DefaultLifecycleProcessor() - Starting beans in phase 2147483647
2021-10-19 11:43:47.003 [main] INFO  DocumentationPluginsBootstrapper() - Context refreshed
2021-10-19 11:43:47.063 [main] INFO  DocumentationPluginsBootstrapper() - Found 1 custom documentation plugin(s)
2021-10-19 11:43:47.106 [main] INFO  ApiListingReferenceScanner() - Scanning for api listing references
2021-10-19 11:43:47.431 [main] INFO  ScheduledAnnotationBeanPostProcessor() - No TaskScheduler/ScheduledExecutorService bean found for scheduled processing
2021-10-19 11:43:47.546 [main] INFO  TomcatEmbeddedServletContainer() - Tomcat started on port(s): 5004 (http)
2021-10-19 11:43:47.550 [main] INFO  Application() - Started Application in 9.582 seconds (JVM running for 11.343)
2021-10-19 11:43:47.550 [main] INFO  Application() - main run success...

查看日志

全量日志:tail -f log/WeBASE-Sign.log
错误日志:tail -f log/WeBASE-Sign-error.log

3.配置安装WeBASE-Front

注意: 将节点所在目录nodes/${ip}/sdk下的所有文件拷贝到当前conf目录,供SDK与节点建立连接时使用(SDK会自动判断是否为国密,且是否使用国密SSL)

  • 链的sdk目录包含了ca.crt, sdk.crt, sdk.key和gm文件夹,gm文件夹包含了国密SSL所需的证书
  • 拷贝命令可使用cp -r nodes/${ip}/sdk/* ./conf/
  • 注,只有在建链时手动指定了-G(大写)时节点才会使用国密SSL

3.1.将节点所在目录nodes/${ip}/sdk下的所有文件拷贝到当前conf目录

在这里插入图片描述
在这里插入图片描述

3.2.如果在企业部署中使用WeBASE-Front,必须配置下文中的keyServer,用于连接WeBASE-Sign服务

修改前

# server version
version: v1.5.3

spring:
  datasource:
    url: jdbc:h2:file:../h2/webasefront;DB_CLOSE_ON_EXIT=FALSE
    databaseName: db
    driverClassName: org.h2.Driver
    serverName:
    username:
    password:
  jpa:
    database-platform: org.hibernate.dialect.H2Dialect
    database: H2
    openInView: false
    show_sql: false
    generate-ddl: true
    hibernate:
      ddl-auto: update
      naming-strategy: org.hibernate.cfg.EJB3NamingStrategy
      session:
        events:
          log: false
    properties:
      hibernate.cache.use_query_cache: false
      hibernate.generate_statistics: false
  h2:
    console:
      enabled: true
      path: /console
      settings:
        web-allow-others: false
        trace: true
  rabbitmq:
    host: 127.0.0.1
    port: 5672
    username:
    password:
    virtual-host:
    publisher-confirm: true
    ssl:
      enabled: false
  http:
    multipart:
      max-request-size: 30MB # request max size
      max-file-size: 20MB # single file size


server:
  port: 5002
  context-path: /WeBASE-Front
  connection-timeout: 30000
  tomcat:
    max-threads: 200
    max-connections: 10000

sdk:
  corePoolSize: 50
  maxPoolSize: 100
  queueCapacity: 100
  ip: 127.0.0.1
  channelPort: 20200
  certPath: conf  # cert path of relative or absolute

logging:
  config: classpath:log4j2.xml
  level:
    com.webank.webase.front: info

constant:
  keyServer: 127.0.0.1:5004 # webase-sign服务的IP:Port(单个)
  nodePath: /fisco/nodes/127.0.0.1/node0  # node's absolute path to read configuration and monitor node's log
  aesKey: EfdsW23D23d3df43
  transMaxWait: 30
  monitorDisk: /
  monitorEnabled: true
  http_read_timeOut: 100000
  http_connect_timeOut: 100000
  # event sync map task (unit: ms)
  eventRegisterTaskFixedDelay: 5000
  syncEventMapTaskFixedDelay: 60000
  # sync stat log data task (unit: ms)
  syncStatLogTime: 5000
  syncStatLogCountLimit: 10000
  statLogEnabled: false
  # get event callback wait (s)
  eventCallbackWait: 4

修改后:

# server version
version: v1.5.3

spring:
  datasource:
    url: jdbc:h2:file:../h2/webasefront;DB_CLOSE_ON_EXIT=FALSE
    databaseName: db
    driverClassName: org.h2.Driver
    serverName:
    username:
    password:
  jpa:
    database-platform: org.hibernate.dialect.H2Dialect
    database: H2
    openInView: false
    show_sql: false
    generate-ddl: true
    hibernate:
      ddl-auto: update
      naming-strategy: org.hibernate.cfg.EJB3NamingStrategy
      session:
        events:
          log: false
    properties:
      hibernate.cache.use_query_cache: false
      hibernate.generate_statistics: false
  h2:
    console:
      enabled: true
      path: /console
      settings:
        web-allow-others: false
        trace: true
  rabbitmq:
    host: 127.0.0.1
    port: 5672
    username:
    password:
    virtual-host:
    publisher-confirm: true
    ssl:
      enabled: false
  http:
    multipart:
      max-request-size: 30MB # request max size
      max-file-size: 20MB # single file size


server:
  port: 5002
  context-path: /WeBASE-Front
  connection-timeout: 30000
  tomcat:
    max-threads: 200
    max-connections: 10000

sdk:
  corePoolSize: 50
  maxPoolSize: 100
  queueCapacity: 100
  ip: 127.0.0.1
  channelPort: 20200
  certPath: conf  # cert path of relative or absolute

logging:
  config: classpath:log4j2.xml
  level:
    com.webank.webase.front: info

constant:
  keyServer: 127.0.0.1:5004 # webase-sign服务的IP:Port(单个)
  nodePath: /home/bcos/nodes/127.0.0.1/node0  # node's absolute path to read configuration and monitor node's log
  aesKey: EfdsW23D23d3df43
  transMaxWait: 30
  monitorDisk: /
  monitorEnabled: true
  http_read_timeOut: 100000
  http_connect_timeOut: 100000
  # event sync map task (unit: ms)
  eventRegisterTaskFixedDelay: 5000
  syncEventMapTaskFixedDelay: 60000
  # sync stat log data task (unit: ms)
  syncStatLogTime: 5000
  syncStatLogCountLimit: 10000
  statLogEnabled: false
  # get event callback wait (s)
  eventCallbackWait: 4

3.3.给运行权限,启动服务

// 给运行权限
[root@localhost webase-front]# chmod +x *.sh
// 启动服务
[root@localhost webase-front]# ./start.sh 
===============================================================================================
Server com.webank.webase.front.Application Port 5002 ...PID(3984) [Starting]. Please check message through the log file (default path:./log/).
===============================================================================================

3.4.测试

访问地址:http://192.168.119.132:5002/WeBASE-Front/#/home
在这里插入图片描述
能正常显示节点的数量说明服务正常

4.配置安装WeBASE-Node-Manager

4.1.进入数据库控制台创建webase-node-mgr的数据库

[root@localhost webase-front]#  mysql -uroot -p
Enter password: 

mysql> create database nodemgr;
Query OK, 1 row affected (0.01 sec)

4.2.修改/home/bcos/webase-node-mgr/script/webase.sh文件配置如下(重点改数据库链接配置):

#!/usr/bin/env bash


echo -e "\n init start...."

IP=${1}
PORT=${2}

if [[ ! $IP || ! $PORT ]] ; then
    echo "Usage: sh ${0} ip port"
    echo "eg: sh ${0} 127.0.0.1 8501"
    exit 1
fi

#dbUser
DBUSER="defaultAccount"
#dbPass
PASSWD="defaultPassword"
#dbName
DBNAME="webasenodemanager"


#connect to database then execute init
cat webase-sql.list | mysql --user=$DBUSER --password=$PASSWD --host=$IP --database=$DBNAME --port=$PORT --default-character-set=utf8;

if [ "$?" == "0" ]; then
    echo -e "init success... \n"
else
    echo -e "init fail... \n"
fi

exit

4.3.在/home/bcos/webase-node-mgr/script目录下给权限,并执行脚本导入数据库文件

[root@localhost webase-node-mgr]# cd script/
[root@localhost script]# ls
deploy  upgrade  webase-ddl.sql  webase-dml.sql  webase.sh  webase-sql.list
[root@localhost script]# chmod +x *.sh

[root@localhost script]# ./webase.sh 127.0.0.1 3306
 init start....
mysql: [Warning] Using a password on the command line interface can be insecure.
init success... 
[root@localhost script]# 

4.4.进入webase-node-mgr的文件夹.修改conf/application.yml(重点修改数据库连接配置和IP)

# server version
version: v1.5.3

#server config
server:
  port: 5001
  servlet:
    context-path: /WeBASE-Node-Manager


#mybatis config
mybatis:
  configuration:
    map-underscore-to-camel-case: true
  typeAliasesPackage: com.webank.webase.node.mgr
  mapperLocations: classpath:mapper/*.xml


# database connection configuration
spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/nodemanagerdb?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
    username: nodemanagerdb
    password: irsHBjmMJ74W3ryk
    initialSize: 10
    minIdle: 5
    maxActive: 30

  aop:
    proxy-target-class: true

#log config
logging:
  config: classpath:log/log4j2.xml
  level:
    com.webank.webase.node.mgr: info

#constants
constant:
  ###http request
  # login's authorization whether enable, if false, default login as `admin` account
  isUseSecurity: true
  # verification code expire time (s)
  verificationCodeMaxAge: 300
  # if disabled as false, code would be constant value
  enableVerificationCode: true
  # verification code constant value, only when enableVerificationCode is false works
  verificationCodeValue: "8888"
  # auth token code expire time (s)
  authTokenMaxAge: 3600
  ignoreCheckFront: /account/login,/account/pictureCheckCode,/login,/user/privateKey,/front/new,/front/find,,/group/generate,/group/start
  ###front http request
  frontUrl: http://%1s:%2d/WeBASE-Front/%3s
  httpTimeOut: 5000
  contractDeployTimeOut: 30000
  isPrivateKeyEncrypt: true
  maxRequestFail: 3
  sleepWhenHttpMaxFail: 60000

  ###common
  developerModeEnable: true
  deployedModifyEnable: true
  isDeleteInfo: true
  transRetainMax: 10000
  deleteInfoCron: "0 0/1 * * * ?"
  statisticsTransDailyCron: "0 0/1 * * * ?"
  resetGroupListCycle: 600000
  groupInvalidGrayscaleValue: 1M    # y:year, M:month, d:day of month, h:hour, m:minute, n:forever valid
  notSupportFrontIp:
  
  ###application integration
  # app request timestamp timeout (ms)
  appRequestTimeOut: 300000
  appStatusCheckCycle: 3000

  ###block info (pulling data from chain)
  isBlockPullFromZero: false
  pullBlockInitCnts: 1000
  pullBlockSleepTime: 200
  pullBlockTaskFixedDelay: 30000
  blockRetainMax: 10000
  ###transaction monitor
  transMonitorTaskFixedRate: 60000  #How long does it take to start the next task after the end (second)
  analysisSleepTime: 200
  monitorInfoRetainMax: 10000
  isMonitorIgnoreUser: false
  isMonitorIgnoreContract: false
  monitorUnusualMaxCount: 20
  ###alert mail monitor task interval: 5mins unit: ms
  auditMonitorTaskFixedDelay: 300000
  nodeStatusMonitorTaskFixedDelay: 60000  #must larger than @pullBlockTaskFixedDelay
  certMonitorTaskFixedDelay: 300000
  permitUrlArray: /account/login,/account/pictureCheckCode,/login,/user/privateKey/**,/config/encrypt,/config/version,/front/refresh,/api/*
  ###interval to async refresh group list locally
  resetGroupListInterval: 15000
  ###interval block statistic, unit: ms
  statBlockRetainMax: 100000
  statBlockFixedDelay: 10000
  statBlockPageSize: 20 # block stat data to pull in one time
  enableExternalFromBlock: true # enable record account and contract from block

  #### 1.4.0 visual deploy
  #### deployType 部署方式:
  # 0, 先使用 build_chain.sh 部署链并启用 WeBASE-Front 服务,然后手动添加前置; 
  # 1, 使用可视化部署, 需要参考WeBASE文档填写下面参数
  deployType: 0
  #### if deployType = 0, ignore below properties ####
  # 镜像名
  dockerRepository: "fiscoorg/fisco-webase"
  # WeBASE-Sign 访问地址,供节点前置访问,不能填写localhost或127.0.0.1
  webaseSignAddress: "127.0.0.1:5004"
  # 可视化操作的后台超时时间 (unit: ms),若机器较慢,可动态设置超时时间
  execDockerCheckTimeout: 55000
  execHostCheckTimeout: 55000
  execHostCheckPortTimeout: 50000
  execHostInitTimeout: 300000
  execHostConfigTimeout: 40000
  execBuildChainTimeout: 40000
  dockerRestartPeriodTime: 30000
  execShellTimeout: 600000
  execScpTimeout: 10000
  execAddNodeTimeout: 40000
  # runDockerSleepTime: 600000
  #### if deployType = 0, ignore upper properties ####

sdk:
  # 加密类型:0: 非国密;  1: 国密
  ## 可视化部署时,此配置将决定部署国密或非国密链
  ## 国密与非国密链的私钥、合约数据不兼容
  encryptType: 0

# executor config for async pulling data from chain
executor:
  corePoolSize: 10
  maxPoolSize: 20
  queueSize: 50
  threadNamePrefix: "node-mgr-async-"

# scheduler config for sync scheduled task
scheduler:
  poolSize: 30
  threadNamePrefix: "node-mgr-task-"
  awaitTerminationSeconds: 600
  waitForTasksToCompleteOnShutdown: true

4.5.给运行权限,启动服务

[root@localhost webase-node-mgr]# chmod +x *.sh
[root@localhost webase-node-mgr]# ./start.sh 
===============================================================================================
Server com.webank.webase.node.mgr.Application Port 5001 ...PID(4353) [Starting]. Please message check through the log file (default path:./log/).
===============================================================================================

备注:服务进程起来后,需通过日志确认是否正常启动,出现以下内容表示正常;如果服务出现异常,确认修改配置后,重启提示服务进程在运行,则先执行stop.sh,再执行start.sh。

Application() - main run success.

查看日志

全量日志:tail -f log/WeBASE-Node-Manager.log
错误日志:tail -f log/WeBASE-Node-Manager-error.log

5.配置安装WeBASE-Web

5.1.WeBASE-Web是基于vue的web,所以只需配置nginx即可跑起来

PS: 因为我们的服务器已有nginx,可在原配置文件nginx.conf增加一个server:

upstream node_mgr_server{
    server 192.168.119.132:5001; # 节点管理服务ip和端口
}

server {
    listen       5000 default_server; # 前端端口(端口需要开通策略且不能被占用)
    server_name  192.168.119.132;           # 服务器ip,也可配置为域名
    location / {
            root   /home/bcos/webase-web;   # 前端文件路径(文件需要有权限访问)
            index  index.html index.htm;
            try_files $uri $uri/ /index.html =404;
    }

    location /mgr {
                proxy_pass    http://node_mgr_server/;    		
                proxy_set_header		Host			 $host;
                proxy_set_header		X-Real-IP		 $remote_addr;
                proxy_set_header		X-Forwarded-For	 $proxy_add_x_forwarded_for;
    }
}

5.2.重启nginx后,可以进行测试。

访问http://192.168.119.132:5000/#/home

在这里插入图片描述
默认用户名:admin
默认密码:Abcd1234

在这里插入图片描述
检查后发现正常,后续配置相关配置即可。本文重点是离线安装而不是配置,所以不做过多的演示!
有需要的可以参考官方的文档:https://webasedoc.readthedocs.io/zh_CN/latest/docs/WeBASE-Console-Suit/index.html#id16


总结

无网络离线安装部署FISCO BCOS 中间件webase平台,还是比较简单 ,大家可以安装教程一步一步的操作。希望可以帮助有需要的小伙伴快速入坑!

  区块链 最新文章
盘点具备盈利潜力的几大加密板块,以及潜在
阅读笔记|让区块空间成为商品,打造Web3云
区块链1.0-比特币的数据结构
Team Finance被黑分析|黑客自建Token“瞒天
区块链≠绿色?波卡或成 Web3“生态环保”标
期货从入门到高深之手动交易系列D1课
以太坊基础---区块验证
进入以太坊合并的五个数字
经典同态加密算法Paillier解读 - 原理、实现
IPFS/Filecoin学习知识科普(四)
上一篇文章      下一篇文章      查看所有文章
加:2021-10-28 12:26:51  更:2021-10-28 12:27:02 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年4日历 -2024/4/26 22:34:19-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码