Tinderbox/Tbox3 Setup

From MozillaWiki
Jump to: navigation, search

Setting up Tinderbox3

Much of these instructions come from Andy Howell's notes on installing Tbox3, which can also be found here.

Server Setup

Perl on the server machine

You need the LWP module. You can tell if you have it by running this:

 perl -e 'use LWP::UserAgent; print $LWP::UserAgent::VERSION, "\n"'

If you get a version, you have it. If not,

 perl -MCPAN -e 'install "Bundle::LWP"

Andy was also using SSL, so he needed:

 perl -MCPAN -e 'install "Crypt::SSLeay"'

NOTE: on Debian 3.1, I was unable to install the Perl module Crypt::SSLeay. It asked for the location of the openssl headers, and they were not installed by default, nor by "apt-get install openssl", nor was there a package openssl-devel available. (I didn't look much farther since this was optional.)

Database Setup

Tinderbox3 appears to support either mysql or postgress. Successful installations (at least for the DB) include mysql-3.23.52-44 on SuSE linux 8.1, and mysql 4.0.15 on Redhat 9.


First, install mysql. I'm running Debian, so I use apt-get:

 yourmachine:~# apt-get install mysql-server mysql-client mysql-common

(Note that the current version is 4.0.24, as of this writing, on 2006-05-21 Sunday.)

Set a password for the MySQL root user (replace "pass" with the password you choose).

 yourmachine:~# mysqladmin -u root password 'pass'

Now you need a tinderbox user, for example tbox3 which the code uses.

 yourmachine:~# adduser
 Enter a username to add: tbox3
 Adding user `tbox3'...
 Adding new group `tbox3' (1001).
 Adding new user `tbox3' (1001) with group `tbox3'.
 Creating home directory `/home/tbox3'.
 Copying files from `/etc/skel'
 Enter new UNIX password: pass
 Retype new UNIX password: pass
 passwd: password updated successfully
 Changing the user information for tbox3
 Enter the new value, or press ENTER for the default:
         Full Name []: Tinderbox3
         Room Number []:
         Work Phone []:
         Home Phone []:
         Other []:
 Is the information correct? [y/N] y

For the below, "pass" is assumed to be the password you assigned to the tbox3 user.

 yourmachine:~# mysql -p
 Enter password: pass
         DROP,REFERENCES ON tbox3.* TO tbox3@localhost
         IDENTIFIED BY 'pass';
 mysql> create database tbox3;
 mysql> quit

Next, download and expand the tinderbox3 sources:

 yourmachine:~# wget http://www.johnkeiser.com/mozilla/tbox3.tgz
 yourmachine:~# tar xzvf tbox3.tgz

Now create the tables:

 yourmachine:~# cd tbox3/sql
 yourmachine:~# ./setup-mysql.pl tbox3 --username tbox3 --password pass

This gives errors saying it can't drop tables. That's okay; if you run it again, it won't complain (although it is not necessary to run it again: the first time, the tables did not exist, so it could not drop them, and then it created them; the script ignores errors when dropping sequences and tables for exactly this reason).

Note that there appears to be an error in the setup-mysql.pl script: the short form for both "port" and "password" is specified as "p". The above text previously had "-p pass", which did not work until I used the long version. Something else is wrong with the script, and I'm working on debugging that now; will update this section when finished.

Okay, it appears that mysql (the client) does not want the password on the command line. So you need to edit setup-mysql.pl, and change the following line (towards the end of the subroutine execute_sql_file); change the first line below to be the second line below:

 push @exec_params, ("-p", $args{password}) if $args{password};
 push @exec_params, ("-p") if $args{password};

Now, instead of giving you several failed drop messages, then the mysql client help, it will instead give you several failed drop messages, then ask for your password. This is the password to the tbox3 user you created above. After entering the password, there should be no more messages.

(For the belt-and-suspenders crowd, go ahead and re-run the script. This time, you'll see it drop 12 tables (which it names), then ask for your password, and then you get the bash prompt back almost immediately.)

Code Changes

You didn't think you'd get away without modifying some files, did you?

  • scripts/Tinderbox3/DB.pm

Edit the dbname, username and password (near the beginning of the file).

  • scripts/Tinderbox3/Login.pm

Edit "superuser" (at the end of the file; set to "tbox3@localhost"), and change the URL from "http://bugzilla.mozilla.org/query.cgi?" to your server (on line 18; set to "http://localhost/tinderbox/query.cgi?").

  • scripts/Tinderbox3/InitialValues.pm

Change these if you want. They provide the defaults used when you create an new tree. Once created, the tree's data is in the database.

Web Server

Setup web server to find tinderbox3/scripts and treat .pl files as cgi scripts.

Running Apache 2.x., the following was added to /etc/apache/httpd.conf, in the "<IfModule mod_alias.c>" section:

Alias /tinderbox /path/to/code/tinderbox3/scripts
<DirectoryMatch "/path/to/code/tinderbox3/scripts">
     Options +ExecCGI +FollowSymLinks
     AddHandler cgi-script .pl
     AllowOverride All

Client Setup

Code Changes

It is recommended that you use the new and improved tinderclient that was posted to the mozilla-webtools list; it is much more general and is designed to be customized for your site. (Somebody who has a reference to this, please add it here! I could not find it.)

However, if you don't, here's a quick little patch to add authentication and to fix a missing "use Date::Format":

*** tinderclient.pl.~1.16.~     2003-03-19 14:56:37.000000000 -0600
--- tinderclient.pl     2004-03-25 10:41:37.000000000 -0600
*** 256,261 ****
--- 256,262 ----
     my $req = new HTTP::Request(POST => $this->{CONFIG}{url} . "/xml/" 
. $script
     #my $req = new HTTP::Request(POST => "http://www.mozilla.gr.jp:4321/");
     $req->content_type("multipart/form-data; boundary=$boundary");
+   $req->authorization_basic('andy', 'yourpassword');

     ${$req->content_ref} .= $this->form_data_request($boundary, 'tree', 
     foreach my $param (keys %{$params}) {
*** 1197,1202 ****
--- 1198,1204 ----
   package TinderClient::Modules::distribute;

   use strict;
+ use Date::Format;

   sub get_config {
     my ($client, $config, $persistent_vars, $build_vars, $content_ref) 
= @_;

Setting up a tree

Point your browser at tinderbox/login.pl, logging in as tbox (or a superuser)

Setting up Tests

There is a seperate page for setting up tinderbox3 tests