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