-
Notifications
You must be signed in to change notification settings - Fork 214
Install
FNS需要运行Linux环境中,请确保当前服务器内核版本在3.10
及以上。
安装Docker
及Docker-Compose
。环境部署可分别参考公网和内网两种情况。
执行docker pull aberic/fabric-edge:1.0-RC6
下载镜像。镜像版本号并非固定不变,请根据实际需求选择,理论上最新版是最为适合的,具体参考镜像版本tag list。
镜像下载完成后需要对将镜像tag为latest,或者通过修改下面的配置文件来指定当前运行的版本号亦可。
参考命令:
docker tag [IMAGE ID] aberic/fabric-edge:latest
编辑docker-fns.yaml
,基本样例如下:
version: '2'
services:
edge:
container_name: edge
image: aberic/fabric-edge
environment:
- USERNAME=admin
- PASSWORD=password
command: bash /home/fns.sh
ports:
- 8080:8080
如果未将fabric-edge镜像tag为latest,那么需要在image: aberic/fabric-edge
后追加指定版本号,如image: aberic/fabric-edge:1.0-RC6
。
上述YAML配置中,环境变量USERNAME
和PASSWORD
指定了FNS后台登录管理员账号和密码,密码在服务中将做MD5加密处理。
请牢记该用户名和密码,这将是FNS后台登录凭证,如果没有该凭证,将无法登录FNS后台。
你可以对ports
中的第一个端口号进行指定,以便最终在物理机中所启用的端口号是你所期望的。最终自定义后的效果可能如下:
version: '2'
services:
edge:
container_name: edge
image: aberic/fabric-edge:1.0-RC6
environment:
- USERNAME=admin
- PASSWORD=password
command: bash /home/fns.sh
ports:
- 8088:8080
上述可配置内容不多,仅为案例,具体实际配置需要根据真实需求进行管理和维护。
FNS后台应对生产需要设置一定的访问权限,若仅仅是内网,或许这样的需求还能省略。但除了常规后台访问安全考虑外,针对对外服务提供的接口访问也应该走appkey
的方式来进行管理,避免全白名单的服务器被恶意调用接口。
使用docker-compose命令启动上述编排好的yaml文件,执行命令参考如下:
docker-compose -f docker-fns.yaml up
最终看到如下视图,即表示启动成功:
edge | 02:40:14.849 DEBUG org.apache.ibatis.logging.jdbc.BaseJdbcLogger 159 debug - ==> Preparing: select rowid,username,password from user
edge | 02:40:14.929 DEBUG org.apache.ibatis.logging.jdbc.BaseJdbcLogger 159 debug - ==> Parameters:
edge | 02:40:15.036 DEBUG org.apache.ibatis.logging.jdbc.BaseJdbcLogger 159 debug - <== Total: 0
edge | 02:40:15.065 DEBUG org.apache.ibatis.logging.jdbc.BaseJdbcLogger 159 debug - ==> Preparing: insert into user (username,password) values (?,?)
edge | 02:40:15.101 DEBUG org.apache.ibatis.logging.jdbc.BaseJdbcLogger 159 debug - ==> Parameters: admin(String), 5f4dcc3b5aa765d61d8327deb882cf99(String)
edge | 02:40:15.233 DEBUG org.apache.ibatis.logging.jdbc.BaseJdbcLogger 159 debug - <== Updates: 1
edge |
edge | _____ _ _ ____
edge | | ____| | \ | | | _ \
edge | | _| | \| | | | | |
edge | | |___ | |\ | | |_| |
edge | |_____| |_| \_| |____/
edge |
edge | ===================== please make your fabric net work =====================
edge |
edge | ================================= read logs ================================
启动成功后,可通过http://localhost:port/index 域名格式进行访问即可。
首次访问需要登录账号,如下图所示:
登录在YAML中设定的账号密码即可顺利进入首页视图,如下:
继续阅读HyperLedger Fabric网络交互文档。