LoginSignup
4
3

More than 5 years have passed since last update.

Hyperledger Fabric v1.0-alpha2の開発環境を作る

Posted at

以下を参考に開発用環境を作る

前提条件

  • Git client
  • Go - 1.7以上 (for releases before v1.0, 1.6 or later)
  • macOSは、Xcodeのインストール必須
  • Docker - 1.12以上
  • Docker Compose - 1.8.1以上
  • Pip (macOSの場合) macOSでは、gnutarがデフォルトでbsdtarなのでをインストールしなくてはならないかも知れません。ビルドがgnutarのフラグを使うためです。 Homebrewでは、以下のようにインストールする
brew install gnu-tar --with-default-names
  • (Vagrant利用時のみ) - Vagrant - 1.7.4以上
  • (Vagrant利用時のみ) - VirtualBox - 5.0以上
  • BIOS Enabled Virtualization - ハードウェアによって異なる
  • 注意: BIOS Enabled Virtualizationの設定項目は、CPUの中か、BIOSのセキュリティの設定の中にあるかも知れません。

pipとbehaveとdocker-composeのセットアップ

pip install --upgrade pip
pip install behave nose docker-compose

上記でコケる

 Stored in directory: /Users/user/Library/Caches/pip/wheels/3c/d0/09/cd78d0ff4d6cfecfbd730782a7815a4571cd2cd4d2ed6e69d9
Successfully built parse-type parse texttable docopt dockerpty backports.ssl-match-hostname websocket-client functools32
Installing collected packages: parse, six, enum34, parse-type, behave, nose, texttable, docopt, functools32, jsonschema, dockerpty, backports.ssl-match-hostname, cached-property, colorama, websocket-client, docker-pycreds, docker, docker-compose
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 377, in move_wheel_files
    clobber(source, dest, False, fixer=fixer, filter=filter)
  File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/usr/local/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/man'

本来なら、上記が成功して以下を実行するが…

pip install -I flask==0.10.1 python-dateutil==2.2 pytz==2014.3 pyyaml==3.10 couchdb==1.0 flask-cors==2.0.1 requests==2.4.3 pyOpenSSL==16.2.0 pysha3==1.0b1 grpcio==1.0.4

#PIP packages required for some behave tests
pip install urllib3 ndg-httpsclient pyasn1 ecdsa python-slugify grpcio-tools jinja2 b3j0f.aop six

上記エラーをシカトして進める

fabricのソースをgit clone

cd $GOPATH/src
mkdir -p github.com/hyperledger
cd github.com/hyperledger

公式マニュアルでは以下のようにgerritで取ってくるが、やり方がサクッとわからない&ID取得とか面倒な人多そうなのでGithubで行う。(LFIDは、Linux Foundation IDを指定する)

git clone ssh://LFID@gerrit.hyperledger.org:29418/fabric && scp -p -P 29418 LFID@gerrit.hyperledger.org:hooks/commit-msg fabric/.git/hooks/

上記でなく、以下のGitHubからgit clone

git clone https://github.com/hyperledger/fabric.git

vagrant立ち上げ

cd $GOPATH/src/github.com/hyperledger/fabric/devenv
vagrant up

ダウンロードなどで何分かかかるが、終了したらsshする。
すでにあると言われたら、vagrant destroyで削除
ダメな場合、vboxmanage list vmsとVBoxManage unregistervm 8ba467b7-da96-4f68-9bf8-671dd6f0d007 --deleteで削除

vagrant ssh

マウントポイントは以下。

$GOPATH/src/github.com/hyperledger/fabric 
/hyperledger にもマウントされている

関連用語

  • hyperledger fabric
  • ハイパーレジャー、ハイパーレッジャー ファブリック
4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3