docs/build-instruction.rst: Cleanup, refactor tags.
[armband.git] / docs / build-instruction.rst
1 =================================================================================================
2 OPNFV Build instruction for the AArch64 Brahmaputra 3.0 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 AArch64 Brahmaputra release of OPNFV build system, dependencies and
17 required system resources.
18
19 Introduction
20 ============
21
22 This document describes the build system used to build the Fuel
23 deployment tool for the AArch64 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 Due to early docker and nodejs support on AArch64, we will still use an
36 x86_64 Fuel Master to build and deploy an AArch64 target pool, as well
37 as an x86_64 build machine for building the OPNFV ISO.
38
39 Requirements
40 ============
41
42 Minimum Hardware Requirements
43 -----------------------------
44
45 - ~50 GB available disc
46
47 - 4 GB RAM
48
49 Minimum Software Requirements
50 -----------------------------
51
52 The build host should run Ubuntu 14.04 (x86_64) 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   - **Note:** Builds on Wily (Ubuntu 15.x) are currently not supported
59
60   - A kernel equal- or later than 3.19 (Vivid), simply available through:
61
62 .. code-block:: bash
63
64     $ sudo apt-get install linux-generic-lts-vivid
65
66 - docker - see https://docs.docker.com/engine/installation/ubuntulinux/ for
67   installation notes for Ubuntu 14.04. Tested against version 1.9.x and greater
68
69 - git
70
71 - make
72
73 - curl
74
75 - fuseiso
76
77 Apart from docker, all other package requirements listed above are
78 simply available through:
79
80 .. code-block:: bash
81
82     $ sudo apt-get install git make curl fuseiso
83
84 Preparations
85 ============
86
87 Setting up the Docker build container
88 -------------------------------------
89 After having installed Docker, add yourself to the docker group:
90
91 .. code-block:: bash
92
93     $ sudo usermod -a -G docker [userid]
94
95 Also make sure to define relevant DNS servers part of the global
96 DNS chain in your </etc/default/docker> configuration file.
97 Uncomment, and modify the values appropriately.
98
99 For example:
100
101 .. code-block:: bash
102
103     DOCKER_OPTS=" --dns=8.8.8.8 --dns=8.8.8.4"
104
105 Then restart docker:
106
107 .. code-block:: bash
108
109     $ sudo service docker restart
110
111 Setting up OPNFV Gerrit in order to being able to clone the code
112 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
113 - Start setting up OPNFV gerrit by creating a SSH key (unless you
114   don't already have one), create one with ssh-keygen
115
116 - Add your generated public key in OPNFV Gerrit (https://gerrit.opnfv.org/)
117   (this requires a Linux foundation account, create one if you do not
118   already have one)
119
120 - Select "SSH Public Keys" to the left and then "Add Key" and paste
121   your public key in.
122
123 Clone the armband@OPNFV code Git repository with your SSH key
124 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125 Now it is time to clone the code repository:
126
127 .. code-block:: bash
128
129     $ git clone ssh://<Linux foundation user>@gerrit.opnfv.org:29418/armband
130
131 Now you should have the OPNFV ARMBAND repository with its
132 directories stored locally on your build host.
133
134 Check out the Brahmaputra release:
135
136 .. code-block:: bash
137
138     $ cd armband
139     $ git checkout brahmaputra.3.0
140
141 Clone the armband@OPNFV code Git repository without a SSH key
142 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
143 You can also opt to clone the code repository without a SSH key:
144
145 .. code-block:: bash
146
147     $ git clone https://gerrit.opnfv.org/gerrit/armband
148
149 Make sure to checkout the release tag as described above.
150
151 Support for building behind a http/https/rsync proxy
152 ----------------------------------------------------
153
154 The build system is able to make use of a web proxy setup if the
155 http_proxy, https_proxy, no_proxy (if needed) and RSYNC_PROXY or
156 RSYNC_CONNECT_PROG environment variables have been set before invoking make.
157
158 The proxy setup must permit port 80 (http), 443 (https) and 873 (rsync).
159
160 Important note about the host Docker daemon settings
161 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162
163 The Docker daemon on the host must be configured to use the http proxy
164 for it to be able to pull the base Ubuntu 14.04 image from the Docker
165 registry before invoking make! In Ubuntu this is done by adding a line
166 like:
167
168 .. code-block:: bash
169
170     export http_proxy="http://10.0.0.1:8888/"
171
172 to </etc/default/docker> and restarting the Docker daemon.
173
174 Setting proxy environment variables prior to build
175 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176
177 The build system will make use the following environment variables
178 that needs to be exported to subshells by using export (bash) or
179 setenv (csh/tcsh).
180
181 .. code-block:: bash
182
183     http_proxy (or HTTP_PROXY)
184     https_proxy (or HTTP_PROXY)
185     no_proxy (or NO_PROXY)
186     RSYNC_PROXY
187     RSYNC_CONNECT_PROG
188
189 As an example, these are the settings that were put in the user's
190 .bashrc when verifying the proxy build functionality:
191
192 .. code-block:: bash
193
194     export RSYNC_PROXY=10.0.0.1:8888
195     export http_proxy=http://10.0.0.1:8888
196     export https_proxy=http://10.0.0.1:8888
197     export no_proxy=localhost,127.0.0.1,.consultron.com,.sock
198
199 Using a ssh proxy for the rsync connection
200 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
201
202 If the proxy setup is not allowing the rsync protocol, an alternative
203 solution is to use a SSH tunnel to a machine capable of accessing the
204 outbound port 873. Set the RSYNC_CONNECT_PROG according to the rsync
205 manual page (for example to "ssh <username>@<hostname> nc %H 873")
206 to enable this. Also note that netcat needs to be installed on the
207 remote system!
208
209 Make sure that the ssh command also refers to the user on the remote
210 system, as the command itself will be run from the Docker build container
211 as the root user (but with the invoking user's SSH keys).
212
213 Disabling the Ubuntu repo cache if rsync is not allowed
214 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215
216 During the build phase, a local Ubuntu package repository is fetched
217 from upstream in order to be added to the OPNFV Fuel ISO and for parts
218 of this process rsync is used.
219
220 If neither of the two available methods for proxying rsync are
221 available, the last resort is to turn off the caching of the Ubuntu
222 packages in the build system. This is done by removing the
223 "f_repobuild" from SUBDIRS in the beginning of the
224 <armband/upstream/fuel/build/f_isoroot/Makefile>.
225
226 Note! Doing this will require the Fuel master node to have Internet
227 access when installing the ISO artifact built as no Ubuntu package
228 cache will be on the ISO!
229
230 Note! Armband build system uses git submodules to track fuel and
231 other upstream repos, so in order to apply the above change, one
232 should first initialize the submodules and apply armband patches
233 (only needed once):
234
235 .. code-block:: bash
236
237     $ make submodules-init
238     $ make patches-import
239
240 Configure your build environment
241 --------------------------------
242
243 ** Configuring the build environment should not be performed if building
244 standard Brahmaputra release **
245
246 Select the versions of the components you want to build by editing the
247 <armband/upstream/fuel/build/config.mk> file.
248
249 Note! The same observation as above, before altering Makefile, run:
250
251 .. code-block:: bash
252
253     $ make submodules-init patches-import
254
255 Non official build: Selecting which plugins to build
256 ----------------------------------------------------
257 In order to cut the build time for unofficial builds (made by an
258 individual developer locally), the selection if which Fuel plugins to
259 build (if any) can be done by environment variable
260 "BUILD_FUEL_PLUGINS" prior to building.
261
262 Only the plugin targets from
263 <armband/upstream/fuel/build/f_isoroot/Makefile> that are
264 specified in the environment variable will then be built. In order to
265 completely disable the building of plugins, the environment variable
266 is set to " ". When using this functionality, the resulting iso file
267 will be prepended with the prefix "unofficial-" to clearly indicate
268 that this is not a full build.
269
270 This method of plugin selection is not meant to be used from within
271 Gerrit!
272
273 Note! So far, only ODL plugin was ported to AArch64.
274
275 Building
276 ========
277
278 There is only one preffered method available for building Fuel for AArch64:
279
280 - A low level method using Make
281
282 Low level build method using make
283 ---------------------------------
284 The low level method is based on Make:
285
286 From the <armband> directory, invoke <make [target]>
287
288 Following targets exist:
289
290 - release - this will do the same as:
291
292   - make submodules-clean clean-docker clean-build
293
294   - make submodules-init patches-import build
295
296 - none/all/build - this will:
297
298   - Initialize the docker build environment
299
300   - Build Fuel from upstream (as defined by fuel-build/config-spec)
301
302   - Build the OPNFV defined plugins/features from upstream
303
304   - Build the defined additions to fuel (as defined by the structure
305     of this framework)
306
307   - Apply changes and patches to fuel (as defined by the structure of
308     this framework)
309
310   - Reconstruct a fuel .iso image
311
312 - submodules-init - Initialize git submodules (fuel@OPNFV, fuel-library etc.)
313
314 - submodules-clean - cleanup git submodules (fuel@OPNFV, fuel-library etc.)
315
316 - patches-import - this will apply armband@OPNFV patches to git submodules
317
318 - patches-export - this will export git submodules changes as armband patches
319
320 - clean-build - this will remove all artifacts from earlier builds.
321
322 - clean-docker - this will remove all docker caches from earlier builds.
323
324 If the build is successful, you will find the generated ISO file in
325 the <armband/upstream/fuel/build/release> subdirectory!
326
327 Artifacts
328 =========
329
330 The artifacts produced are:
331
332 - <OPNFV_XXXX.iso> - Which represents the bootable (x86_64) Fuel for AArch64
333   image, XXXX is replaced with the build identity provided to the build system
334
335 - <OPNFV_XXXX.iso.txt> - Which holds version metadata.
336
337 References
338 ==========
339
340 1)  `OPNFV Installation instruction for the Brahmaputra 3.0 release of OPNFV when using Fuel as a deployment tool <http://artifacts.opnfv.org/fuel/brahmaputra/docs/installation-instruction.html>`_
341
342 2) `OPNFV Build instruction for the Brahmaputra 3.0 release of OPNFV when using Fuel as a deployment tool <http://artifacts.opnfv.org/fuel/brahmaputra/docs/build-instruction.html>`_
343
344 3) `OPNFV Release Note for the Brahmaputra 3.0 release of OPNFV when using Fuel as a deployment tool <http://artifacts.opnfv.org/fuel/brahmaputra/docs/release-notes.html>`_
345
346 4)  `OPNFV Installation instruction for the AArch64 Brahmaputra 3.0 release of OPNFV when using Fuel as a deployment tool <http://artifacts.opnfv.org/armband/brahmaputra/docs/installation-instruction.html>`_
347
348 5) `OPNFV Build instruction for the AArch64 Brahmaputra 3.0 release of OPNFV when using Fuel as a deployment tool <http://artifacts.opnfv.org/armband/brahmaputra/docs/build-instruction.html>`_
349
350 6) `OPNFV Release Note for the AArch64 Brahmaputra 3.0 release of OPNFV when using Fuel as a deployment tool <http://artifacts.opnfv.org/armband/brahmaputra/docs/release-notes.html>`_