github.com/adnan-c/fabric_e2e_couchdb@v0.6.1-preview.0.20170228180935-21ce6b23cf91/docs/dev-setup/devenv.md (about) 1 ## Setting up the development environment 2 3 ### Overview 4 5 Through the v0.6 release, the development environment utilized Vagrant running 6 an Ubuntu image, which in turn launched Docker containers as a means of 7 ensuring a consistent experience for developers who might be working with 8 varying platforms, such as MacOSX, Windows, Linux, or whatever. Advances in 9 Docker have enabled native support on the most popular development platforms: 10 MacOSX and Windows. Hence, we have reworked our build to take full advantage 11 of these advances. While we still maintain a Vagrant based approach that can 12 be used for older versions of MacOSX and Windows that Docker does not support, 13 we strongly encourage that the non-Vagrant development setup be used. 14 15 Note that while the Vagrant-based development setup could not be used in a 16 cloud context, the Docker-based build does support cloud platforms such as AWS, 17 Azure, Google and IBM to name a few. Please follow the instructions for Ubuntu 18 builds, below. 19 20 ### Prerequisites 21 * [Git client](https://git-scm.com/downloads) 22 * [Go](https://golang.org/) - 1.7 or later (for releases before v1.0, 1.6 or later) 23 * For MacOSX, [Xcode](https://itunes.apple.com/us/app/xcode/id497799835?mt=12) 24 must be installed 25 * [Docker](https://www.docker.com/products/overview) - 1.12 or later 26 * [Pip](https://pip.pypa.io/en/stable/installing/) 27 * (MacOSX) you may need to install gnutar, as MacOSX comes with bsdtar as the 28 default, but the build uses some gnutar flags. You can use Homebrew to install 29 it as follows: 30 31 ``` 32 brew install gnu-tar --with-default-names 33 ``` 34 35 * (only if using Vagrant) - [Vagrant](https://www.vagrantup.com/) - 1.7.4 or 36 later 37 * (only if using Vagrant) - [VirtualBox](https://www.virtualbox.org/) - 5.0 or 38 later 39 * BIOS Enabled Virtualization - Varies based on hardware 40 41 - Note: The BIOS Enabled Virtualization may be within the CPU or Security 42 settings of the BIOS 43 44 ### `pip`, `behave` and `docker-compose` 45 46 ``` 47 pip install --upgrade pip 48 pip install behave nose docker-compose 49 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 sha3==0.2.1 50 ``` 51 52 ### Steps 53 54 #### Set your GOPATH 55 Make sure you have properly setup your Host's [GOPATH environment variable](https://github.com/golang/go/wiki/GOPATH). This allows for both 56 building within the Host and the VM. 57 58 #### Note to Windows users 59 60 If you are running Windows, before running any `git clone` commands, run the 61 following command. 62 ``` 63 git config --get core.autocrlf 64 ``` 65 If `core.autocrlf` is set to `true`, you must set it to `false` by running 66 ``` 67 git config --global core.autocrlf false 68 ``` 69 If you continue with `core.autocrlf` set to `true`, the `vagrant up` command 70 will fail with the error: 71 72 `./setup.sh: /bin/bash^M: bad interpreter: No such file or directory` 73 74 #### Cloning the Fabric project 75 76 Since the Fabric project is a `Go` project, you'll need to clone the Fabric 77 repo to your $GOPATH/src directory. If your $GOPATH has multiple path 78 components, then you will want to use the first one. There's a little bit of 79 setup needed: 80 81 ``` 82 cd $GOPATH/src 83 mkdir -p github.com/hyperledger 84 cd github.com/hyperledger 85 ``` 86 87 Recall that we are using `Gerrit` for source control, which has its own internal 88 git repositories. Hence, we will need to clone from [Gerrit](../Gerrit/gerrit.md#Working-with-a-local-clone-of-the-repository). For 89 brevity, the command is as follows: 90 ``` 91 git clone ssh://LFID@gerrit.hyperledger.org:29418/fabric && scp -p -P 29418 LFID@gerrit.hyperledger.org:hooks/commit-msg fabric/.git/hooks/ 92 ``` 93 **Note:** Of course, you would want to replace `LFID` with your own 94 [Linux Foundation ID](../Gerrit/lf-account.md). 95 96 #### Boostrapping the VM using Vagrant 97 98 If you are planning on using the Vagrant developer environment, the following 99 steps apply. **Again, we recommend against its use except for developers that 100 are limited to older versions of MacOSX and Windows that are not supported by 101 Docker for Mac or Windows.** 102 103 ``` 104 cd $GOPATH/src/github.com/hyperledger/fabric/devenv 105 vagrant up 106 ``` 107 108 Go get coffee... this will take a few minutes. Once complete, you should be able 109 to `ssh` into the Vagrant VM just created. 110 111 ``` 112 vagrant ssh 113 ``` 114 115 Once inside the VM, you can find the peer project under 116 `$GOPATH/src/github.com/hyperledger/fabric`. It is also mounted as 117 `/hyperledger`. 118 119 ### Building the fabric 120 121 Once you have all the dependencies installed, and have cloned the repository, 122 you can proceed to [build and test](build.md) the fabric. 123 124 ### Notes 125 126 **NOTE:** Any time you change any of the files in your local fabric directory 127 (under `$GOPATH/src/github.com/hyperledger/fabric`), the update will be 128 instantly available within the VM fabric directory. 129 130 **NOTE:** If you intend to run the development environment behind an HTTP Proxy, 131 you need to configure the guest so that the provisioning process may complete. 132 You can achieve this via the *vagrant-proxyconf* plugin. Install with 133 `vagrant plugin install vagrant-proxyconf` and then set the VAGRANT_HTTP_PROXY 134 and VAGRANT_HTTPS_PROXY environment variables *before* you execute `vagrant up`. 135 More details are available here: https://github.com/tmatilai/vagrant-proxyconf/ 136 137 **NOTE:** The first time you run this command it may take quite a while to 138 complete (it could take 30 minutes or more depending on your environment) and 139 at times it may look like it's not doing anything. As long you don't get any 140 error messages just leave it alone, it's all good, it's just cranking. 141 142 **NOTE to Windows 10 Users:** There is a known problem with vagrant on Windows 143 10 (see [mitchellh/vagrant#6754](https://github.com/mitchellh/vagrant/issues/6754)). 144 If the `vagrant up` command fails it may be because you do not have the Microsoft 145 Visual C++ Redistributable package installed. You can download the missing package at 146 the following address: http://www.microsoft.com/en-us/download/details.aspx?id=8328