花了小两天时间来尝试cello项目,这个项目可以解决fabric自动部署和一定程度运维管理的问题。
但结果不太好,项目最新发布版本0.9.0,正在开发1.0.0版本;
下载代码,将版本切到0.9.0,官方攻略写的很见到,就下载代码,make,启动;然而坑却非常之多。
https://hyperledger-cello.readthedocs.io/en/latest/setup/setup_master/
1号坑
setup很顺利,启动后user-dashboard报错,少config.passportOauth2.key 。
这个服务是入口服务,搞不定接下来都免谈,又是熟悉又不熟悉的nodejs,上网查了查,有一个哥们提了问,但是没有响应。
https://lists.hyperledger.org/g/cello/topic/egg_passport_oauth2_error_key/32582120?p=,,,20,0,0,0::recentpostdate%2Fsticky,,,20,2,0,32582120
这里卡住之后首先想的是从技术方面解决,查了下这个报错,没有啥直观解答,还是算了,不想掉进nodejs的大坑。
2019-11-27 06:50:12,942 INFO 134 [egg-multipart] stream mode enable
/node_modules/egg/lib/application.js:70
throw e;
^
AssertionError [ERR_ASSERTION]: [egg-passport-oauth2] config.passportOauth2.key required
at module.exports.app (/node_modules/egg-passport-oauth2/app.js:10:3)
at Hook.configDidLoad (/node_modules/egg-core/lib/lifecycle.js:92:9)
at Lifecycle.triggerConfigDidLoad (/node_modules/egg-core/lib/lifecycle.js:143:14)
at Lifecycle.triggerConfigWillLoad (/node_modules/egg-core/lib/lifecycle.js:137:10)
at AppWorkerLoader.loadCustomApp (/node_modules/egg-core/lib/loader/mixin/custom.js:37:20)
at AppWorkerLoader.load (/node_modules/egg/lib/loader/app_worker_loader.js:33:10)
at new Application (/node_modules/egg/lib/application.js:66:19)
at Object. (/node_modules/egg-cluster/lib/app_worker.js:19:13)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
看网上其他的安装攻略,顺利务必,但都是18年底19年初那会的,仔细看了下,发现有个make build-admin-js 的操作,官方文档没写,但是在dev模式下却有。
尝试执行,继续报错npm有问题,还是nodejs的事,查了查无果。
build-admin-js_1 |
build-admin-js_1 | > [email protected] build /var/www/dashboard
build-admin-js_1 | > cross-env ESLINT=none roadhog build
build-admin-js_1 |
build-admin-js_1 | Failed to compile.
build-admin-js_1 |
build-admin-js_1 | Module not found: Error: Can't resolve '@babel/runtime/helpers/esm/extends' in '/node_modules/history/esm'
build-admin-js_1 |
build-admin-js_1 |
build-admin-js_1 | [graceful-process#25] exit with code:1
build-admin-js_1 | npm ERR! code ELIFECYCLE
build-admin-js_1 | npm ERR! errno 1
build-admin-js_1 | npm ERR! [email protected] build: `cross-env ESLINT=none roadhog build`
build-admin-js_1 | npm ERR! Exit status 1
build-admin-js_1 | npm ERR!
build-admin-js_1 | npm ERR! Failed at the [email protected] build script.
build-admin-js_1 | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
build-admin-js_1 |
build-admin-js_1 | npm ERR! A complete log of this run can be found in:
build-admin-js_1 | npm ERR! /root/.npm/_logs/2019-11-27T11_03_59_043Z-debug.log
此时查看了下镜像库,发现全是latest,攻略有的在setup前面加了版本号 v0.9.0;
我尝试了下,发现根本下载不下来,提示没有。到docker-hub上一看,发现只有latest的包,而且是自动根据master代码来打的,最新的是两天前,这不是坑么。而且最新的代码将user-dashboard和operator-dashboard进行了合并,这两个镜像已经不存在了,但是本地镜像库确实有这两个镜像,没太搞明白。
接下来决定尝试自己编译docker镜像,解决镜像和diamante版本不一致可能导致的问题。
接下来掉进二号坑
make docker执行一段时间后也报错,第一个baseimage都没通过,首先报一个目录不为空无法删除的错
Step 3/6 : RUN cd /tmp/baseimage && bash install.sh && rm -rf /tmp/baseimage
---> Running in 2184df0fca72
+ set -x
+ apt-get update
Get:1 http://deb.debian.org/debian buster InRelease [122 kB]
Get:2 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:1 http://deb.debian.org/debian buster InRelease [122 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [49.3 kB]
Get:4 http://deb.debian.org/debian buster/main amd64 Packages [7908 kB]
Get:5 http://deb.debian.org/debian buster-updates/main amd64 Packages [5792 B]
Get:6 http://security.debian.org/debian-security buster/updates/main amd64 Packages [158 kB]
Fetched 8279 kB in 4min 9s (33.2 kB/s)
Reading package lists...
+ apt-get install -y supervisor
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
python-meld3 python-pkg-resources
Suggested packages:
python-setuptools supervisor-doc
The following NEW packages will be installed:
python-meld3 python-pkg-resources supervisor
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 503 kB of archives.
After this operation, 2210 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian buster/main amd64 python-meld3 all 1.0.2-2 [37.3 kB]
Get:2 http://deb.debian.org/debian buster/main amd64 python-pkg-resources all 40.8.0-1 [182 kB]
Get:3 http://deb.debian.org/debian buster/main amd64 supervisor all 3.3.5-1 [284 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 503 kB in 3min 45s (2234 B/s)
Selecting previously unselected package python-meld3.
(Reading database ... 24526 files and directories currently installed.)
Preparing to unpack .../python-meld3_1.0.2-2_all.deb ...
Unpacking python-meld3 (1.0.2-2) ...
Selecting previously unselected package python-pkg-resources.
Preparing to unpack .../python-pkg-resources_40.8.0-1_all.deb ...
Unpacking python-pkg-resources (40.8.0-1) ...
Selecting previously unselected package supervisor.
Preparing to unpack .../supervisor_3.3.5-1_all.deb ...
Unpacking supervisor (3.3.5-1) ...
Setting up python-pkg-resources (40.8.0-1) ...
Setting up python-meld3 (1.0.2-2) ...
Setting up supervisor (3.3.5-1) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
+ rm -rf /var/lib/apt/lists/auxfiles /var/lib/apt/lists/deb.debian.org_debian_dists_buster-updates_InRelease /var/lib/apt/lists/deb.debian.org_debian_dists_buster-updates_main_binary-amd64_Packages.lz4 /var/lib/apt/lists/deb.debian.org_debian_dists_buster_InRelease /var/lib/apt/lists/deb.debian.org_debian_dists_buster_main_binary-amd64_Packages.lz4 /var/lib/apt/lists/lock /var/lib/apt/lists/partial /var/lib/apt/lists/security.debian.org_debian-security_dists_buster_updates_InRelease /var/lib/apt/lists/security.debian.org_debian-security_dists_buster_updates_main_binary-amd64_Packages.lz4
rm: cannot remove '/tmp/baseimage': Directory not empty
The command '/bin/sh -c cd /tmp/baseimage && bash install.sh && rm -rf /tmp/baseimage' returned anon-zero code: 1
make: *** [build/docker/baseimage/.x86_64-0.9.0-snapshot-b6a340d] 错误 1
感觉有点莫名其妙,但也没有办法,在docker文件里面删除这条命令后继续,到第五步又报pip安装依赖无法满足requirement文件的问题,我也是醉了,python也不熟。
本来到这基本就打住了,因为baseimage看起来是基础镜像,是其他服务需要依赖的;另辟蹊径修改Makefile单独编译user-dashboard服务,过程很漫长,下了很多包,最终这次单独打包成功了。
还没来得及运行,又试了下make start,user-dashboard服务竟然启动成功了,囧。
编译的同时也在找0.9.0镜像的其他渠道,发现dockerhub有三个个人编译的,试了下载量最大的handchain的,启动了下发现日志不太对劲,略过。https://hub.docker.com/r/handchain/cello-user-dashboard
启动成功后,又遇到新问题,好多资源加载不到,控制台console报错如下
Refused to apply style from 'http://172.16.31.122:8081/static/index.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
(index):18 GET http://172.16.31.122:8081/static/index.js net::ERR_ABORTED 404 (Not Found)
直接访问资源报404,到此耐心功力耗尽,还是等1.0.0版本吧,本来就不成熟,支持的fabric最大也就到1.2;目前faric已经release 1.4 ltm版本了。本来后续的区块链方案想基于开源升级,但看起来希望渺茫,技术栈差距太大了。1.0版本release再来看看吧
之所以花了这么长时间,是因为每个坑的操作都很耗时,一次尝试少则数分钟,多则几十分钟。尤其是node相关和docker相关,都要下载好多东西。
附官方地址
官方文档
https://hyperledger-cello.readthedocs.io/en/latest/setup/setup_master/
官方jira
https://jira.hyperledger.org/issues/?filter=-4
官方wiki
https://wiki.hyperledger.org/display/cello/Hyperledger+Cello
0.9版本部署介绍视频(远没有看上去这么轻松。。)
https://www.youtube.com/watch?v=3v_H9-JlBLw&feature=youtu.be
1.0前瞻视频
https://www.youtube.com/watch?v=mnZJEakWyOY
参考
https://blog.csdn.net/weixin_30883271/article/details/99760048
https://www.cnblogs.com/zooqkl/p/10945177.html