github.com/leonlxy/hyperledger@v1.0.0-alpha.0.20170427033203-34922035d248/docs/source/dev-setup/build.rst (about) 1 Building the fabric 2 ------------------- 3 4 The following instructions assume that you have already set up your 5 :doc:`development environment <devenv>`. 6 7 To build the Fabric: 8 9 :: 10 11 cd $GOPATH/src/github.com/hyperledger/fabric 12 make dist-clean all 13 14 Running the unit tests 15 ~~~~~~~~~~~~~~~~~~~~~~ 16 17 Use the following sequence to run all unit tests 18 19 :: 20 21 cd $GOPATH/src/github.com/hyperledger/fabric 22 make unit-test 23 24 To run a specific test use the ``-run RE`` flag where RE is a regular 25 expression that matches the test case name. To run tests with verbose 26 output use the ``-v`` flag. For example, to run the ``TestGetFoo`` test 27 case, change to the directory containing the ``foo_test.go`` and 28 call/excecute 29 30 :: 31 32 go test -v -run=TestGetFoo 33 34 Running Node.js Unit Tests 35 ~~~~~~~~~~~~~~~~~~~~~~~~~~ 36 37 You must also run the Node.js unit tests to insure that the Node.js 38 client SDK is not broken by your changes. To run the Node.js unit tests, 39 follow the instructions 40 `here <https://github.com/hyperledger/fabric-sdk-node/blob/master/README.md>`__. 41 42 Running Behave BDD Tests 43 ~~~~~~~~~~~~~~~~~~~~~~~~ 44 45 **Note:** currently, the behave tests must be run from within in the 46 Vagrant environment. See the :doc:`development environment <devenv>` setup instructions 47 if you have not already set up your Vagrant environment. 48 49 `Behave <http://pythonhosted.org/behave/>`__ tests will setup networks 50 of peers with different security and consensus configurations and verify 51 that transactions run properly. To run these tests 52 53 :: 54 55 cd $GOPATH/src/github.com/hyperledger/fabric 56 make behave 57 58 Some of the Behave tests run inside Docker containers. If a test fails 59 and you want to have the logs from the Docker containers, run the tests 60 with this option: 61 62 :: 63 64 cd $GOPATH/src/github.com/hyperledger/fabric/bddtests 65 behave -D logs=Y 66 67 Building outside of Vagrant 68 --------------------------- 69 70 It is possible to build the project and run peers outside of Vagrant. 71 Generally speaking, one has to 'translate' the vagrant `setup 72 file <https://github.com/hyperledger/fabric/blob/master/devenv/setup.sh>`__ 73 to the platform of your choice. 74 75 Building on Z 76 ~~~~~~~~~~~~~ 77 78 To make building on Z easier and faster, `this 79 script <https://github.com/hyperledger/fabric/tree/master/devenv/setupRHELonZ.sh>`__ 80 is provided (which is similar to the `setup 81 file <https://github.com/hyperledger/fabric/blob/master/devenv/setup.sh>`__ 82 provided for vagrant). This script has been tested only on RHEL 7.2 and 83 has some assumptions one might want to re-visit (firewall settings, 84 development as root user, etc.). It is however sufficient for 85 development in a personally-assigned VM instance. 86 87 To get started, from a freshly installed OS: 88 89 :: 90 91 sudo su 92 yum install git 93 mkdir -p $HOME/git/src/github.com/hyperledger 94 cd $HOME/git/src/github.com/hyperledger 95 git clone http://gerrit.hyperledger.org/r/fabric 96 source fabric/devenv/setupRHELonZ.sh 97 98 From this point, you can proceed as described above for the Vagrant 99 development environment. 100 101 :: 102 103 cd $GOPATH/src/github.com/hyperledger/fabric 104 make peer unit-test behave 105 106 Building on Power Platform 107 ~~~~~~~~~~~~~~~~~~~~~~~~~~ 108 109 Development and build on Power (ppc64le) systems is done outside of 110 vagrant as outlined `here <#building-outside-of-vagrant>`__. For ease 111 of setting up the dev environment on Ubuntu, invoke `this 112 script <https://github.com/hyperledger/fabric/tree/master/devenv/setupUbuntuOnPPC64le.sh>`__ 113 as root. This script has been validated on Ubuntu 16.04 and assumes 114 certain things (like, development system has OS repositories in place, 115 firewall setting etc) and in general can be improvised further. 116 117 To get started on Power server installed with Ubuntu, first ensure you 118 have properly setup your Host's `GOPATH environment 119 variable <https://github.com/golang/go/wiki/GOPATH>`__. Then, execute 120 the following commands to build the fabric code: 121 122 :: 123 124 mkdir -p $GOPATH/src/github.com/hyperledger 125 cd $GOPATH/src/github.com/hyperledger 126 git clone http://gerrit.hyperledger.org/r/fabric 127 sudo ./fabric/devenv/setupUbuntuOnPPC64le.sh 128 cd $GOPATH/src/github.com/hyperledger/fabric 129 make dist-clean all 130 131 Configuration 132 ------------- 133 134 Configuration utilizes the `viper <https://github.com/spf13/viper>`__ 135 and `cobra <https://github.com/spf13/cobra>`__ libraries. 136 137 There is a **core.yaml** file that contains the configuration for the 138 peer process. Many of the configuration settings can be overridden on 139 the command line by setting ENV variables that match the configuration 140 setting, but by prefixing with *'CORE\_'*. For example, logging level 141 manipulation through the environment is shown below: 142 143 :: 144 145 CORE_PEER_LOGGING_LEVEL=CRITICAL peer 146 147 Logging 148 ------- 149 150 Logging utilizes the `go-logging <https://github.com/op/go-logging>`__ 151 library. 152 153 The available log levels in order of increasing verbosity are: *CRITICAL 154 \| ERROR \| WARNING \| NOTICE \| INFO \| DEBUG* 155 156 See :doc:`specific logging control <../Setup/logging-control>` 157 instructions when running the peer process.