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