Auto-tools/Projects/GrafxBot/Install: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
 
(6 intermediate revisions by the same user not shown)
Line 26: Line 26:


<ol start="5">
<ol start="5">
<li>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.</li>
</ol>
  python manage.py shell
  >>> from django.contrib.auth.models import User
  >>> user = User.objects.create_user('john', 'lennon@thebeatles.com', 'johnpassword')
  >>> user.save()
  >>> exit()
<ol start="6">
<li>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:</li>
<li>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:</li>
</ol>
</ol>
Line 46: Line 56:
         }
         }


<ol start="6">
<ol start="7">
<li>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:</li>
<li>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:</li>
</ol>
</ol>
Line 52: Line 62:
   python manage.py runfcgi method=threaded host=127.0.0.1 port=8090
   python manage.py runfcgi method=threaded host=127.0.0.1 port=8090


<ol start="7">
<ol start="8">
<li>Start the GrafxBot data insertion daemon, updating the --pidfile and --logfile path as needed; make sure the specified paths exist:</li>
<li>Start the GrafxBot data insertion daemon, updating the --pidfile and --logfile path as needed; make sure the specified paths exist:</li>
</ol>
</ol>
Line 58: Line 68:
   python insert.py --pidfile=/usr/local/logs/insert.pid --logfile=/usr/local/logs/insert.log
   python insert.py --pidfile=/usr/local/logs/insert.pid --logfile=/usr/local/logs/insert.log


<ol start="8">
<ol start="9">
<li>Verify the installation by browsing to the following address:</li>
<li>Verify the installation by browsing to the following address:</li>
</ol>
</ol>
Line 76: Line 86:
Now, create a file called <code>mozconfig</code> in the mozilla-central/src directory, and add these lines:
Now, create a file called <code>mozconfig</code> in the mozilla-central/src directory, and add these lines:


   mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj-ff-dbg
   mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../obj-ff-rel
   mk_add_options MOZ_MAKE_FLAGS="-j1"
   mk_add_options MOZ_MAKE_FLAGS="-j1"
   mk_add_options MOZ_CO_PROJECT=browser
   mk_add_options MOZ_CO_PROJECT=browser
    
    
   ac_add_options --enable-application=browser
   ac_add_options --enable-application=browser
  ac_add_options --enable-jemalloc
   ac_add_options --enable-optimize
   ac_add_options --enable-optimize
   ac_add_options --disable-debug
   ac_add_options --disable-debug
   ac_add_options --enable-libxul
   ac_add_options --enable-libxul
  ac_add_options --enable-trace-malloc
   ac_add_options --disable-tests
   ac_add_options --disable-tests
   ac_add_options --enable-extensions=default,grafxbot
   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 <code>doHttpPost()</code> in <code>modules/grafxbot.jsm</code> 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.

Latest revision as of 18:33, 20 January 2011

Installing GrafxBot servers

Prerequisites

Installation Steps

  1. Download the Django GrafxBot app:
 hg clone http://bitbucket.org/jonallengriffin/resultserv
  1. Edit resultserv/settings.py, and update DATABASE_USER, DATABASE_PASSWORD, and DATABASE_HOST as appropriate.
  2. Create a database named 'resultserv' in MySQL.
  3. 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
  1. 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()
  1. 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;
       }
  1. 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
  1. 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
  1. 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.