Merge "Applying ODL changes to BGPVPN scenario"
[fuel.git] / docs / build-instruction.rst
1 ============================================================================
2 OPNFV Build instruction for the Fuel deployment tool
3 ============================================================================
4
5 .. contents:: Table of Contents
6    :backlinks: none
7
8 Abstract
9 ========
10
11 This document describes how to build the Fuel deployment tool for the
12 B release of OPNFV - the build system, dependencies and required
13 system resources.
14
15
16 License
17 =======
18 Brahmaputra release of OPNFV when using Fuel as a deployment tool DOCs (c) by Jonas Bjurel (Ericsson AB) and others.
19
20 This document is licensed under a Creative Commons Attribution 4.0 International License. You should have received a copy of the license along with this. If not, see <http://creativecommons.org/licenses/by/4.0/>.
21
22
23 Introduction
24 ============
25
26 This document describes the build system used to build the Fuel
27 deployment tool for the Brahmaputra release of OPNFV, required
28 dependencies and minimum requirements on the host to be used for the
29 build system.
30
31 The Fuel build system is designed around Docker containers such that
32 dependencies outside of the build system can be kept to a minimum. It
33 also shields the host from any potential dangerous operations
34 performed by the build system.
35
36 The audience of this document is assumed to have good knowledge in
37 network and Unix/Linux administration.
38
39 Requirements
40 ============
41
42 Minimum Hardware Requirements
43 -----------------------------
44
45 - ~30 GB available disc
46
47 - 4 GB RAM
48
49 Minimum Software Requirements
50 -----------------------------
51
52 The build host should run Ubuntu 14.04 operating system.
53
54 On the host, the following packages must be installed:
55
56 - An x86_64 host (Bare-metal or VM) with Ubuntu 14.04 LTS installed
57
58   - A kernel equal or later than 3.19 (Vivid) (simply available through sudo apt-get install linux-generic-lts-vivid)
59
60   - **Note:** Builds on Wily (Ubuntu 15.x) are currently not supported
61
62 - docker - see https://docs.docker.com/engine/installation/ubuntulinux/ for installation notes for Ubuntu 14.04. Tested against ver 1.9.x and greater
63
64 - git (simply available through sudo apt-get install git)
65
66 - make (simply available through sudo apt-get install make)
67
68 - curl (simply available through sudo apt-get install curl)
69
70 Preparations
71 ============
72
73 Setting up the Docker build container
74 -------------------------------------
75 After having installed Docker, add yourself to the docker group:
76
77 <sudo usermod -a -G docker [userid]>
78
79 Also make sure to define relevant DNS servers part of the global dns chain in
80 in your </etc/default/docker> configuration file. Uncomment, modify the values appropriately
81 and save and quit the file.  For example:
82
83 <DOCKER_OPTS=" --dns=8.8.8.8 --dns=8.8.8.4">
84
85 Then restart docker:
86
87 <sudo service docker restart>
88
89 Setting up OPNFV Gerrit in order to being able to clone the code
90 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
91 - Start setting up OPNFV gerrit by creating a SSH key (unless you
92   don't already have one), create one with ssh-keygen
93
94 - Add your generated public key in OPNFV Gerrit <https://gerrit.opnfv.org/>
95   (this requires a Linux foundation account, create one if you do not
96   already have one)
97
98 - Select "SSH Public Keys" to the left and then "Add Key" and paste
99   your public key in.
100
101 Clone the OPNFV code Git repository with your SSH key
102 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
103 Now it is time to clone the code repository:
104
105 <git clone ssh://'Linux foundation user'@gerrit.opnfv.org:29418/fuel>
106
107 Now you should have the OPNFV fuel repository with the Fuel
108 directories stored locally on your build host.
109
110 Check out the Brahmaputra release:
111 <cd fuel>
112 <git checkout insert-b-release-tag-here0>
113
114 Clone the OPNFV code Git repository without a SSH key
115 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116 You can also opt to clone the code repository without a SSH key:
117
118 <git clone https://gerrit.opnfv.org:29418/gerrit/fuel>
119
120 Make sure to checkout the release tag as described above.
121
122 Support for building behind a http/https/rsync proxy
123 ----------------------------------------------------
124
125 The build system is able to make use of a web proxy setup if the
126 http_proxy, https_proxy, no_proxy (if needed) and RSYNC_PROXY or
127 RSYNC_CONNECT_PROG environment variables have been set before invoking make.
128
129 The proxy setup must permit port 80 (http), 443 (https) and 873
130 (rsync).
131
132 Important note about the host Docker daemon settings
133 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134
135 The Docker daemon on the host must be configured to use the http proxy
136 for it to be able to pull the base Ubuntu 14.04 image from the Docker
137 registry before invoking make! In Ubuntu this is done by adding a line
138 like:
139
140 export http_proxy="http://10.0.0.1:8888/"
141
142 to /etc/default/docker and restarting the Docker daemon.
143
144 Setting proxy environment variables prior to build
145 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
146
147 The build system will make use the following environment variables
148 that needs to be exported to subshells by using export (bash) or
149 setenv (csh/tcsh).
150
151 | http_proxy (or HTTP_PROXY)
152 | https_proxy (or HTTP_PROXY)
153 | no_proxy (or NO_PROXY)
154 | RSYNC_PROXY
155 | RSYNC_CONNECT_PROG
156
157 As an example, these are the settings that were put in the user's
158 .bashrc when verifying the proxy build functionality:
159
160 | export RSYNC_PROXY=10.0.0.1:8888
161 | export http_proxy=http://10.0.0.1:8888
162 | export https_proxy=http://10.0.0.1:8888
163 | export no_proxy=localhost,127.0.0.1,.consultron.com,.sock
164
165 Using a ssh proxy for the rsync connection
166 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167
168 If the proxy setup is not allowing the rsync protocol, an alternative
169 solution is to use a SSH tunnel to a machine capable of accessing the
170 outbound port 873. Set the RSYNC_CONNECT_PROG according to the rsync
171 manual page (for example to "ssh <username>@<hostname> nc %H 873") to enable
172 this. Also note that netcat needs to be installed on the remote
173 system!
174
175 Make sure that the ssh command also refers to the user on the remote
176 system, as the command itself will be run from the Docker build container
177 as the root user (but with the invoking user's SSH keys).
178
179 Disabling the Ubuntu repo cache if rsync is not allowed
180 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
181
182 During the build phase, a local Ubuntu package repository is fetched
183 from upstream in order to be added to the OPNFV Fuel ISO and for parts
184 of this process rsync is used.
185
186 If neither of the two available methods for proxying rsync are
187 available, the last resort is to turn off the caching of the Ubuntu
188 packages in the build system. This is done by removing the
189 "f_repobuild" from SUBDIRS in the beginning of
190 the fuel/build/f_isoroot/Makefile.
191
192 Note! Doing this will require the Fuel master node to have Internet
193 access when installing the ISO artifact built as no Ubuntu package
194 cache will be on the ISO!
195
196 Configure your build environment
197 --------------------------------
198
199 ** Configuring the build environment should not be performed if building standard Brahmaputra release **
200
201 Select the versions of the components you want to build by editing the fuel/build/config.mk file.
202
203 Non official build: Selecting which plugins to build
204 ----------------------------------------------------
205 In order to cut the build time for unofficial builds (made by an
206 individual developer locally), the selection if which Fuel plugins to
207 build (if any) can be done by environment variable
208 "BUILD_FUEL_PLUGINS" prior to building.
209
210 Only the plugin targets from fuel/build/f_isoroot/Makefile that are
211 specified in the environment variable will then be built. In order to
212 completely disable the building of plugins, the environment variable
213 is set to " ". When using this functionality, the resulting iso file
214 will be prepended with the prefix "unofficial-" to clearly indiciate
215 that this is not a full build.
216
217 This method of plugin selection is not meant to be used from within
218 Gerrit!
219
220 Building
221 ========
222
223 There are two methods available for building Fuel:
224
225 - A low level method using Make
226
227 - An abstracted method using build.sh
228
229 Low level build method using make
230 ---------------------------------
231 The low level method is based on Make:
232
233 From the <fuel/build> directory, invoke <make [target]>
234
235 Following targets exist:
236
237 - none/all -  this will:
238
239   - If not already existing, initialize the docker build environment
240
241   - If not already done, build OpenDaylight from upstream (as defined
242     by fuel-build config-spec)
243
244   - If not already done, build fuel from upstream (as defined by
245     fuel-build/config-spec)
246
247   - Build the defined additions to fuel (as defined by the structure
248     of this framework)
249
250   - Apply changes and patches to fuel (as defined by the structure of
251     this framework)
252
253   - Reconstruct a fuel .iso image
254
255 - clean - this will remove all artifacts from earlier builds.
256
257 - debug - this will simply enter the build container without starting a build, from here you can start a build by enter "make iso"
258
259 If the build is successful, you will find the generated ISO file in
260 the <fuel/build/release> subdirectory!
261
262 Abstracted build method using build.sh
263 --------------------------------------
264 The abstracted build method uses the <fuel/ci/build.sh> script which
265 allows you to:
266
267 - Create and use a build cache - significantly speeding up the
268   build time if upstream repositories have not changed.
269
270 - push/pull cache and artifacts to an arbitrary URI (http(s):, file:, ftp:)
271
272 For more info type <fuel/ci/build.sh -h>.
273
274 Artifacts
275 =========
276
277 The artifacts produced are:
278
279 - <OPNFV_XXXX.iso> - Which represents the bootable Fuel image, XXXX is
280   replaced with the build identity provided to the build system
281
282 - <OPNFV_XXXX.iso.txt> - Which holds version metadata.
283
284 References
285 ==========
286
287 -