summaryrefslogtreecommitdiffstats
path: root/documentation/toaster-manual/toaster-manual-setup-and-use.rst
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/toaster-manual/toaster-manual-setup-and-use.rst')
-rw-r--r--documentation/toaster-manual/toaster-manual-setup-and-use.rst495
1 files changed, 495 insertions, 0 deletions
diff --git a/documentation/toaster-manual/toaster-manual-setup-and-use.rst b/documentation/toaster-manual/toaster-manual-setup-and-use.rst
new file mode 100644
index 0000000000..b36160b697
--- /dev/null
+++ b/documentation/toaster-manual/toaster-manual-setup-and-use.rst
@@ -0,0 +1,495 @@
1****************************
2Setting Up and Using Toaster
3****************************
4
5Starting Toaster for Local Development
6======================================
7
8Once you have set up the Yocto Project and installed the Toaster system
9dependencies as described in the "`Preparing to Use
10Toaster <#toaster-manual-start>`__" chapter, you are ready to start
11Toaster.
12
13Navigate to the root of your `Source
14Directory <&YOCTO_DOCS_REF_URL;#source-directory>`__ (e.g. ``poky``): $
15cd poky Once in that directory, source the build environment script: $
16source oe-init-build-env Next, from the build directory (e.g.
17``poky/build``), start Toaster using this command: $ source toaster
18start You can now run your builds from the command line, or with Toaster
19as explained in section "`Using the Toaster Web
20Interface <#using-the-toaster-web-interface>`__".
21
22To access the Toaster web interface, open your favorite browser and
23enter the following: http://127.0.0.1:8000
24
25Setting a Different Port
26========================
27
28By default, Toaster starts on port 8000. You can use the ``WEBPORT``
29parameter to set a different port. For example, the following command
30sets the port to "8400": $ source toaster start webport=8400
31
32Setting Up Toaster Without a Web Server
33=======================================
34
35You can start a Toaster environment without starting its web server.
36This is useful for the following:
37
38- Capturing a command-line build’s statistics into the Toaster database
39 for examination later.
40
41- Capturing a command-line build’s statistics when the Toaster server
42 is already running.
43
44- Having one instance of the Toaster web server track and capture
45 multiple command-line builds, where each build is started in its own
46 “noweb” Toaster environment.
47
48The following commands show how to start a Toaster environment without
49starting its web server, perform BitBake operations, and then shut down
50the Toaster environment. Once the build is complete, you can close the
51Toaster environment. Before closing the environment, however, you should
52allow a few minutes to ensure the complete transfer of its BitBake build
53statistics to the Toaster database. If you have a separate Toaster web
54server instance running, you can watch this command-line build’s
55progress and examine the results as soon as they are posted: $ source
56toaster start noweb $ bitbake target $ source toaster stop
57
58Setting Up Toaster Without a Build Server
59=========================================
60
61You can start a Toaster environment with the “New Projects” feature
62disabled. Doing so is useful for the following:
63
64- Sharing your build results over the web server while blocking others
65 from starting builds on your host.
66
67- Allowing only local command-line builds to be captured into the
68 Toaster database.
69
70Use the following command to set up Toaster without a build server: $
71source toaster start nobuild webport=port
72
73Setting up External Access
74==========================
75
76By default, Toaster binds to the loop back address (i.e. localhost),
77which does not allow access from external hosts. To allow external
78access, use the ``WEBPORT`` parameter to open an address that connects
79to the network, specifically the IP address that your NIC uses to
80connect to the network. You can also bind to all IP addresses the
81computer supports by using the shortcut "0.0.0.0:port".
82
83The following example binds to all IP addresses on the host: $ source
84toaster start webport=0.0.0.0:8400 This example binds to a specific IP
85address on the host's NIC: $ source toaster start
86webport=192.168.1.1:8400
87
88The Directory for Cloning Layers
89================================
90
91Toaster creates a ``_toaster_clones`` directory inside your Source
92Directory (i.e. ``poky``) to clone any layers needed for your builds.
93
94Alternatively, if you would like all of your Toaster related files and
95directories to be in a particular location other than the default, you
96can set the ``TOASTER_DIR`` environment variable, which takes precedence
97over your current working directory. Setting this environment variable
98causes Toaster to create and use ``$TOASTER_DIR./_toaster_clones``.
99
100.. _toaster-the-build-directory:
101
102The Build Directory
103===================
104
105Toaster creates a build directory within your Source Directory (e.g.
106``poky``) to execute the builds.
107
108Alternatively, if you would like all of your Toaster related files and
109directories to be in a particular location, you can set the
110``TOASTER_DIR`` environment variable, which takes precedence over your
111current working directory. Setting this environment variable causes
112Toaster to use ``$TOASTER_DIR/build`` as the build directory.
113
114.. _toaster-creating-a-django-super-user:
115
116Creating a Django Superuser
117===========================
118
119Toaster is built on the `Django
120framework <https://www.djangoproject.com/>`__. Django provides an
121administration interface you can use to edit Toaster configuration
122parameters.
123
124To access the Django administration interface, you must create a
125superuser by following these steps:
126
1271. If you used ``pip3``, which is recommended, to set up the Toaster
128 system dependencies, you need be sure the local user path is in your
129 ``PATH`` list. To append the pip3 local user path, use the following
130 command: $ export PATH=$PATH:$HOME/.local/bin
131
1322. From the directory containing the Toaster database, which by default
133 is the `Build Directory <&YOCTO_DOCS_REF_URL;#build-directory>`__,
134 invoke the ``createsuperuser`` command from ``manage.py``: $ cd
135 ~/poky/build $ ../bitbake/lib/toaster/manage.py createsuperuser
136
1373. Django prompts you for the username, which you need to provide.
138
1394. Django prompts you for an email address, which is optional.
140
1415. Django prompts you for a password, which you must provide.
142
1436. Django prompts you to re-enter your password for verification.
144
145After completing these steps, the following confirmation message
146appears: Superuser created successfully.
147
148Creating a superuser allows you to access the Django administration
149interface through a browser. The URL for this interface is the same as
150the URL used for the Toaster instance with "/admin" on the end. For
151example, if you are running Toaster locally, use the following URL:
152http://127.0.0.1:8000/admin You can use the Django administration
153interface to set Toaster configuration parameters such as the build
154directory, layer sources, default variable values, and BitBake versions.
155
156.. _toaster-setting-up-a-production-instance-of-toaster:
157
158Setting Up a Production Instance of Toaster
159===========================================
160
161You can use a production instance of Toaster to share the Toaster
162instance with remote users, multiple users, or both. The production
163instance is also the setup that can handle heavier loads on the web
164service. Use the instructions in the following sections to set up
165Toaster to run builds through the Toaster web interface.
166
167.. _toaster-production-instance-requirements:
168
169Requirements
170------------
171
172Be sure you meet the following requirements:
173
174.. note::
175
176 You must comply with all Apache,
177 mod-wsgi
178 , and Mysql requirements.
179
180- Have all the build requirements as described in the "`Preparing to
181 Use Toaster <#toaster-manual-start>`__" chapter.
182
183- Have an Apache webserver.
184
185- Have ``mod-wsgi`` for the Apache webserver.
186
187- Use the Mysql database server.
188
189- If you are using Ubuntu 16.04, run the following: $ sudo apt-get
190 install apache2 libapache2-mod-wsgi-py3 mysql-server python3-pip
191 libmysqlclient-dev
192
193- If you are using Fedora 24 or a RedHat distribution, run the
194 following: $ sudo dnf install httpd python3-mod_wsgi python3-pip
195 mariadb-server mariadb-devel python3-devel
196
197- If you are using openSUSE Leap 42.1, run the following: $ sudo zypper
198 install apache2 apache2-mod_wsgi-python3 python3-pip mariadb
199 mariadb-client python3-devel
200
201.. _toaster-installation-steps:
202
203Installation
204------------
205
206Perform the following steps to install Toaster:
207
2081. Create toaster user and set its home directory to
209 ``/var/www/toaster``: $ sudo /usr/sbin/useradd toaster -md
210 /var/www/toaster -s /bin/false $ sudo su - toaster -s /bin/bash
211
2122. Checkout a copy of ``poky`` into the web server directory. You will
213 be using ``/var/www/toaster``: $ git clone
214 git://git.yoctoproject.org/poky $ git checkout DISTRO_NAME_NO_CAP
215
2163. Install Toaster dependencies using the --user flag which keeps the
217 Python packages isolated from your system-provided packages: $ cd
218 /var/www/toaster/ $ pip3 install --user -r
219 ./poky/bitbake/toaster-requirements.txt $ pip3 install --user
220 mysqlclient
221
222 .. note::
223
224 Isolating these packages is not required but is recommended.
225 Alternatively, you can use your operating system's package
226 manager to install the packages.
227
2284. Configure Toaster by editing
229 ``/var/www/toaster/poky/bitbake/lib/toaster/toastermain/settings.py``
230 as follows:
231
232 - Edit the
233 `DATABASES <https://docs.djangoproject.com/en/1.11/ref/settings/#databases>`__
234 settings: DATABASES = { 'default': { 'ENGINE':
235 'django.db.backends.mysql', 'NAME': 'toaster_data', 'USER':
236 'toaster', 'PASSWORD': 'yourpasswordhere', 'HOST': 'localhost',
237 'PORT': '3306', } }
238
239 - Edit the
240 `SECRET_KEY <https://docs.djangoproject.com/en/1.11/ref/settings/#std:setting-SECRET_KEY>`__:
241 SECRET_KEY = 'your_secret_key'
242
243 - Edit the
244 `STATIC_ROOT <https://docs.djangoproject.com/en/1.11/ref/settings/#std:setting-STATIC_ROOT>`__:
245 STATIC_ROOT = '/var/www/toaster/static_files/'
246
2475. Add the database and user to the ``mysql`` server defined earlier: $
248 mysql -u root -p mysql> CREATE DATABASE toaster_data; mysql> CREATE
249 USER 'toaster'@'localhost' identified by 'yourpasswordhere'; mysql>
250 GRANT all on toaster_data.\* to 'toaster'@'localhost'; mysql> quit
251
2526. Get Toaster to create the database schema, default data, and gather
253 the statically-served files: $ cd /var/www/toaster/poky/ $
254 ./bitbake/lib/toaster/manage.py migrate $ TOASTER_DIR=`pwd\`
255 TEMPLATECONF='poky' \\ ./bitbake/lib/toaster/manage.py checksettings
256 $ ./bitbake/lib/toaster/manage.py collectstatic In the previous
257 example, from the ``poky`` directory, the ``migrate`` command
258 ensures the database schema changes have propagated correctly (i.e.
259 migrations). The next line sets the Toaster root directory
260 ``TOASTER_DIR`` and the location of the Toaster configuration file
261 ``TOASTER_CONF``, which is relative to ``TOASTER_DIR``. The
262 ``TEMPLATECONF`` value reflects the contents of
263 ``poky/.templateconf``, and by default, should include the string
264 "poky". For more information on the Toaster configuration file, see
265 the "`Configuring Toaster <#configuring-toaster>`__" section.
266
267 This line also runs the ``checksettings`` command, which configures
268 the location of the Toaster `Build
269 Directory <&YOCTO_DOCS_REF_URL;#build-directory>`__. The Toaster
270 root directory ``TOASTER_DIR`` determines where the Toaster build
271 directory is created on the file system. In the example above,
272 ``TOASTER_DIR`` is set as follows: /var/www/toaster/poky This
273 setting causes the Toaster build directory to be:
274 /var/www/toaster/poky/build
275
276 Finally, the ``collectstatic`` command is a Django framework command
277 that collects all the statically served files into a designated
278 directory to be served up by the Apache web server as defined by
279 ``STATIC_ROOT``.
280
2817. Test and/or use the Mysql integration with Toaster’s Django web
282 server. At this point, you can start up the normal Toaster Django
283 web server with the Toaster database in Mysql. You can use this web
284 server to confirm that the database migration and data population
285 from the Layer Index is complete.
286
287 To start the default Toaster Django web server with the Toaster
288 database now in Mysql, use the standard start commands: $ source
289 oe-init-build-env $ source toaster start Additionally, if Django is
290 sufficient for your requirements, you can use it for your release
291 system and migrate later to Apache as your requirements change.
292
2938. Add an Apache configuration file for Toaster to your Apache web
294 server's configuration directory. If you are using Ubuntu or Debian,
295 put the file here: /etc/apache2/conf-available/toaster.conf If you
296 are using Fedora or RedHat, put it here:
297 /etc/httpd/conf.d/toaster.conf If you are using OpenSUSE, put it
298 here: /etc/apache2/conf.d/toaster.conf Following is a sample Apache
299 configuration for Toaster you can follow: Alias /static
300 /var/www/toaster/static_files <Directory
301 /var/www/toaster/static_files> <IfModule mod_access_compat.c> Order
302 allow,deny Allow from all </IfModule> <IfModule
303 !mod_access_compat.c> Require all granted </IfModule> </Directory>
304 <Directory /var/www/toaster/poky/bitbake/lib/toaster/toastermain>
305 <Files "wsgi.py"> Require all granted </Files> </Directory>
306 WSGIDaemonProcess toaster_wsgi
307 python-path=/var/www/toaster/poky/bitbake/lib/toaster:/var/www/toaster/.local/lib/python3.4/site-packages
308 WSGIScriptAlias /
309 "/var/www/toaster/poky/bitbake/lib/toaster/toastermain/wsgi.py"
310 <Location /> WSGIProcessGroup toaster_wsgi </Location> If you are
311 using Ubuntu or Debian, you will need to enable the config and
312 module for Apache: $ sudo a2enmod wsgi $ sudo a2enconf toaster $
313 chmod +x bitbake/lib/toaster/toastermain/wsgi.py Finally, restart
314 Apache to make sure all new configuration is loaded. For Ubuntu,
315 Debian, and OpenSUSE use: $ sudo service apache2 restart For Fedora
316 and RedHat use: $ sudo service httpd restart
317
3189. Prepare the systemd service to run Toaster builds. Here is a sample
319 configuration file for the service: [Unit] Description=Toaster
320 runbuilds [Service] Type=forking User=toaster
321 ExecStart=/usr/bin/screen -d -m -S runbuilds
322 /var/www/toaster/poky/bitbake/lib/toaster/runbuilds-service.sh start
323 ExecStop=/usr/bin/screen -S runbuilds -X quit
324 WorkingDirectory=/var/www/toaster/poky [Install]
325 WantedBy=multi-user.target Prepare the ``runbuilds-service.sh``
326 script that you need to place in the
327 ``/var/www/toaster/poky/bitbake/lib/toaster/`` directory by setting
328 up executable permissions: #!/bin/bash #export
329 http_proxy=http://proxy.host.com:8080 #export
330 https_proxy=http://proxy.host.com:8080 #export
331 GIT_PROXY_COMMAND=$HOME/bin/gitproxy cd ~/poky/ source
332 ./oe-init-build-env build source ../bitbake/bin/toaster $1 noweb [
333 "$1" == 'start' ] && /bin/bash
334
33510. Run the service: # service runbuilds start Since the service is
336 running in a detached screen session, you can attach to it using
337 this command: $ sudo su - toaster $ screen -rS runbuilds You can
338 detach from the service again using "Ctrl-a" followed by "d" key
339 combination.
340
341You can now open up a browser and start using Toaster.
342
343Using the Toaster Web Interface
344===============================
345
346The Toaster web interface allows you to do the following:
347
348- Browse published layers in the `OpenEmbedded Layer
349 Index <http://layers.openembedded.org>`__ that are available for your
350 selected version of the build system.
351
352- Import your own layers for building.
353
354- Add and remove layers from your configuration.
355
356- Set configuration variables.
357
358- Select a target or multiple targets to build.
359
360- Start your builds.
361
362- See what was built (recipes and packages) and what packages were
363 installed into your final image.
364
365- Browse the directory structure of your image.
366
367- See the value of all variables in your build configuration, and which
368 files set each value.
369
370- Examine error, warning and trace messages to aid in debugging.
371
372- See information about the BitBake tasks executed and reused during
373 your build, including those that used shared state.
374
375- See dependency relationships between recipes, packages and tasks.
376
377- See performance information such as build time, task time, CPU usage,
378 and disk I/O.
379
380.. _web-interface-videos:
381
382Toaster Web Interface Videos
383----------------------------
384
385Following are several videos that show how to use the Toaster GUI:
386
387- *Build Configuration:* This
388 `video <https://www.youtube.com/watch?v=qYgDZ8YzV6w>`__ overviews and
389 demonstrates build configuration for Toaster.
390
391- *Build Custom Layers:* This
392 `video <https://www.youtube.com/watch?v=QJzaE_XjX5c>`__ shows you how
393 to build custom layers that are used with Toaster.
394
395- *Toaster Homepage and Table Controls:* This
396 `video <https://www.youtube.com/watch?v=QEARDnrR1Xw>`__ goes over the
397 Toaster entry page, and provides an overview of the data manipulation
398 capabilities of Toaster, which include search, sorting and filtering
399 by different criteria.
400
401- *Build Dashboard:* This
402 `video <https://www.youtube.com/watch?v=KKqHYcnp2gE>`__ shows you the
403 build dashboard, a page providing an overview of the information
404 available for a selected build.
405
406- *Image Information:* This
407 `video <https://www.youtube.com/watch?v=XqYGFsmA0Rw>`__ walks through
408 the information Toaster provides about images: packages installed and
409 root file system.
410
411- *Configuration:* This
412 `video <https://www.youtube.com/watch?v=UW-j-T2TzIg>`__ provides
413 Toaster build configuration information.
414
415- *Tasks:* This `video <https://www.youtube.com/watch?v=D4-9vGSxQtw>`__
416 shows the information Toaster provides about the tasks run by the
417 build system.
418
419- *Recipes and Packages Built:* This
420 `video <https://www.youtube.com/watch?v=x-6dx4huNnw>`__ shows the
421 information Toaster provides about recipes and packages built.
422
423- *Performance Data:* This
424 `video <https://www.youtube.com/watch?v=qWGMrJoqusQ>`__ shows the
425 build performance data provided by Toaster.
426
427.. _a-note-on-the-local-yocto-project-release:
428
429Additional Information About the Local Yocto Project Release
430------------------------------------------------------------
431
432This section only applies if you have set up Toaster for local
433development, as explained in the "`Starting Toaster for Local
434Development <#starting-toaster-for-local-development>`__" section.
435
436When you create a project in Toaster, you will be asked to provide a
437name and to select a Yocto Project release. One of the release options
438you will find is called "Local Yocto Project".
439
440When you select the "Local Yocto Project" release, Toaster will run your
441builds using the local Yocto Project clone you have in your computer:
442the same clone you are using to run Toaster. Unless you manually update
443this clone, your builds will always use the same Git revision.
444
445If you select any of the other release options, Toaster will fetch the
446tip of your selected release from the upstream `Yocto Project
447repository <https://git.yoctoproject.org>`__ every time you run a build.
448Fetching this tip effectively means that if your selected release is
449updated upstream, the Git revision you are using for your builds will
450change. If you are doing development locally, you might not want this
451change to happen. In that case, the "Local Yocto Project" release might
452be the right choice.
453
454However, the "Local Yocto Project" release will not provide you with any
455compatible layers, other than the three core layers that come with the
456Yocto Project:
457
458- `openembedded-core <http://layers.openembedded.org/layerindex/branch/master/layer/openembedded-core/>`__
459
460- `meta-poky <http://layers.openembedded.org/layerindex/branch/master/layer/meta-poky/>`__
461
462- `meta-yocto-bsp <http://layers.openembedded.org/layerindex/branch/master/layer/meta-yocto-bsp/>`__
463
464If you want to build any other layers, you will need to manually import
465them into your Toaster project, using the "Import layer" page.
466
467.. _toaster-web-interface-preferred-version:
468
469Building a Specific Recipe Given Multiple Versions
470--------------------------------------------------
471
472Occasionally, a layer might provide more than one version of the same
473recipe. For example, the ``openembedded-core`` layer provides two
474versions of the ``bash`` recipe (i.e. 3.2.48 and 4.3.30-r0) and two
475versions of the ``which`` recipe (i.e. 2.21 and 2.18). The following
476figure shows this exact scenario:
477
478By default, the OpenEmbedded build system builds one of the two recipes.
479For the ``bash`` case, version 4.3.30-r0 is built by default.
480Unfortunately, Toaster as it exists, is not able to override the default
481recipe version. If you would like to build bash 3.2.48, you need to set
482the
483```PREFERRED_VERSION`` <&YOCTO_DOCS_REF_URL;#var-PREFERRED_VERSION>`__
484variable. You can do so from Toaster, using the "Add variable" form,
485which is available in the "BitBake variables" page of the project
486configuration section as shown in the following screen:
487
488To specify ``bash`` 3.2.48 as the version to build, enter
489"PREFERRED_VERSION_bash" in the "Variable" field, and "3.2.48" in the
490"Value" field. Next, click the "Add variable" button:
491
492After clicking the "Add variable" button, the settings for
493``PREFERRED_VERSION`` are added to the bottom of the BitBake variables
494list. With these settings, the OpenEmbedded build system builds the
495desired version of the recipe rather than the default version: