: New feature! MozillaWiki is now mobile-friendly. Visit from a mobile device to see new mobile theme + try editing. Release details.


From MozillaWiki
Jump to: navigation, search

Get the Code

Server Requirements

  • Python 2.?
  • Apache 2.x + mod_python
  • mod_rewrite
  • MySQL 5.x
  • memcached (someday)
  • python modules:
    • pysqlite2 (python-sqlite2)
    • MySQLdb (MySQL-python)

Set Up Database

Configure Application

  • DB config
   # Set up mysql5 (if necessary) and create a database
   sudo port install mysql5
   # follow directions and complete installation 
   echo "create database o_graphs; grant all privileges on o_graphs.* to o@'localhost' identified by 'o';" | mysql5 -uroot
   mysql5 -uroot o_graphs < sql/schema.sql
  • Apache
    • Set vhost dir to the root hg directory.
    • set cgi-bin to hgroot/server

Creating Test Data

  • Run scripts/dump_test_data.py on stage to dump a specific test id to a zipped sql file
  • Import sql/test_data.sql
    • This has some test data, enough for listing tests and 1 graph
    • DHTML on Linux bl-bldlnx01-18_linux, 1.8 branch
  • A lot of test data here (22MB unzipped): http://people.mozilla.org/~rdoherty/graphserver/test_data.sql.zip
    • DHTML on Linux bl-bldlnx01-18_linux, 1.8 branch
    • Series type, tdhtml on MacOS X 10.5, only 1 test


  • How do we get the right version of pysqlite2 off of fink for OSX? (use MySQL?)
  • Installing the required python MySQL packages is almost impossible
    • not impossible. You've got two options AFAICT.
      1. using MacPorts: if you've installed a version of MySQL using MacPorts, you should simply be able to do a port install py-mysql or port install py25-mysql. I haven't tested this personally because I was working from source (I already have a custom MySQL built here for Litmus work), but I did see those ports in the list when I was trying to figure this setup out.
      2. from source: Source can be found here: http://sourceforge.net/project/showfiles.php?group_id=22307 Instructions for building (some source mods are required): http://www.keningle.com/?p=11 -- coop
    • Note I ran into a failure to build sqlite3 which trying to install apache from macports. This fixed it for me http://www.nabble.com/sqlite3-build-failure-td16129072.html

Build Graph Stage Server

  • For reference we can look at bm-buildgraph01
  • ip:
  • /var/www/html/graphs
  • /var/www/html/graphs/g2
  • if needed, grab the mysql dump from stage (6GB mysql dump, too large for normal use)

Mac OS X installation of CVS version

   # Install MacPorts (http://macports.org/)
   # Install and select python 2.5
   sudo port install python25
   sudo port install python_select
   sudo python_select python25
   sudo port install py25-mysql
   # Get the graph server source from CVS
   cd ~/devel
   cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co -d graphs-cvs mozilla/webtools/new-graph
   # Link the checkout into your home ~/Sites/
   ln -s `pwd`/graphs-cvs ~/Sites/
   # Install pysqlite2, required in some spots and handy to have.
   curl -O http://oss.itsystementwicklung.de/download/pysqlite/2.4/2.4.1/pysqlite-2.4.1.tar.gz
   tar -zxf pysqlite-2.4.1.tar.gz
   cd pysqlite-2.4.1
   sudo python setup.py install
   # Set up mysql5 (if necessary) and create a database
   sudo port install mysql5
   # follow directions and complete installation 
   echo "create database o_graphs; grant all privileges on o_graphs.* to o@'localhost' identified by 'o';" | mysql5 -uroot
   mysql5 -uroot o_graphs < sql/schema.sql
   # Get apache2 up and running
   sudo port install apache2
   # Ensure sure .cgi is recognized to CGI scripts
   # Uncomment line 383:
   # AddHandler cgi-script .cgi
   # Ensure that userdir_module is enabled, around line 113 of /opt/local/apache2/conf/httpd.conf
   # Ensure that ExecCGI and FollowSymLinks options are enabled in /opt/local/apache2/conf/extra/httpd-userdir.conf
   # Be sure to disable Apple's apache and switch to MacPorts'
   sudo /usr/sbin/apachectl stop
   sudo /opt/local/apache2/bin/apachectl start
   # Import some data (this needs expanding)
   mkdir data
   curl http://build-graphs.mozilla.org/db/dhtml/bl-bldlnx01_fx-linux-tbox-head > data/sample1.txt
   chmod +x utils/import.py
   ./utils/import.py foo bar baz quux < data/sample1.txt
   # See also: ./utils/pull.sh
   # visit http://localhost/~username/graphs-cvs/graph.html

Windows installation

   Download apache 2.2 from http://httpd.apache.org/ and install it
       Network Domain: localhost
       Server Name: localhost
       Admin Email: (any email)
   Download and install mysql
       "root" user should have empty password
   Download and install MySQLdb
       Pre-compiled binaries:
   Download and install pysqlite2
   In %ProgramFiles%\Apache Software Foundation\Apache2.2\conf\httpd.conf
       - Un-comment "LoadModule rewrite_module modules/mod_rewrite.so"
       - Un-comment "LoadModule deflate_module modules/mod_deflate.so"
       - Un-comment "AddHandler cgi-script .cgi"
       - Add "ScriptInterpreterSource Registry-Strict" (e.g. after the AddHandler)
       - Search for "htdocs" and change the path to point to graphs-hg-root both places.
       - In the <directory> section
           - Change "AllowOverride" from "None" to "All"
           - Add "AddOutputFilterByType DEFLATE text/html text/plain text/xml"
   - In the windows registry:
       - Add a "HKEY_CLASSES_ROOT\.cgi\Shell\ExecCGI\Command"-key with the default value '"C:\Program Files\Python26\python.exe" -u'
   - Restart apache (left click icon in tray and choose "Apache2.2"->"Restart")
   echo create database graphserver; grant all privileges on graphserver.* to o@'localhost' identified by 'o'; | "%ProgramFiles%\MySQL\MySQL Server 5.1\bin\mysql.exe" -uroot
   "%ProgramFiles%\MySQL\MySQL Server 5.1\bin\mysql.exe" -uroot graphserver < schema.sql
   "%ProgramFiles%\MySQL\MySQL Server 5.1\bin\mysql.exe" -uroot graphserver < data.sql
   "%ProgramFiles%\MySQL\MySQL Server 5.1\bin\mysql.exe" -uroot graphserver < pages_table.sql