xref: /OK3568_Linux_fs/yocto/poky/documentation/toaster-manual/setup-and-use.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
2*4882a593Smuzhiyun.. Set default pygment highlighting to 'shell' for this document
3*4882a593Smuzhiyun.. highlight:: shell
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun****************************
6*4882a593SmuzhiyunSetting Up and Using Toaster
7*4882a593Smuzhiyun****************************
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunStarting Toaster for Local Development
10*4882a593Smuzhiyun======================================
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunOnce you have set up the Yocto Project and installed the Toaster system
13*4882a593Smuzhiyundependencies as described in the ":ref:`toaster-manual/start:Preparing to Use
14*4882a593SmuzhiyunToaster`" chapter, you are ready to start
15*4882a593SmuzhiyunToaster.
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunNavigate to the root of your
18*4882a593Smuzhiyun:term:`Source Directory` (e.g. ``poky``)::
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun   $ cd poky
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunOnce in that directory, source the build environment script::
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun   $ source oe-init-build-env
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunNext, from the build directory (e.g.
27*4882a593Smuzhiyun``poky/build``), start Toaster using this command::
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun   $ source toaster start
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunYou can now run your builds from the command line, or with Toaster
32*4882a593Smuzhiyunas explained in section
33*4882a593Smuzhiyun":ref:`toaster-manual/setup-and-use:using the toaster web interface`".
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunTo access the Toaster web interface, open your favorite browser and
36*4882a593Smuzhiyunenter the following::
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun   http://127.0.0.1:8000
39*4882a593Smuzhiyun
40*4882a593SmuzhiyunSetting a Different Port
41*4882a593Smuzhiyun========================
42*4882a593Smuzhiyun
43*4882a593SmuzhiyunBy default, Toaster starts on port 8000. You can use the ``WEBPORT``
44*4882a593Smuzhiyunparameter to set a different port. For example, the following command
45*4882a593Smuzhiyunsets the port to "8400"::
46*4882a593Smuzhiyun
47*4882a593Smuzhiyun   $ source toaster start webport=8400
48*4882a593Smuzhiyun
49*4882a593SmuzhiyunSetting Up Toaster Without a Web Server
50*4882a593Smuzhiyun=======================================
51*4882a593Smuzhiyun
52*4882a593SmuzhiyunYou can start a Toaster environment without starting its web server.
53*4882a593SmuzhiyunThis is useful for the following:
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun-  Capturing a command-line build's statistics into the Toaster database
56*4882a593Smuzhiyun   for examination later.
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun-  Capturing a command-line build's statistics when the Toaster server
59*4882a593Smuzhiyun   is already running.
60*4882a593Smuzhiyun
61*4882a593Smuzhiyun-  Having one instance of the Toaster web server track and capture
62*4882a593Smuzhiyun   multiple command-line builds, where each build is started in its own
63*4882a593Smuzhiyun   "noweb" Toaster environment.
64*4882a593Smuzhiyun
65*4882a593SmuzhiyunThe following commands show how to start a Toaster environment without
66*4882a593Smuzhiyunstarting its web server, perform BitBake operations, and then shut down
67*4882a593Smuzhiyunthe Toaster environment. Once the build is complete, you can close the
68*4882a593SmuzhiyunToaster environment. Before closing the environment, however, you should
69*4882a593Smuzhiyunallow a few minutes to ensure the complete transfer of its BitBake build
70*4882a593Smuzhiyunstatistics to the Toaster database. If you have a separate Toaster web
71*4882a593Smuzhiyunserver instance running, you can watch this command-line build's
72*4882a593Smuzhiyunprogress and examine the results as soon as they are posted::
73*4882a593Smuzhiyun
74*4882a593Smuzhiyun   $ source toaster start noweb
75*4882a593Smuzhiyun   $ bitbake target
76*4882a593Smuzhiyun   $ source toaster stop
77*4882a593Smuzhiyun
78*4882a593SmuzhiyunSetting Up Toaster Without a Build Server
79*4882a593Smuzhiyun=========================================
80*4882a593Smuzhiyun
81*4882a593SmuzhiyunYou can start a Toaster environment with the "New Projects" feature
82*4882a593Smuzhiyundisabled. Doing so is useful for the following:
83*4882a593Smuzhiyun
84*4882a593Smuzhiyun-  Sharing your build results over the web server while blocking others
85*4882a593Smuzhiyun   from starting builds on your host.
86*4882a593Smuzhiyun
87*4882a593Smuzhiyun-  Allowing only local command-line builds to be captured into the
88*4882a593Smuzhiyun   Toaster database.
89*4882a593Smuzhiyun
90*4882a593SmuzhiyunUse the following command to set up Toaster without a build server::
91*4882a593Smuzhiyun
92*4882a593Smuzhiyun   $ source toaster start nobuild webport=port
93*4882a593Smuzhiyun
94*4882a593SmuzhiyunSetting up External Access
95*4882a593Smuzhiyun==========================
96*4882a593Smuzhiyun
97*4882a593SmuzhiyunBy default, Toaster binds to the loop back address (i.e. ``localhost``),
98*4882a593Smuzhiyunwhich does not allow access from external hosts. To allow external
99*4882a593Smuzhiyunaccess, use the ``WEBPORT`` parameter to open an address that connects
100*4882a593Smuzhiyunto the network, specifically the IP address that your NIC uses to
101*4882a593Smuzhiyunconnect to the network. You can also bind to all IP addresses the
102*4882a593Smuzhiyuncomputer supports by using the shortcut "0.0.0.0:port".
103*4882a593Smuzhiyun
104*4882a593SmuzhiyunThe following example binds to all IP addresses on the host::
105*4882a593Smuzhiyun
106*4882a593Smuzhiyun   $ source toaster start webport=0.0.0.0:8400
107*4882a593Smuzhiyun
108*4882a593SmuzhiyunThis example binds to a specific IP address on the host's NIC::
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun   $ source toaster start webport=192.168.1.1:8400
111*4882a593Smuzhiyun
112*4882a593SmuzhiyunThe Directory for Cloning Layers
113*4882a593Smuzhiyun================================
114*4882a593Smuzhiyun
115*4882a593SmuzhiyunToaster creates a ``_toaster_clones`` directory inside your Source
116*4882a593SmuzhiyunDirectory (i.e. ``poky``) to clone any layers needed for your builds.
117*4882a593Smuzhiyun
118*4882a593SmuzhiyunAlternatively, if you would like all of your Toaster related files and
119*4882a593Smuzhiyundirectories to be in a particular location other than the default, you
120*4882a593Smuzhiyuncan set the ``TOASTER_DIR`` environment variable, which takes precedence
121*4882a593Smuzhiyunover your current working directory. Setting this environment variable
122*4882a593Smuzhiyuncauses Toaster to create and use ``$TOASTER_DIR./_toaster_clones``.
123*4882a593Smuzhiyun
124*4882a593SmuzhiyunThe Build Directory
125*4882a593Smuzhiyun===================
126*4882a593Smuzhiyun
127*4882a593SmuzhiyunToaster creates a build directory within your Source Directory (e.g.
128*4882a593Smuzhiyun``poky``) to execute the builds.
129*4882a593Smuzhiyun
130*4882a593SmuzhiyunAlternatively, if you would like all of your Toaster related files and
131*4882a593Smuzhiyundirectories to be in a particular location, you can set the
132*4882a593Smuzhiyun``TOASTER_DIR`` environment variable, which takes precedence over your
133*4882a593Smuzhiyuncurrent working directory. Setting this environment variable causes
134*4882a593SmuzhiyunToaster to use ``$TOASTER_DIR/build`` as the build directory.
135*4882a593Smuzhiyun
136*4882a593SmuzhiyunCreating a Django Superuser
137*4882a593Smuzhiyun===========================
138*4882a593Smuzhiyun
139*4882a593SmuzhiyunToaster is built on the `Django
140*4882a593Smuzhiyunframework <https://www.djangoproject.com/>`__. Django provides an
141*4882a593Smuzhiyunadministration interface you can use to edit Toaster configuration
142*4882a593Smuzhiyunparameters.
143*4882a593Smuzhiyun
144*4882a593SmuzhiyunTo access the Django administration interface, you must create a
145*4882a593Smuzhiyunsuperuser by following these steps:
146*4882a593Smuzhiyun
147*4882a593Smuzhiyun#. If you used ``pip3``, which is recommended, to set up the Toaster
148*4882a593Smuzhiyun   system dependencies, you need be sure the local user path is in your
149*4882a593Smuzhiyun   ``PATH`` list. To append the pip3 local user path, use the following
150*4882a593Smuzhiyun   command::
151*4882a593Smuzhiyun
152*4882a593Smuzhiyun      $ export PATH=$PATH:$HOME/.local/bin
153*4882a593Smuzhiyun
154*4882a593Smuzhiyun#. From the directory containing the Toaster database, which by default
155*4882a593Smuzhiyun   is the :term:`Build Directory`,
156*4882a593Smuzhiyun   invoke the ``createsuperuser`` command from ``manage.py``::
157*4882a593Smuzhiyun
158*4882a593Smuzhiyun      $ cd poky/build
159*4882a593Smuzhiyun      $ ../bitbake/lib/toaster/manage.py createsuperuser
160*4882a593Smuzhiyun
161*4882a593Smuzhiyun#. Django prompts you for the username, which you need to provide.
162*4882a593Smuzhiyun
163*4882a593Smuzhiyun#. Django prompts you for an email address, which is optional.
164*4882a593Smuzhiyun
165*4882a593Smuzhiyun#. Django prompts you for a password, which you must provide.
166*4882a593Smuzhiyun
167*4882a593Smuzhiyun#. Django prompts you to re-enter your password for verification.
168*4882a593Smuzhiyun
169*4882a593SmuzhiyunAfter completing these steps, the following confirmation message
170*4882a593Smuzhiyunappears::
171*4882a593Smuzhiyun
172*4882a593Smuzhiyun   Superuser created successfully.
173*4882a593Smuzhiyun
174*4882a593SmuzhiyunCreating a superuser allows you to access the Django administration
175*4882a593Smuzhiyuninterface through a browser. The URL for this interface is the same as
176*4882a593Smuzhiyunthe URL used for the Toaster instance with "/admin" on the end. For
177*4882a593Smuzhiyunexample, if you are running Toaster locally, use the following URL::
178*4882a593Smuzhiyun
179*4882a593Smuzhiyun   http://127.0.0.1:8000/admin
180*4882a593Smuzhiyun
181*4882a593SmuzhiyunYou can use the Django administration interface to set Toaster configuration
182*4882a593Smuzhiyunparameters such as the build directory, layer sources, default variable
183*4882a593Smuzhiyunvalues, and BitBake versions.
184*4882a593Smuzhiyun
185*4882a593SmuzhiyunSetting Up a Production Instance of Toaster
186*4882a593Smuzhiyun===========================================
187*4882a593Smuzhiyun
188*4882a593SmuzhiyunYou can use a production instance of Toaster to share the Toaster
189*4882a593Smuzhiyuninstance with remote users, multiple users, or both. The production
190*4882a593Smuzhiyuninstance is also the setup that can handle heavier loads on the web
191*4882a593Smuzhiyunservice. Use the instructions in the following sections to set up
192*4882a593SmuzhiyunToaster to run builds through the Toaster web interface.
193*4882a593Smuzhiyun
194*4882a593SmuzhiyunRequirements
195*4882a593Smuzhiyun------------
196*4882a593Smuzhiyun
197*4882a593SmuzhiyunBe sure you meet the following requirements:
198*4882a593Smuzhiyun
199*4882a593Smuzhiyun.. note::
200*4882a593Smuzhiyun
201*4882a593Smuzhiyun   You must comply with all Apache, ``mod-wsgi``, and Mysql requirements.
202*4882a593Smuzhiyun
203*4882a593Smuzhiyun-  Have all the build requirements as described in the ":ref:`toaster-manual/start:Preparing to
204*4882a593Smuzhiyun   Use Toaster`" chapter.
205*4882a593Smuzhiyun
206*4882a593Smuzhiyun-  Have an Apache webserver.
207*4882a593Smuzhiyun
208*4882a593Smuzhiyun-  Have ``mod-wsgi`` for the Apache webserver.
209*4882a593Smuzhiyun
210*4882a593Smuzhiyun-  Use the Mysql database server.
211*4882a593Smuzhiyun
212*4882a593Smuzhiyun-  If you are using Ubuntu, run the following::
213*4882a593Smuzhiyun
214*4882a593Smuzhiyun      $ sudo apt install apache2 libapache2-mod-wsgi-py3 mysql-server python3-pip libmysqlclient-dev
215*4882a593Smuzhiyun
216*4882a593Smuzhiyun-  If you are using Fedora or a RedHat distribution, run the
217*4882a593Smuzhiyun   following::
218*4882a593Smuzhiyun
219*4882a593Smuzhiyun      $ sudo dnf install httpd python3-mod_wsgi python3-pip mariadb-server mariadb-devel python3-devel
220*4882a593Smuzhiyun
221*4882a593Smuzhiyun-  If you are using openSUSE, run the following::
222*4882a593Smuzhiyun
223*4882a593Smuzhiyun      $ sudo zypper install apache2 apache2-mod_wsgi-python3 python3-pip mariadb mariadb-client python3-devel
224*4882a593Smuzhiyun
225*4882a593SmuzhiyunInstallation
226*4882a593Smuzhiyun------------
227*4882a593Smuzhiyun
228*4882a593SmuzhiyunPerform the following steps to install Toaster:
229*4882a593Smuzhiyun
230*4882a593Smuzhiyun#.  Create toaster user and set its home directory to
231*4882a593Smuzhiyun    ``/var/www/toaster``::
232*4882a593Smuzhiyun
233*4882a593Smuzhiyun      $ sudo /usr/sbin/useradd toaster -md /var/www/toaster -s /bin/false
234*4882a593Smuzhiyun      $ sudo su - toaster -s /bin/bash
235*4882a593Smuzhiyun
236*4882a593Smuzhiyun#.  Checkout a copy of ``poky`` into the web server directory. You will
237*4882a593Smuzhiyun    be using ``/var/www/toaster``::
238*4882a593Smuzhiyun
239*4882a593Smuzhiyun      $ git clone git://git.yoctoproject.org/poky
240*4882a593Smuzhiyun      $ git checkout &DISTRO_NAME_NO_CAP;
241*4882a593Smuzhiyun
242*4882a593Smuzhiyun#.  Install Toaster dependencies using the ``--user`` flag which keeps the
243*4882a593Smuzhiyun    Python packages isolated from your system-provided packages::
244*4882a593Smuzhiyun
245*4882a593Smuzhiyun      $ cd /var/www/toaster/
246*4882a593Smuzhiyun      $ pip3 install --user -r ./poky/bitbake/toaster-requirements.txt
247*4882a593Smuzhiyun      $ pip3 install --user mysqlclient
248*4882a593Smuzhiyun
249*4882a593Smuzhiyun    .. note::
250*4882a593Smuzhiyun
251*4882a593Smuzhiyun       Isolating these packages is not required but is recommended.
252*4882a593Smuzhiyun       Alternatively, you can use your operating system's package
253*4882a593Smuzhiyun       manager to install the packages.
254*4882a593Smuzhiyun
255*4882a593Smuzhiyun#.  Configure Toaster by editing
256*4882a593Smuzhiyun    ``/var/www/toaster/poky/bitbake/lib/toaster/toastermain/settings.py``
257*4882a593Smuzhiyun    as follows:
258*4882a593Smuzhiyun
259*4882a593Smuzhiyun    -  Edit the
260*4882a593Smuzhiyun       `DATABASES <https://docs.djangoproject.com/en/2.2/ref/settings/#databases>`__
261*4882a593Smuzhiyun       settings:
262*4882a593Smuzhiyun
263*4882a593Smuzhiyun       .. code-block:: python
264*4882a593Smuzhiyun
265*4882a593Smuzhiyun         DATABASES = {
266*4882a593Smuzhiyun            'default': {
267*4882a593Smuzhiyun               'ENGINE': 'django.db.backends.mysql',
268*4882a593Smuzhiyun               'NAME': 'toaster_data',
269*4882a593Smuzhiyun               'USER': 'toaster',
270*4882a593Smuzhiyun               'PASSWORD': 'yourpasswordhere',
271*4882a593Smuzhiyun               'HOST': 'localhost',
272*4882a593Smuzhiyun               'PORT': '3306',
273*4882a593Smuzhiyun            }
274*4882a593Smuzhiyun         }
275*4882a593Smuzhiyun
276*4882a593Smuzhiyun    -  Edit the
277*4882a593Smuzhiyun       `SECRET_KEY <https://docs.djangoproject.com/en/2.2/ref/settings/#std:setting-SECRET_KEY>`__:
278*4882a593Smuzhiyun
279*4882a593Smuzhiyun       .. code-block:: python
280*4882a593Smuzhiyun
281*4882a593Smuzhiyun         SECRET_KEY = 'your_secret_key'
282*4882a593Smuzhiyun
283*4882a593Smuzhiyun    -  Edit the
284*4882a593Smuzhiyun       `STATIC_ROOT <https://docs.djangoproject.com/en/2.2/ref/settings/#std:setting-STATIC_ROOT>`__:
285*4882a593Smuzhiyun
286*4882a593Smuzhiyun      .. code-block:: python
287*4882a593Smuzhiyun
288*4882a593Smuzhiyun         STATIC_ROOT = '/var/www/toaster/static_files/'
289*4882a593Smuzhiyun
290*4882a593Smuzhiyun#.  Add the database and user to the ``mysql`` server defined earlier::
291*4882a593Smuzhiyun
292*4882a593Smuzhiyun      $ mysql -u root -p
293*4882a593Smuzhiyun      mysql> CREATE DATABASE toaster_data;
294*4882a593Smuzhiyun      mysql> CREATE USER 'toaster'@'localhost' identified by 'yourpasswordhere';
295*4882a593Smuzhiyun      mysql> GRANT all on toaster_data.\* to 'toaster'@'localhost';
296*4882a593Smuzhiyun      mysql> quit
297*4882a593Smuzhiyun
298*4882a593Smuzhiyun#.  Get Toaster to create the database schema, default data, and gather
299*4882a593Smuzhiyun    the statically-served files::
300*4882a593Smuzhiyun
301*4882a593Smuzhiyun      $ cd /var/www/toaster/poky/
302*4882a593Smuzhiyun      $ ./bitbake/lib/toaster/manage.py migrate
303*4882a593Smuzhiyun      $ TOASTER_DIR=`pwd\` TEMPLATECONF='poky' \
304*4882a593Smuzhiyun         ./bitbake/lib/toaster/manage.py checksettings
305*4882a593Smuzhiyun      $ ./bitbake/lib/toaster/manage.py collectstatic
306*4882a593Smuzhiyun
307*4882a593Smuzhiyun
308*4882a593Smuzhiyun    In the previous
309*4882a593Smuzhiyun    example, from the ``poky`` directory, the ``migrate`` command
310*4882a593Smuzhiyun    ensures the database schema changes have propagated correctly (i.e.
311*4882a593Smuzhiyun    migrations). The next line sets the Toaster root directory
312*4882a593Smuzhiyun    ``TOASTER_DIR`` and the location of the Toaster configuration file
313*4882a593Smuzhiyun    ``TOASTER_CONF``, which is relative to ``TOASTER_DIR``. The
314*4882a593Smuzhiyun    ``TEMPLATECONF`` value reflects the contents of
315*4882a593Smuzhiyun    ``poky/.templateconf``, and by default, should include the string
316*4882a593Smuzhiyun    "poky". For more information on the Toaster configuration file, see
317*4882a593Smuzhiyun    the ":ref:`toaster-manual/reference:Configuring Toaster`" section.
318*4882a593Smuzhiyun
319*4882a593Smuzhiyun    This line also runs the ``checksettings`` command, which configures
320*4882a593Smuzhiyun    the location of the Toaster :term:`Build Directory`.
321*4882a593Smuzhiyun    The Toaster
322*4882a593Smuzhiyun    root directory ``TOASTER_DIR`` determines where the Toaster build
323*4882a593Smuzhiyun    directory is created on the file system. In the example above,
324*4882a593Smuzhiyun    ``TOASTER_DIR`` is set as follows::
325*4882a593Smuzhiyun
326*4882a593Smuzhiyun       /var/www/toaster/poky
327*4882a593Smuzhiyun
328*4882a593Smuzhiyun
329*4882a593Smuzhiyun    This setting causes the Toaster build directory to be::
330*4882a593Smuzhiyun
331*4882a593Smuzhiyun       /var/www/toaster/poky/build
332*4882a593Smuzhiyun
333*4882a593Smuzhiyun    Finally, the ``collectstatic`` command is a Django framework command
334*4882a593Smuzhiyun    that collects all the statically served files into a designated
335*4882a593Smuzhiyun    directory to be served up by the Apache web server as defined by
336*4882a593Smuzhiyun    ``STATIC_ROOT``.
337*4882a593Smuzhiyun
338*4882a593Smuzhiyun#.  Test and/or use the Mysql integration with Toaster's Django web
339*4882a593Smuzhiyun    server. At this point, you can start up the normal Toaster Django
340*4882a593Smuzhiyun    web server with the Toaster database in Mysql. You can use this web
341*4882a593Smuzhiyun    server to confirm that the database migration and data population
342*4882a593Smuzhiyun    from the Layer Index is complete.
343*4882a593Smuzhiyun
344*4882a593Smuzhiyun    To start the default Toaster Django web server with the Toaster
345*4882a593Smuzhiyun    database now in Mysql, use the standard start commands::
346*4882a593Smuzhiyun
347*4882a593Smuzhiyun      $ source oe-init-build-env
348*4882a593Smuzhiyun      $ source toaster start
349*4882a593Smuzhiyun
350*4882a593Smuzhiyun    Additionally, if Django is sufficient for your requirements, you can use
351*4882a593Smuzhiyun    it for your release system and migrate later to Apache as your
352*4882a593Smuzhiyun    requirements change.
353*4882a593Smuzhiyun
354*4882a593Smuzhiyun#.  Add an Apache configuration file for Toaster to your Apache web
355*4882a593Smuzhiyun    server's configuration directory. If you are using Ubuntu or Debian,
356*4882a593Smuzhiyun    put the file here::
357*4882a593Smuzhiyun
358*4882a593Smuzhiyun      /etc/apache2/conf-available/toaster.conf
359*4882a593Smuzhiyun
360*4882a593Smuzhiyun
361*4882a593Smuzhiyun    If you are using Fedora or RedHat, put it here::
362*4882a593Smuzhiyun
363*4882a593Smuzhiyun      /etc/httpd/conf.d/toaster.conf
364*4882a593Smuzhiyun
365*4882a593Smuzhiyun    If you are using openSUSE, put it here::
366*4882a593Smuzhiyun
367*4882a593Smuzhiyun      /etc/apache2/conf.d/toaster.conf
368*4882a593Smuzhiyun
369*4882a593Smuzhiyun    Following is a sample Apache configuration for Toaster you can follow:
370*4882a593Smuzhiyun
371*4882a593Smuzhiyun    .. code-block:: apache
372*4882a593Smuzhiyun
373*4882a593Smuzhiyun      Alias /static /var/www/toaster/static_files
374*4882a593Smuzhiyun      <Directory /var/www/toaster/static_files>
375*4882a593Smuzhiyun         <IfModule mod_access_compat.c>
376*4882a593Smuzhiyun            Order allow,deny
377*4882a593Smuzhiyun            Allow from all
378*4882a593Smuzhiyun         </IfModule>
379*4882a593Smuzhiyun         <IfModule !mod_access_compat.c>
380*4882a593Smuzhiyun            Require all granted
381*4882a593Smuzhiyun         </IfModule>
382*4882a593Smuzhiyun      </Directory>
383*4882a593Smuzhiyun
384*4882a593Smuzhiyun      <Directory /var/www/toaster/poky/bitbake/lib/toaster/toastermain>
385*4882a593Smuzhiyun         <Files "wsgi.py">
386*4882a593Smuzhiyun            Require all granted
387*4882a593Smuzhiyun         </Files>
388*4882a593Smuzhiyun      </Directory>
389*4882a593Smuzhiyun
390*4882a593Smuzhiyun      WSGIDaemonProcess toaster_wsgi python-path=/var/www/toaster/poky/bitbake/lib/toaster:/var/www/toaster/.local/lib/python3.4/site-packages
391*4882a593Smuzhiyun      WSGIScriptAlias / "/var/www/toaster/poky/bitbake/lib/toaster/toastermain/wsgi.py"
392*4882a593Smuzhiyun      <Location />
393*4882a593Smuzhiyun         WSGIProcessGroup toaster_wsgi
394*4882a593Smuzhiyun      </Location>
395*4882a593Smuzhiyun
396*4882a593Smuzhiyun
397*4882a593Smuzhiyun    If you are using Ubuntu or Debian, you will need to enable the config and
398*4882a593Smuzhiyun    module for Apache::
399*4882a593Smuzhiyun
400*4882a593Smuzhiyun      $ sudo a2enmod wsgi
401*4882a593Smuzhiyun      $ sudo a2enconf toaster
402*4882a593Smuzhiyun      $ chmod +x bitbake/lib/toaster/toastermain/wsgi.py
403*4882a593Smuzhiyun
404*4882a593Smuzhiyun    Finally, restart Apache to make sure all new configuration is loaded. For Ubuntu,
405*4882a593Smuzhiyun    Debian, and openSUSE use::
406*4882a593Smuzhiyun
407*4882a593Smuzhiyun      $ sudo service apache2 restart
408*4882a593Smuzhiyun
409*4882a593Smuzhiyun    For Fedora and RedHat use::
410*4882a593Smuzhiyun
411*4882a593Smuzhiyun      $ sudo service httpd restart
412*4882a593Smuzhiyun
413*4882a593Smuzhiyun#.  Prepare the systemd service to run Toaster builds. Here is a sample
414*4882a593Smuzhiyun    configuration file for the service:
415*4882a593Smuzhiyun
416*4882a593Smuzhiyun    .. code-block:: ini
417*4882a593Smuzhiyun
418*4882a593Smuzhiyun      [Unit]
419*4882a593Smuzhiyun      Description=Toaster runbuilds
420*4882a593Smuzhiyun
421*4882a593Smuzhiyun      [Service]
422*4882a593Smuzhiyun      Type=forking User=toaster
423*4882a593Smuzhiyun      ExecStart=/usr/bin/screen -d -m -S runbuilds /var/www/toaster/poky/bitbake/lib/toaster/runbuilds-service.sh start
424*4882a593Smuzhiyun      ExecStop=/usr/bin/screen -S runbuilds -X quit
425*4882a593Smuzhiyun      WorkingDirectory=/var/www/toaster/poky
426*4882a593Smuzhiyun
427*4882a593Smuzhiyun      [Install]
428*4882a593Smuzhiyun      WantedBy=multi-user.target
429*4882a593Smuzhiyun
430*4882a593Smuzhiyun
431*4882a593Smuzhiyun    Prepare the ``runbuilds-service.sh`` script that you need to place in the
432*4882a593Smuzhiyun    ``/var/www/toaster/poky/bitbake/lib/toaster/`` directory by setting
433*4882a593Smuzhiyun    up executable permissions::
434*4882a593Smuzhiyun
435*4882a593Smuzhiyun      #!/bin/bash
436*4882a593Smuzhiyun
437*4882a593Smuzhiyun      #export http_proxy=http://proxy.host.com:8080
438*4882a593Smuzhiyun      #export https_proxy=http://proxy.host.com:8080
439*4882a593Smuzhiyun      #export GIT_PROXY_COMMAND=$HOME/bin/gitproxy
440*4882a593Smuzhiyun      cd poky/
441*4882a593Smuzhiyun      source ./oe-init-build-env build
442*4882a593Smuzhiyun      source ../bitbake/bin/toaster $1 noweb
443*4882a593Smuzhiyun      [ "$1" == 'start' ] && /bin/bash
444*4882a593Smuzhiyun
445*4882a593Smuzhiyun#.  Run the service::
446*4882a593Smuzhiyun
447*4882a593Smuzhiyun       $ sudo service runbuilds start
448*4882a593Smuzhiyun
449*4882a593Smuzhiyun    Since the service is running in a detached screen session, you can
450*4882a593Smuzhiyun    attach to it using this command::
451*4882a593Smuzhiyun
452*4882a593Smuzhiyun       $ sudo su - toaster
453*4882a593Smuzhiyun       $ screen -rS runbuilds
454*4882a593Smuzhiyun
455*4882a593Smuzhiyun    You can detach from the service again using "Ctrl-a" followed by "d" key
456*4882a593Smuzhiyun    combination.
457*4882a593Smuzhiyun
458*4882a593SmuzhiyunYou can now open up a browser and start using Toaster.
459*4882a593Smuzhiyun
460*4882a593SmuzhiyunUsing the Toaster Web Interface
461*4882a593Smuzhiyun===============================
462*4882a593Smuzhiyun
463*4882a593SmuzhiyunThe Toaster web interface allows you to do the following:
464*4882a593Smuzhiyun
465*4882a593Smuzhiyun-  Browse published layers in the :oe_layerindex:`OpenEmbedded Layer Index <>`
466*4882a593Smuzhiyun   that are available for your selected version of the build system.
467*4882a593Smuzhiyun
468*4882a593Smuzhiyun-  Import your own layers for building.
469*4882a593Smuzhiyun
470*4882a593Smuzhiyun-  Add and remove layers from your configuration.
471*4882a593Smuzhiyun
472*4882a593Smuzhiyun-  Set configuration variables.
473*4882a593Smuzhiyun
474*4882a593Smuzhiyun-  Select a target or multiple targets to build.
475*4882a593Smuzhiyun
476*4882a593Smuzhiyun-  Start your builds.
477*4882a593Smuzhiyun
478*4882a593Smuzhiyun-  See what was built (recipes and packages) and what packages were
479*4882a593Smuzhiyun   installed into your final image.
480*4882a593Smuzhiyun
481*4882a593Smuzhiyun-  Browse the directory structure of your image.
482*4882a593Smuzhiyun
483*4882a593Smuzhiyun-  See the value of all variables in your build configuration, and which
484*4882a593Smuzhiyun   files set each value.
485*4882a593Smuzhiyun
486*4882a593Smuzhiyun-  Examine error, warning and trace messages to aid in debugging.
487*4882a593Smuzhiyun
488*4882a593Smuzhiyun-  See information about the BitBake tasks executed and reused during
489*4882a593Smuzhiyun   your build, including those that used shared state.
490*4882a593Smuzhiyun
491*4882a593Smuzhiyun-  See dependency relationships between recipes, packages and tasks.
492*4882a593Smuzhiyun
493*4882a593Smuzhiyun-  See performance information such as build time, task time, CPU usage,
494*4882a593Smuzhiyun   and disk I/O.
495*4882a593Smuzhiyun
496*4882a593SmuzhiyunToaster Web Interface Videos
497*4882a593Smuzhiyun----------------------------
498*4882a593Smuzhiyun
499*4882a593SmuzhiyunFollowing are several videos that show how to use the Toaster GUI:
500*4882a593Smuzhiyun
501*4882a593Smuzhiyun-  *Build Configuration:* This
502*4882a593Smuzhiyun   `video <https://www.youtube.com/watch?v=qYgDZ8YzV6w>`__ overviews and
503*4882a593Smuzhiyun   demonstrates build configuration for Toaster.
504*4882a593Smuzhiyun
505*4882a593Smuzhiyun-  *Build Custom Layers:* This
506*4882a593Smuzhiyun   `video <https://www.youtube.com/watch?v=QJzaE_XjX5c>`__ shows you how
507*4882a593Smuzhiyun   to build custom layers that are used with Toaster.
508*4882a593Smuzhiyun
509*4882a593Smuzhiyun-  *Toaster Homepage and Table Controls:* This
510*4882a593Smuzhiyun   `video <https://www.youtube.com/watch?v=QEARDnrR1Xw>`__ goes over the
511*4882a593Smuzhiyun   Toaster entry page, and provides an overview of the data manipulation
512*4882a593Smuzhiyun   capabilities of Toaster, which include search, sorting and filtering
513*4882a593Smuzhiyun   by different criteria.
514*4882a593Smuzhiyun
515*4882a593Smuzhiyun-  *Build Dashboard:* This
516*4882a593Smuzhiyun   `video <https://www.youtube.com/watch?v=KKqHYcnp2gE>`__ shows you the
517*4882a593Smuzhiyun   build dashboard, a page providing an overview of the information
518*4882a593Smuzhiyun   available for a selected build.
519*4882a593Smuzhiyun
520*4882a593Smuzhiyun-  *Image Information:* This
521*4882a593Smuzhiyun   `video <https://www.youtube.com/watch?v=XqYGFsmA0Rw>`__ walks through
522*4882a593Smuzhiyun   the information Toaster provides about images: packages installed and
523*4882a593Smuzhiyun   root file system.
524*4882a593Smuzhiyun
525*4882a593Smuzhiyun-  *Configuration:* This
526*4882a593Smuzhiyun   `video <https://www.youtube.com/watch?v=UW-j-T2TzIg>`__ provides
527*4882a593Smuzhiyun   Toaster build configuration information.
528*4882a593Smuzhiyun
529*4882a593Smuzhiyun-  *Tasks:* This `video <https://www.youtube.com/watch?v=D4-9vGSxQtw>`__
530*4882a593Smuzhiyun   shows the information Toaster provides about the tasks run by the
531*4882a593Smuzhiyun   build system.
532*4882a593Smuzhiyun
533*4882a593Smuzhiyun-  *Recipes and Packages Built:* This
534*4882a593Smuzhiyun   `video <https://www.youtube.com/watch?v=x-6dx4huNnw>`__ shows the
535*4882a593Smuzhiyun   information Toaster provides about recipes and packages built.
536*4882a593Smuzhiyun
537*4882a593Smuzhiyun-  *Performance Data:* This
538*4882a593Smuzhiyun   `video <https://www.youtube.com/watch?v=qWGMrJoqusQ>`__ shows the
539*4882a593Smuzhiyun   build performance data provided by Toaster.
540*4882a593Smuzhiyun
541*4882a593SmuzhiyunAdditional Information About the Local Yocto Project Release
542*4882a593Smuzhiyun------------------------------------------------------------
543*4882a593Smuzhiyun
544*4882a593SmuzhiyunThis section only applies if you have set up Toaster for local
545*4882a593Smuzhiyundevelopment, as explained in the
546*4882a593Smuzhiyun":ref:`toaster-manual/setup-and-use:starting toaster for local development`"
547*4882a593Smuzhiyunsection.
548*4882a593Smuzhiyun
549*4882a593SmuzhiyunWhen you create a project in Toaster, you will be asked to provide a
550*4882a593Smuzhiyunname and to select a Yocto Project release. One of the release options
551*4882a593Smuzhiyunyou will find is called "Local Yocto Project".
552*4882a593Smuzhiyun
553*4882a593Smuzhiyun.. image:: figures/new-project.png
554*4882a593Smuzhiyun   :align: center
555*4882a593Smuzhiyun   :scale: 75%
556*4882a593Smuzhiyun
557*4882a593SmuzhiyunWhen you select the "Local Yocto Project" release, Toaster will run your
558*4882a593Smuzhiyunbuilds using the local Yocto Project clone you have in your computer:
559*4882a593Smuzhiyunthe same clone you are using to run Toaster. Unless you manually update
560*4882a593Smuzhiyunthis clone, your builds will always use the same Git revision.
561*4882a593Smuzhiyun
562*4882a593SmuzhiyunIf you select any of the other release options, Toaster will fetch the
563*4882a593Smuzhiyuntip of your selected release from the upstream :yocto_git:`Yocto Project
564*4882a593Smuzhiyunrepository <>` every time you run a build.
565*4882a593SmuzhiyunFetching this tip effectively means that if your selected release is
566*4882a593Smuzhiyunupdated upstream, the Git revision you are using for your builds will
567*4882a593Smuzhiyunchange. If you are doing development locally, you might not want this
568*4882a593Smuzhiyunchange to happen. In that case, the "Local Yocto Project" release might
569*4882a593Smuzhiyunbe the right choice.
570*4882a593Smuzhiyun
571*4882a593SmuzhiyunHowever, the "Local Yocto Project" release will not provide you with any
572*4882a593Smuzhiyuncompatible layers, other than the three core layers that come with the
573*4882a593SmuzhiyunYocto Project:
574*4882a593Smuzhiyun
575*4882a593Smuzhiyun-  :oe_layer:`openembedded-core </openembedded-core>`
576*4882a593Smuzhiyun
577*4882a593Smuzhiyun-  :oe_layer:`meta-poky </meta-poky>`
578*4882a593Smuzhiyun
579*4882a593Smuzhiyun-  :oe_layer:`meta-yocto-bsp </meta-yocto-bsp>`
580*4882a593Smuzhiyun
581*4882a593Smuzhiyun.. image:: figures/compatible-layers.png
582*4882a593Smuzhiyun   :align: center
583*4882a593Smuzhiyun   :scale: 75%
584*4882a593Smuzhiyun
585*4882a593SmuzhiyunIf you want to build any other layers, you will need to manually import
586*4882a593Smuzhiyunthem into your Toaster project, using the "Import layer" page.
587*4882a593Smuzhiyun
588*4882a593Smuzhiyun.. image:: figures/import-layer.png
589*4882a593Smuzhiyun   :align: center
590*4882a593Smuzhiyun   :scale: 75%
591*4882a593Smuzhiyun
592*4882a593SmuzhiyunBuilding a Specific Recipe Given Multiple Versions
593*4882a593Smuzhiyun--------------------------------------------------
594*4882a593Smuzhiyun
595*4882a593SmuzhiyunOccasionally, a layer might provide more than one version of the same
596*4882a593Smuzhiyunrecipe. For example, the ``openembedded-core`` layer provides two
597*4882a593Smuzhiyunversions of the ``bash`` recipe (i.e. 3.2.48 and 4.3.30-r0) and two
598*4882a593Smuzhiyunversions of the ``which`` recipe (i.e. 2.21 and 2.18). The following
599*4882a593Smuzhiyunfigure shows this exact scenario:
600*4882a593Smuzhiyun
601*4882a593Smuzhiyun.. image:: figures/bash-oecore.png
602*4882a593Smuzhiyun   :align: center
603*4882a593Smuzhiyun   :scale: 75%
604*4882a593Smuzhiyun
605*4882a593SmuzhiyunBy default, the OpenEmbedded build system builds one of the two recipes.
606*4882a593SmuzhiyunFor the ``bash`` case, version 4.3.30-r0 is built by default.
607*4882a593SmuzhiyunUnfortunately, Toaster as it exists, is not able to override the default
608*4882a593Smuzhiyunrecipe version. If you would like to build bash 3.2.48, you need to set
609*4882a593Smuzhiyunthe
610*4882a593Smuzhiyun:term:`PREFERRED_VERSION`
611*4882a593Smuzhiyunvariable. You can do so from Toaster, using the "Add variable" form,
612*4882a593Smuzhiyunwhich is available in the "BitBake variables" page of the project
613*4882a593Smuzhiyunconfiguration section as shown in the following screen:
614*4882a593Smuzhiyun
615*4882a593Smuzhiyun.. image:: figures/add-variable.png
616*4882a593Smuzhiyun   :align: center
617*4882a593Smuzhiyun   :scale: 75%
618*4882a593Smuzhiyun
619*4882a593SmuzhiyunTo specify ``bash`` 3.2.48 as the version to build, enter
620*4882a593Smuzhiyun"PREFERRED_VERSION_bash" in the "Variable" field, and "3.2.48" in the
621*4882a593Smuzhiyun"Value" field. Next, click the "Add variable" button:
622*4882a593Smuzhiyun
623*4882a593Smuzhiyun.. image:: figures/set-variable.png
624*4882a593Smuzhiyun   :align: center
625*4882a593Smuzhiyun   :scale: 75%
626*4882a593Smuzhiyun
627*4882a593SmuzhiyunAfter clicking the "Add variable" button, the settings for
628*4882a593Smuzhiyun:term:`PREFERRED_VERSION` are added to the bottom of the BitBake variables
629*4882a593Smuzhiyunlist. With these settings, the OpenEmbedded build system builds the
630*4882a593Smuzhiyundesired version of the recipe rather than the default version:
631*4882a593Smuzhiyun
632*4882a593Smuzhiyun.. image:: figures/variable-added.png
633*4882a593Smuzhiyun   :align: center
634*4882a593Smuzhiyun   :scale: 75%
635