How to set up Review Board on Windows

  • Post author:
  • Post category:Journal
  • Post last modified:February 8, 2020

Prerequisite

All of procedures in this document were tested on Windows Server 2003 Standard Edition. Review Board depends on Linux-based open source projects like Python, Apache, MySql, and etc. All of these also supports Windows, but it is well known that installing and configuring these are not easy. So I decided to use already-packaged solution.

Bitnami project

Bitnami project provides easy to setup web applications and infrastructure. If you are working on Windows, just click installer then it will make everything. Apache, MySQL, PHP, Ruby, Djanggo, and anything you want to install.

For Review Board, you’d better to install DjangoStack, I guess, because Review Board uses Python and Django. However, we’ve already been using WAMPStack due to MediaWiki. Now that installing two slightly different infrastructure on the same machine is a stupid thing, this document assumes that you have Apache 2.2, MySQL 5.1.30, and PHP 5 and don’t have Python and Django.

How to install

First, I’ll make it clear that all of these procedures are based on Review Board’s Installing on Windows document.

Installing Python Support

  1. Run Python 2.5 Installer. It’s safe to install version 2.5 or you should deal with some unexpected situations.

  2. Run Python Setuptools Installer. This tool help us install some Python libraries or applications easily. In this doc, we’ll use setuptools-0.6c9.win32-py2.5.exe.

  3. Now that we need to add two environment variables related to Python into system path.

  1. Click System icon on the Control Panel.

  2. Click on the Advanced tab.

  3. Click Environment Variables.

  4. Find PATH in System variables and click Edit.

  5. Add ;C:\Python25;C:\Python25\Scripts (substitute your Python directory if it’s not C:\Python25) to the end of the list.

Installing GNU Patch

In order to view diffs, you’ll need to install GNU patch.exe.

Just as Python, make sure that patch.exe in your PATH. We installed version 2.5.9. I think other new versions will also work fine.

Installing memcached

Installing memcached is not mandatory but strongly recommended for better performance.

  1. Download memcached for Windows. In this doc, we installed memcached-1.2.6-win32-bin.zip.

  2. Unzip this to the directory you want to keep memcached in (for example, C:\memcached).

  3. Install the service from the command line by typing the following from the memcached directory:

    memcached.exe -d install
    		
  4. Start the server through the Microsoft Management Console. You can go to Administrative Tools, and click Services.

  5. Install python-memcached by typing the following:

    easy_install python-memcached
    	

Installing Python Imaging Library

Here we installed Python Imaging Library 1.1.6 for Python 2.5.

Installing Review Board

Just type:

easy_install ReviewBoard

then Review Board and its dependencies are automatically installed.

Installing Database Bindings

We assumes that we’ll use MySQL for our ReviewBoard, so we need to install mysql-python:

easy_install mysql-python

You might get an error message like:

Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:\Users\JaeChoi>easy_install mysql-python
Searching for mysql-python
Reading http://pypi.python.org/simple/mysql-python/
Reading http://sourceforge.net/projects/mysql-python
Best match: MySQL-python 1.2.3c1
Downloading http://dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.
3c1.tar.gz
Processing MySQL-python-1.2.3c1.tar.gz
Running MySQL-python-1.2.3c1\setup.py -q bdist_egg --dist-dir c:\users\jaechoi\a
ppdata\local\temp\easy_install-37hfsj\MySQL-python-1.2.3c1\egg-dist-tmp-rjrwyj
error: The system cannot find the file specified

To solve this, you can go to mysql-python site and download a proper version of *.exe file for WIN32, for example MySQL-python-1.2.2.win32-py2.5.exe. Then click the installer.

Installing Perforce Components

Installing modpython

Find a proper version of WIN32 binary and install it. For this example, we’ll use ‘mod_python-3.3.1.win32-py2.5-Apache2.2.exe’.

Now, open httpd.conf(ex. C:\Program Files\BitNami WAMPStack\apache2\conf\httpd.conf) and add the following line:

LoadModule python_module modules/mod_python.so

How to configure

Now that we’ve installed all of components we need, we can go futher and setup our web application.

Installing a Review Board site

Just run the following command:

$ rb-site install ${BitnamiWebAppDir}\reviews

Change ${BitnamiWebAppDir} with whatever you want it to be. Usually this would be ‘C:\Program Files\BitNami WAMPStack\apps’. Ensure that ‘${BitnamiWebAppDir}\reviews’ is not already there.

You will be asked a series of questions about your site setup. Most important question is what path should be your site directory. For this example, w’ll use http://myserver/reviews.

Just keep in mind that you should create MySQL database (for instance, ‘reviewboard’) which will be used for Review Board before you answer the question and choose ‘mod_python’ because we’ll use it instead of fastcgi.

Configuriung a Apache

Before we configure Apache webserver properly, stop the httpd process.

rb-site would generate all the files needed to run Review Board and there must be ${BitnamiWebAppDir}\reviews\conf\apache.modpython.conf.

Open httpd.conf(ex. C:\Program Files\BitNami WAMPStack\apache2\conf\httpd.conf) and add a line into the end of this file:

Include "C:/Program Files/BitNami WAMPStack/apps/reviewboard/conf/apache-modpython.conf"

Now, open ‘${BitnamiWebAppDir}\conf\apache-modpython.conf’. This file is set for a single-domain configuration like ‘http://reviews.myserver.com’. You have to modify this configuration file as to the needs of your own. For example our file is like:

# Alias static media requests to filesystem
Alias /reviews "C:/Program Files/BitNami WAMPStack/apps/reviewboard/htdocs"
#Alias /reviews/media "C:/Program Files/BitNami WAMPStack/apps/reviewboard/htdocs/media"
#Alias /reviews/errordocs "C:/Program Files/BitNami WAMPStack/apps/reviewboard/htdocs/errordocs"

# Serve django pages
	<Location "/reviews/">
		#PythonPath "['C:\Python25'] + sys.path"
		PythonPath "['C:/Program Files/BitNami WAMPStack/apps/reviewboard/conf'] + sys.path"
		SetEnv DJANGO_SETTINGS_MODULE reviewboard.settings
		SetEnv PYTHON_EGG_CACHE "C:/Program Files/BitNami WAMPStack/apps/reviewboard/tmp/egg_cache"
		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 "/reviews/media">
		SetHandler None
	</Location>
	<Location "/reviews/errordocs">
		SetHandler None
	</Location>

<Directory "C:/Program Files/BitNami WAMPStack/apps/reviewboard/htdocs">
	# Error handlers
	ErrorDocument 500 /errordocs/500.html

	Allow from All
	AllowOverride All
</Directory>

Now restart Apache(httpd.exe) and open http://myserver/reviews. It should work!

Author Details
Kubernetes, DevSecOps, AWS, 클라우드 보안, 클라우드 비용관리, SaaS 의 활용과 내재화 등 소프트웨어 개발 전반에 도움이 필요하다면 도움을 요청하세요. 지인이라면 가볍게 도와드리겠습니다. 전문적인 도움이 필요하다면 저의 현업에 방해가 되지 않는 선에서 협의가능합니다.