Auto-tools/Projects/GrafxBot/Install
Installing GrafxBot servers
Prerequisites
- MySQL Community Server 5.x from http://mysql.com/downloads/mysql/; install the server, client utilities, and development libraries
- Python 2.6
- MySQL-Python from http://sourceforge.net/projects/mysql-python/
- Django 1.2.x
- Any webserver supported by Django
Installation Steps
- Download the Django GrafxBot app:
hg clone http://bitbucket.org/jonallengriffin/resultserv
- Edit resultserv/settings.py, and update DATABASE_USER, DATABASE_PASSWORD, and DATABASE_HOST as appropriate.
- Create a database named 'resultserv' in MySQL.
- In the resultserv directory, enter the following command; this should generate the necessary SQL tables. When prompted for a superuser, add one of your choice.
python manage.py syncdb
- Create a Django user with the following commands. A Django user is used to login to the GrafxBot website, so you can access some of the private pages of the site.
python manage.py shell
>>> from django.contrib.auth.models import User
>>> user = User.objects.create_user('john', 'lennon@thebeatles.com', 'johnpassword')
>>> user.save()
>>> exit()
- Edit your web site's config to serve files for the /resultserv/ url. The way this is done varies depending on your webserver, for nginx this involes adding a block like this to your nginx.conf:
location ~ ^/resultserv/media/(.*)$ {
alias /path/to/resultserv/media/$1;
}
location /resultserv {
fastcgi_pass 127.0.0.1:8090;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_pass_header Authorization;
fastcgi_intercept_errors off;
}
- Start the Django GrafxBot server. The command used to do this varies on your website's configuration, but for nginx and the config block above, this might be:
python manage.py runfcgi method=threaded host=127.0.0.1 port=8090
- Start the GrafxBot data insertion daemon, updating the --pidfile and --logfile path as needed; make sure the specified paths exist:
python insert.py --pidfile=/usr/local/logs/insert.pid --logfile=/usr/local/logs/insert.log
- Verify the installation by browsing to the following address:
http://127.0.0.1/resultserv/data/
Building the GrafxBot extension
To build the GrafxBot extension, you must build mozilla-central. There are a number of pre-requisites for this, see https://developer.mozilla.org/en/build_documentation for more information. Once you have a valid build environment, you can build GrafxBot using the following:
mkdir mozilla-central cd mozilla-central hg clone http://hg.mozilla.org/mozilla-central src cd src/extensions hg clone http://hg.mozilla.org/automation/grafxbot
Now, create a file called mozconfig in the mozilla-central/src directory, and add these lines:
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj-ff-rel mk_add_options MOZ_MAKE_FLAGS="-j1" mk_add_options MOZ_CO_PROJECT=browser ac_add_options --enable-application=browser ac_add_options --enable-optimize ac_add_options --disable-debug ac_add_options --enable-libxul ac_add_options --disable-tests ac_add_options --enable-extensions=default,grafxbot
Finally, build mozilla-central, including the GrafxBot extension, using this command:
make -f client.mk build
The GrafxBot xpi can be found afterwards at:
mozilla-central/obj-ff-rel/dist/xpi-stage
Customizing GrafxBot
To change the GrafxBot extension to post results to a server other than the Mozilla one, you must update two lines of code:
modules/grafxbot.jsm:const postURL = "http://brasstacks.mozilla.com/resultserv/data/post/"; modules/grafxbot.jsm:const resultURL = "http://brasstacks.mozilla.com/resultserv/data/results/";
To change GrafxBot to save data locally, instead of sending to a database, you need to edit the function in doHttpPost() in modules/grafxbot.jsm so that it doesn't initiate an XMLHttpRequest, but instead writes the data to a file, etc.
After making any changes to GrafxBot extension code, you must rebuild it using the steps above.