Wavey Davey’s Stuff

Installing Review Board (1.0 alpha 2) on Windows for Perforce

Downloads

Cygwin

Cygwin is a Linux-like environment for Windows. Review Board needs access to UNIX/Linux PatchUtils software that provides various file diff/patching tools. Cygwin is able to make these available under Windows.

For now, just download and save the Cygwin installer setup.exe from http://www.cygwin.com/.

MySQL (5.1.30)

You need a database server to run Review Board. I have opted for MySQL. Download the latest community (free) server from http://dev.mysql.com/downloads/mysql/5.1.html#win32.

Apache (2.2.11)

Download apache_2.2.11-win32-x86-openssl-0.9.8i.msi from here : http://httpd.apache.org/download.cgi

Python (2.5.4)

There a several versions of Python, having reviewed the various packages that are needed for Review Board I decided that Python 2.5 was the most consistently supported.

Python Packages

The following Python packages need to be installed using binary distributions – further packages will be installed later using the Python “easy_install” utility:

Name Package URL Notes
setuptools setuptools-0.6c9.win32-py2.5.exe Provides the “easy_install” utility
mod_python mod_python-3.3.1.win32-py2.5-Apache2.2.exe Python plug-in for Apache web server
Python Imaging Library PIL-1.1.6.win32-py2.5.exe Image manipulation library used by Review Board
MySQLDB MySQL-python-1.2.2.win32-py2.5.exe MySQL client library used by Review Board

Perforce

Download the 2008.02 release of the Windows Perforce client from here : http://www.perforce.com/perforce/downloads/index.html

Download the p4python plug-in for Python 2.5 and Perforce 2008.02 “p4python25.exe” from here : ftp://ftp.perforce.com/perforce/r08.2/bin.ntx86/

Review Board (Review Board 1.0 alpha 2 released)

No need to download this – it will be installed using the “easy_install” utility later.

Server Installation

Cygwin

  • Run the cygwin installer “setup.exe”
  • Follow the installation wizard…
  • At the “Choose Installation Type” window select “Install From Internet”.
  • At the “Choose Installation Directory” window:
    • Enter Root Directory “C:\cygwin”
    • Select Install For “All Users (RECOMMENDED)
    • Select Default Text File Type “Unix/Binary (RECOMMENDED)”
  • At the Select Local Package Directory window accept the default unless you want package files stored elsewhere
  • At the Select Connection Type window, select “Use IE5 Settings”
  • Choose any mirror you like from the mirrors list.
  • Accept the default package list, but add one extra:
    • Utils->patchutils
  • Follow the default wizard options through installation until complete.

MySQL (5.1.30)

General Installation
  • Unzip release archive (mysql-5.1.30-win32.zip)
  • Run setup.exe
  • Accept all defaults
  • When prompted, choose to configure MySQL server now.
  • Accept the default options all the way through the config wizard, and enter a password when prompted.
  • At end of wizard click Execute.
MySQL Review Board Configuration
  • Open a MySQL command line from the Start Menu (Start Menu->Programs->MySQL->MySQL Server 5.1->MySQL Command Line Client)
  • Enter the password you provided to the MySQL config wizard
  • Run the following commands
    CREATE DATABASE reviewboarddb;
    
    GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP,REFERENCES
     ON reviewboarddb.* TO reviewboard@localhost IDENTIFIED BY 'password';
    
    FLUSH PRIVILEGES;
    
    QUIT

Apache (2.2.11)

  • Run the apache installer apache_2.2.11-win32-x86-openssl-0.9.8i.msi
  • Follow wizard and accept defaults

Python (2.5.4)

  • Run python-2.5.4.msi
  • Follow wizard and accept defaults.

Python Packages

Run each of these installers. Accept defaults where prompted:

  • setuptools-0.6c9.win32-py2.5.exe
  • mod_python-3.3.1.win32-py2.5-Apache2.2.exe
  • PIL-1.1.6.win32-py2.5.exe
  • MySQL-python-1.2.2.win32-py2.5.exe

Windows PATH Variable

We need to add the Python script and Cygwin /usr/bin folders to the windows path:

  • From the Windows Start menu choose “Settings->Control Panel->System”
  • In the System dialog, select the “Advanced” tab
  • At the bottom of the tab, click the “Environment Variables” button
  • Under system variables, select the PATH entry, and then the “Edit” button
  • Add “;C:\Python25\;C:\Python25\Scripts;C:\cygwin\bin” to the end of the “Variable Value” field. (NOTE: “C:\Python25\” must be listed before C:\cygwin\bin to avoid the Cygwin version version of Python being used inadvertently.)
  • Click OK, then OK, then Apply.
  • Test the PATH changes :
    • Open a new windows command prompt (Start->Run , then “cmd”)
    • Type the command “interdiff –help”. The command should output help info.
    • Type the command “easy_install –help”. The command should output help info.

Perforce

  • Install the 2008.02 Perforce client (it appears the p4python installer includes the P4 client, but I opted to install it separately beforehand just in case):
    • Run the installer “perforce.exe”
    • In the “Select Features” dialog, select “Command-Line Client (P4)”, deselect all other options.
    • Select defaults for the remainder of the install wizard.
  • Install the p4python plugin
    • Run the installer “p4python25.exe”
    • Follow install wizard and accept defaults.

Review Board Installation (Review Board 1.0 alpha 2 released)

  • Open a windows command prompt.
  • Download and install ReviewBoard and its remaining dependent Python packages using the “easy_install”:
    • If you’re on a corporate network you’ll most likely have to set up the web proxy settings for easy_install to use:
      prompt> set HTTP_PROXY=http://domain\\username:password@lon-proxy-01:8080

      NOTE: Even with this setting I could not get easy_install to work on my particular location, so I installed this part using an alternative internet connection.

    • At the command prompt, run easy_install
      prompt> easy_install ReviewBoard
  • Setup a ReviewBoard instance with the Review Board “rb-site” utility:
    • Start the utility. I decided to create the ReviewBoard installation at “c:\www\reviewboard”:
      prompt> mkdir c:\www
      prompt> c:\Python25\python.exe c:\Python25\Scripts\rb-site install "c:\www\reviewboard"
    • Follow the installation steps. A transcript of the setup follows:
      • Domain Name: Your hostname
      • Root Path: URL path to ReviewBoard excluding hostname/domain and port, e.g. /reviewboard/
      • Media URL: Hit return to accept the default
      • Database Type: Enter 1 for MySQL
      • Database Name: Name of the database created in MySQL. I used “reviewboarddb”
      • Database Server: Hit return to accept default localhost
      • Database Username: Enter “reviewboard” – the user I created during MySQL setup above.
      • Database Password: Enter “password” – the temporary password I assigned above.
      • Cache Type: To keep life simple, I entered 2 for “File”
      • Cache Directory: For windows paths you have to escape the \ character. I used
        c:\\temp\\reviewboard
      • Web Server: Select 1 for Apache
      • Python Loader: Select 1 for modpython
      • Username: Hit return for default “admin”
      • Password: Choose an admin password
      • E-Mail Address: As you’re setting up, I guess this should be your email address!
  • Configure Apache for mod_python and Review Board. Open the Apache config file “C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf” in a text editor. Edit as follows:
    • If, like me, you already have IIS listening on port 80, tell Apache to use 8080 (or something else) as default by uncommenting and editing a “Listen” entries. I added two entries – one port for the default, and another specifically for ReviewBoard (more on this below):
      Listen 8080
      Listen 8082
    • Define your server name and default port:
      ServerName hostname:8080
    • Find the “Dynamic Shared Object (DSO)” section. Add the following line to under the last “LoadModule” entry:
      LoadModule python_module modules/mod_python.so
    • Append the contents of “C:\www\reviewboard\conf\apache-modpython.conf” to the end of httpd.conf. Replace “*:80” in the VirtualHost tag with the hostname:port-number that clients will use to access ReviewBoard on your server. A hostname of ‘*’ means any hostname that resolves to your server. If port is left the same as your default port (specified by the “Listen” setting above) then you won’t be able to serve any other content from your Apache installation on the default port. The two simplest options if you’re not in a position to create a new hostname for your server (which will need to be setup in your DNS server) are:
      • Change the VirtualHost port, in my case to 8082, OR
      • Strip off the VirtualHost stuff and just prefix the Location elements with the URL path to your Review Board site, e.g:
        # Error handlers
        ErrorDocument 500 /reviewboard/errordocs/500.html
        
        # Serve django pages
        
        <Location "/reviewboard/">
            PythonPath "['c:/www/reviewboard/conf'] + sys.path"
            SetEnv DJANGO_SETTINGS_MODULE reviewboard.settings
            SetHandler mod_python
            PythonHandler django.core.handlers.modpython
            PythonAutoReload Off
            PythonDebug Off
            # Used to run multiple mod_python sites in the same apache
            PythonInterpreter reviewboard_reviewboard
        </Location>
        
        # Serve static media without running it through mod_python
        # (overrides the above)
        <Location "/reviewboard/media">
            SetHandler None
        
        </Location>
        <Location "/reviewboard/errordocs">
            SetHandler None
        </Location>
        
        # Alias static media requests to filesystem
        Alias /reviewboard/media c:/www/reviewboard/htdocs/media
        Alias /reviewboard/errordocs c:/www/reviewboard/htdocs/errordocs
    • Append the following Directory block to the end of httpd.conf
      <Directory "c:/www/reviewboard/htdocs">
          Options Indexes FollowSymLinks
          AllowOverride None
          Order allow,deny
          Allow from all
      </Directory>
  • Start Apache (Start Menu->Programs->Apache HTTP Server 2.2->Control Apache Server->Start Apache in Console), or restart it if installed as a service.

Review Board Admin Setup

  • Open a browser and navigate to http://localhost:8082/reviewboard
  • Log in using the admin details you provided to the rb-site utility.
  • Enter First Name, Last Name and password details, then click “Save Preferences”
  • Select the “Admin” link at the top right of the page.
  • Select the “Database” link at the top left of the page
  • Scroll down to the “Scmtools” section and click the “ Add” link next to “Repositories”, then fill in the details:
    • Name: Perforce
    • Path: perforce.domain.com:1666
    • Username: username

post-review

“post-review” is a command line utility that streamlines the process of creating reviews from checked out files or submitted revisions. Client Installation discusses the installation of this utility on client development machines, but it’s worth getting it up and running on the Review Board server first.

  • Use easy_install to add the following packages:
    prompt> easy_install simplejson
  • Copy the ‘template’ for the utility from C:\Python25\Lib\site-packages\ReviewBoard-1.0alpha2-py2.5.egg\reviewboard\contrib\tools\ to somewhere in your PATH. On windows, adding a “.py” extension will enable it to be executed directly from the Windows command line (the shebang line doesn’t seem to work in Windows).
  • Edit the following lines your copy of the template post-review script:

Syntax Highlighting

To enable syntax highlighting in the diff viewer:

  • Install the pygments package:
    prompt> easy_install pygments
  • Re-start Apache
  • Login to ReviewBoard as the admin user.
  • Got to Admin->Settings->Diff Viewer
  • Enable Syntax Highlighting.
  • Click “Save”
  • Each existing user will need to enable syntax highlighting in their preferences. New users will be created with syntax highlighting enabled by default.

Client Installation

The only client installation required is the post-review script – which is needed to create reviews from submitted or pending Perforce changelists. This requires:

  • Python
  • simplejson
  • gnu diff (Standard UNIX diff won’t do. We need GNU diff)

The installation varies depending on the platform. Details follow…

Windows

There is an excellent utility/package for Python, py2exe, that allows a script to be compiled into a distributable exe that requires no separate Python runtime.

  • Take as the starting point the working cer-post-review.py script described in InstallingReviewBoard-postreview
  • Download the py2exe package “py2exe-0.6.9.win32-py2.5.exe” from http://sourceforge.net/project/showfiles.php?group_id=15583 and install
  • Make sure there are no “.egg” files in the Python site-packages folder (C:\Python25\Lib\site-packages). These are zipped and py2exe can’t handle them. They must be unzipped into folders of the same name. If there are do the following:
    • Rename by adding a “.zip” extension after the “.egg” extension.
    • Unzip the extension to a folder with the same name as the original “.egg” file.
  • In the same folder as cer-post-review.py create a setup.py script that will use py2exe to generate the executable:
    from distutils.core import setup
    import py2exe
    
    setup(
        options = {'py2exe': {'bundle_files': 1}},
        console = ['cer-post-review.py'],
        zipfile = None,
    )
  • Run the setup.py script:
    prompt> python setup.py py2exe
  • The distributable package (comprising two exes and a DLL) can be found in the new dist/ subdirectory.
  • The dist folder contents can be copied to client PCs. The cer-post-review.exe program works in exactly the same way as the original python script it was generated from.
  • post-review requires GNU diff. Download the GnuWin32 package “diffutils-2.8.7-1.exe” from http://gnuwin32.sourceforge.net/packages/diffutils.htm
  • Run the installer. Accept the default options except where prompted for documentation, which should be deselected as not required.
  • Copy the following files from C:\Program Files\GnuWin32\bin to the post-review dist/ subdirectory:
    • diff.exe
    • libiconv2.dll
    • libintl3.dll
  • Zip up the dist/ folder and distribute to users. If you’re really keen make a windows installer. I used NSIS with the excellent HM NIS Edit tool.

AIX

  • Python (2.5.2.2)
    • Download the AIX Python binary “ActivePython-2.5.2.2-aix5-powerpc.tar.gz” from http://www.activestate.com/activepython/downloads/
    • Unpack this archive and copy the install files to /usr/local/
      prompt> gunzip -c ActivePython-2.5.2.2-aix5-powerpc.tar.gz | tar -xvf -
      prompt> cp -rp ActivePython-2.5.2.2-aix5-powerpc/INSTALLDIR/* /usr/local/
    • Add /usr/local/bin to your PATH if not already there (e.g. by editing .bashrc_personal. Log out and in again before proceeding.)
  • setuptools (0.6c9)
  • simplejson (2.0.8)
    • Download “simplejson-2.0.8-py2.5-win32.egg” from http://pypi.python.org/pypi/simplejson. Despite the filename this package seems to work ok on AIX for our purposes. Its possible there is some acceleration that can be achieved by compiling the package from source for AIX, but I didn’t try that.
    • Install simplejson using the setuptools easy_install utility
      prompt> easy_install -N simplejson-2.0.8-py2.5-win32.egg
  • GNU diff utilsThe default version of diff on AIX won’t do for Review Board. You need the GNU version.
    • Download “diffutils-2.8.1.tar.gz” from http://ftp.gnu.org/pub/gnu/diffutils/
    • Extract, compile and install the code to /usr/local/
      prompt> gunzip -c diffutils-2.8.1.tar.gz | tar -xvf -
      prompt> cd diffutils-2.8.1
      prompt> ./configure --prefix=/usr/local/local --with-gcc="xlc_r -q64" --with-cxx="xlC_r -q64" --disable-ipv6 AR="ar -X64"
      prompt> make
      prompt> make install
  • post-review
    • The standard post-review Python script supplied by Review Board (see ServerInstallation-postreview) needs to be modified in the following way:

      #!/usr/local/bin/python

      REVIEWBOARD_URL = “http://172.25.2.112:8082/reviewboard&#8221;

      DIFF = “/usr/local/bin/diff”

      diff_cmd = [“diff” DIFF, “-urNp”, old_file, new_file]

      • Update shabang line to point to /usr/local/bin/python
      • Add definitions for the ReviewBoard server URL and full path to GNU diff.
      • Use full diff path when calling diff
    • Put the modified post-review script somewhere in your path.

Improving Review Board Performance With “memcached”

Installing memcached on the Review Board server can speed up operation of a busy site by reducing database access.

Python memcached package

  • Download the python memcached package from : ftp://ftp.tummy.com/pub/python-memcached/ . I used version 1.43.
  • Extract the tar.gz contents to a folder.
  • Change to the extracted folder and install the package, e.g.:
    prompt> cd python-memcached-1.43
    prompt> setup.py install

memchached

  • Download the latest memcached Win32 binary from http://code.jellycan.com/memcached/. I used version 1.2.6. You don’t need the libevent source from this site unless you want to compile the memcached source yourself.
  • Extract the contents of the zip file to a new folder
  • Just to get testing, start memcached at the command prompt (will try installing as a service later):
    prompt> cd memcached-1.2.6-win32-bin
    prompt> .\memcached -vv -m 256 -p 11211
    • -vv = gives very verbose logging
    • -m 256 = 256MB max memory size
    • -p 11211 says listen on port 11211 (the default anyway)

Review Board Config

  • Stop your web server (Apache in my case) – not sure if this is necessary, but just in case.
  • Open the local_settings.py file for your Review Board site, in my case C:\www\reviewboard\conf\settings_local.py
  • Find the CACHE_BACKEND setting. Comment out the existing one, and add instead:
    CACHE_BACKEND = 'memcached://localhost:11211/'
  • Start your web server.

Testing memcached

Open Review Board and do stuff. In the command windows where you started memcached you should see log output suggesting data is being found in the cache and returned to Review Board.

Installing memcached as a service

  • Go back to the command window where memcached was started from the command line.
  • Stop it with Ctrl+C
  • Install memcached as a windows service:
    prompt> .\memcached -d install
  • Set up the command parameters for memcached when started as a service. The only way to do this seems to be editing the service command line in the Windows registry. Edit the registry with care and at your own risk!!
    • Run regedit
    • Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\memcached Server
    • Double click ImagePath
    • Add your command parameters to the end of the existing command text after “-d runservice”, in my case: ” -m 256 -p 11211″
  • Start the memcached service (You only need to do this once, as memcached installs itself as an Automatic service by default that will start at boot time):
    prompt> .\memcached -d start

Getting Help

Review Board documentation here : http://www.review-board.org/docs/

Review Board FAQ here : http://www.review-board.org/docs/FAQ/

There’s also a mailing list : http://www.review-board.org/mailing-lists/

Here is quick summary of my current Review Board installation:

Windows XP Pro SP3

Review Board (1.0 alpha 2 – installed with dependencies not listed here using easy_install)

Cygwin patchutils (0.3.0-1)

MySQL (5.1.30)

Apache (2.2.11)

Python (2.5.4)

Setuptools (0.6c9)

mod_python (3.3.1)

Python Imaging Library (1.1.6)

MySQLDB (1.2.2)

Perforce (Client 2008.2)

9 Comments »

  1. Thanks for this guide. It enabled us to get ReviewBoard working. The client installation of post-review was particularly useful.

    Comment by Richard Bogle — 19 August 2009 @ 9:49 am

  2. Thank you so much for the instructions. I am a fresher to Corporate world. And I took around 10 hours in total to setup review board myself with your instructions and guidelines in review-board.org.
    Thank you once again

    Comment by rohith — 6 October 2009 @ 7:33 am

  3. I do not find anything as cer-post-review.py script in InstallingReviewBoard-postreview link as specified in Windows Client installation. If you could elaborate more on that it would be so useful. By the way, It was g8 link as it made by work so easy. Thanks

    Comment by mail4visu — 22 October 2010 @ 12:09 pm

  4. Thanks a lot. This should be made as the official installation guide on windows for reviewboard.

    Comment by DeepakM — 2 May 2011 @ 6:59 am

  5. Hi,

    I am new user, I have installed the RB, and when i logged into the RB it log me into the RB application, Now i wanted to customize this RB tool, hence i was looking for index.html but i couldn’t find it, Does this first page creates automatically.

    Comment by Nilesh — 25 May 2011 @ 9:56 am

  6. […] OK documentation and articles like Installing Review Board on Windows for Perforce provided good relief during installation. The initial hiccups with the setup (getting the right […]

    Pingback by Review with ReviewBoard « fastandsteady — 28 March 2012 @ 3:17 pm

  7. Wonderful website. Plenty off useful information here.

    I am sending it to some pals ans additionally sharing in delicious.
    And naturally, thank you on your sweat!

    Comment by block-in-queen.tumblr.Com — 31 May 2014 @ 11:47 pm

  8. Wynn documented revenue before last number of quartersit could possibly preserve stagnating, or maybe counterpicking. eddkakdggaeg

    Comment by Johne294 — 17 July 2014 @ 1:51 pm

  9. Hello
    I am thinking about taking prohormones, do you think this is good idea for advanced bodybuilder like me?
    Bodybuilders are satisfied with the results after prohormones cycles, just google for – prohormones
    factory – worth a try?

    Comment by Karissa — 9 October 2014 @ 6:16 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: