c631e35b5827 initial-docs

docs: add a section about deploying a public web ui
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sat, 03 Jul 2010 15:12:25 -0400
parents 6729a62067ab
children c28a2dae28ef
branches/tags initial-docs
files docs/webui.rst

Changes

--- a/docs/webui.rst	Sat Jul 03 15:12:06 2010 -0400
+++ b/docs/webui.rst	Sat Jul 03 15:12:25 2010 -0400
@@ -55,3 +55,62 @@
 
 Deployment to a Server
 ----------------------
+
+Although hg-review is built for *distributed* code review it's sometimes nice
+to provide a public interface. This will let people can comment easily without
+using the extension (or even cloning your project).
+
+You can use any WSGI server you like to provide a public instance of hg-review.
+Before you start you'll need to have Mercurial installed on your web server.
+
+Once you've got Mercurial running on the server you'll need to clone copies of
+hg-review, your project, and your project's review data to the web server.
+First create a directory where everything will live::
+
+    mkdir /var/www/myproject-review-interface/
+    cd /var/www/myproject-review-interface/
+
+Then grab a copy of hg-review::
+
+    hg clone http://bitbucket.org/sjl/hg-review/
+
+Grab a copy of your project and configure it to use the hg-review extension::
+
+    hg clone http://bitbucket.org/you/yourproject/
+    cd yourproject
+
+    echo '[extensions]' >> .hg/hgrc
+    echo 'review = /var/www/myproject-review-interface/hg-review/review' >> .hg/hgrc
+
+Use hg-review to pull down the review data::
+
+    hg review --init
+
+Now that you've got all the necessary data you can set up the WSGI script.
+Start by copying the included sample script::
+
+    cd /var/www/myproject-review-interface/
+    cp hg-review/contrib/deploy/wsgi.py wsgi.py
+
+Edit the script to configure your project to your liking. For reference, the
+relevant part of the script should look something like this::
+
+    # An example WSGI script for serving hg-review's web UI.
+    # Edit as necessary.
+
+    # If hg-review is not on your webserver's PYTHONPATH, uncomment the lines
+    # below and point it at the hg-review directory.
+    import sys
+    sys.path.insert(0, "/var/www/myproject-review-interface/hg-review")
+
+    REPO = '/var/www/myproject-review-interface/myproject'
+    READ_ONLY = True
+    ALLOW_ANON_COMMENTS = False
+    ANON_USER = 'Anonymous <anonymous@example.com>'
+    SITE_ROOT = 'http://yoursite.com/optional/path'
+    TITLE = 'Your Project'
+
+All that's left is to point your WSGI server at this script and fire it up. How
+you do that depends on your WSGI server. A sample configuration file for
+`Gunicorn <http://gunicorn.org/>`_ is provided in
+``contrib/deploy/gunicorn.conf.py``.