天天看點

hyperledger cello 0.9.0 項目部署總結

花了小兩天時間來嘗試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.<anonymous> (/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

繼續閱讀