github.com/kchristidis/fabric@v1.0.4-0.20171028114726-837acd08cde1/docs/source/dev-setup/build.rst (about)

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