Setting up a production instance of Toaster: Difference between revisions

From Yocto Project
Jump to navigationJump to search
No edit summary
Line 1: Line 1:
[[Category:Toaster]]
[[Category:Toaster]]
This page explains how to set up Toaster separately from the hardware running your Yocto Project builds. Do it this way if you want to share a single instance of Toaster across multiple users and build servers.


== Setting up a Toaster Instance on a Remote Host ==
A production instance of Toaster is one in which you wish to share the Toaster instance with multiple users. It is also the setup which can cope with heavier loads on the web service.


Under normal circumstances, starting Toaster causes three things happen:
=== Requirements ===
* Apache webserver
* mod-wsgi for Apache webserver
* Mysql database server


* A BitBake server starts


* The Toaster UI starts, which connects to the BitBake server on one side and to the SQL database on the other side


* The web server starts, which reads the database and displays the web user interface
Ubuntu 14.04.3:
<code>
    $ sudo apt-get install apache2 libapache2-mod-wsgi mysql-server
</code>


Situations exist, however, where you might want to have multiple instances of Toaster running on various remote machines. You can create this situation by basically modifying how Toaster starts and where the common SQL database resides. You are able to do this because it is not required that Toaster starts the above set of components in order to run. Minimally, an instance of Toaster requires just one of the components to run. Consequently, you are free to manually start as many or few of the components as you need rather than using the Toaster script to cause all three things to happen.
Fedora 22:
<code>
    $ sudo dnf install
</code>


The concepts for setting up multiple instances of Toaster revolve around maintaining a common SQL database and Web server that show data from that common database and then setting up separate instances of BitBake servers and Toaster user interfaces for each separate BitBake build directory. Note that the common SQL database and the Web server show data from all the various BitBake builds. Setting the SQL database outside of any BitBake build directories maintains a
separation layer between the various builds.


The database is persistent because the logging database is set up external to the database server (e.g. MySQL). It is not even necessary to run the BitBake servers, the SQL server, and the Web server on the same machine. Each component can be run on its own machine.
=== Installation ===


== Steps to get set up ==
# Add a config file for Toaster to your Apache webserver configuration available directory.


=== 1. Set up the SQL Logging Server and the Web Server ===
/etc/apache2/conf-available/toaster.conf
<code>


You can use any SQL server out of the box (e.g. <code>apt-get install mysgl-server</code> works for an Ubuntu system). If you are concerned about performance, you might want to hand-tune the server. You must set up proper username and password access for the server. You need administration rights for the mysql root account. Realize that this is not the same thing as root access on the machine.
Alias /static /var/www/toaster/static
<Directory /var/www/toaster/static>
Order allow,deny
Allow from all
Require all granted
</Directory>


Clone a separate, local Git repository of the Toaster master branch to use for running the Web server. You do not perform builds on this tree. You need to create this local repository away from any build areas.
WSGIDaemonProcess toaster_wsgi python-path=/var/www/toaster/toaster-next/bitbake/lib/toaster:/var/www/toaster /venv/lib/python2.7/site-packages
WSGIScriptAlias / "/var/www/toaster/poky/bitbake/lib/toaster/toastermain/wsgi.py"


In the separately cloned tree for the Web server, edit the <code>bitbake/lib/toaster/toastermain/settings.py</code> file so that the <code>DATABASES</code> value points to the previously created database server. Use the username and password you established earlier.
<Location />
    WSGIProcessGroup toastern_wsgi
</Location>
</code>


Run the database sync scripts to create the needed tables as follows:
</code>
 
# Enable the mod-wsgi in Apache webserver
    $ python bitbake/lib/toaster/manage.py syncdb
<code>
    $ python bitbake/lib/toaster/manage.py migrate orm
  $ sudo a2enmod wsgi
 
</code>
Note: It is important, for toaster running in 1.6 mode, to not sync bldcontrol (only used in 1.7 mode).
 
 
Start the Web server using the following command:
 
    $ python bitbake/lib/toaster/manage.py runserver
 
... or in the background:
 
    $ nohup python bitbake/lib/toaster/manage.py runserver 2>toaster_web.log >toaster_web.log &
 
=== 2. Enable build logging to the common SQL server for each build directory you are using ===
 
Edit <code>_build local_ bitbake/lib/toaster/toastermain/settings.py</code> to alter the <code>DATABASES</code> value to point to the common SQL logging server.
 
Create the required conf/toaster.conf file as per Bitbake extra options on "https://wiki.yoctoproject.org/wiki/Setting_up_a_local_instance_of_Toaster".
 
Start the BitBake server using the following command:
 
    $ bitbake --postread conf/toaster.conf --server-only -t xmlrpc -B localhost:0 && export BBSERVER=localhost:-1
 
Start the logging user interface using the following command:
 
    $ nohup bitbake --observe-only -u toasterui >toaster_ui.log &
 
<strong>NOTE:</strong> No hard-coded ports are used as there is enough code to run autodiscovery for ports to prevent collisions.
 
At this point, you are ready to run your builds using commands such as:
 
    $ bitbake core-image-minimal
 
When you are finished, you need to kill the BitBake server for that particular build area:
 
    $ bitbake -m
 
=== 3. Verify that it all works ===
 
You should examine the logs and be sure that the logging worked, that data is persistent, and that data from multiple builds from different areas was supported.

Revision as of 11:54, 16 October 2015


A production instance of Toaster is one in which you wish to share the Toaster instance with multiple users. It is also the setup which can cope with heavier loads on the web service.

Requirements

  • Apache webserver
  • mod-wsgi for Apache webserver
  • Mysql database server


Ubuntu 14.04.3:

   $ sudo apt-get install apache2 libapache2-mod-wsgi mysql-server

Fedora 22:

   $ sudo dnf install 


Installation

  1. Add a config file for Toaster to your Apache webserver configuration available directory.

/etc/apache2/conf-available/toaster.conf

Alias /static /var/www/toaster/static
<Directory /var/www/toaster/static>
	Order allow,deny
	Allow from all
	Require all granted
</Directory>
WSGIDaemonProcess toaster_wsgi python-path=/var/www/toaster/toaster-next/bitbake/lib/toaster:/var/www/toaster /venv/lib/python2.7/site-packages
WSGIScriptAlias / "/var/www/toaster/poky/bitbake/lib/toaster/toastermain/wsgi.py"
<Location />
    WSGIProcessGroup toastern_wsgi
</Location>

  1. Enable the mod-wsgi in Apache webserver

  $ sudo a2enmod wsgi