NGINX Unit

Review Board§

To run the Review Board code review tool using Unit:

  1. Install Unit with a Python 2.7 language module.

  2. Install and configure Review Board’s prerequisites.

    Note

    We’ll use Unit as the web server, so you can skip the corresponding step.

  3. Install the core files and create a site. Here, it’s /path/to/app/; use a real path in your configuration:

    $ rb-site install /path/to/app/
    
          * Welcome to the Review Board site installation wizard
    
              This will prepare a Review Board site installation in:
    
              /path/to/app
    
              We need to know a few things before we can prepare your site for
              installation. This will only take a few minutes.
              ...
    
  4. Add the .py extension to the WSGI module’s name to make it discoverable by Unit, for example:

    $ mv /path/to/app/htdocs/reviewboard.wsgi   \
         /path/to/app/htdocs/wsgi.py
    
  5. Run the following command so Unit can access the application directory:

    # chown -R unit:unit /path/to/app/
    

    Note

    The unit:unit user-group pair is available only with official packages, Docker images, and some third-party repos. Otherwise, account names may differ; run the ps aux | grep unitd command to be sure.

    For further details, including permissions, see the security checklist.

    Also, make sure the following directories are writable:

    $ chmod u+w /path/to/app/htdocs/media/uploaded/
    
    $ chmod u+w /path/to/app/data/
    
  6. Next, prepare the Review Board configuration for Unit (use real values for share and path):

    {
        "listeners": {
            "*:80": {
                "pass": "routes"
            }
        },
    
        "routes": [
            {
                "match": {
                    "uri": [
                        "/media/*",
                        "/static/*",
                        "/errordocs/*"
                    ]
                },
    
                "action": {
                    "share": "/path/to/app/htdocs$uri"
                }
            },
            {
                "action": {
                    "pass": "applications/rb"
                }
            }
        ],
    
        "applications": {
            "rb": {
                "type": "python 2",
                "path": "/path/to/app/htdocs/",
                "module": "wsgi"
            }
        }
    }
    
  7. Upload the updated configuration. Assuming the JSON above was added to config.json:

    # curl -X PUT --data-binary @config.json --unix-socket \
           /path/to/control.unit.sock http://localhost/config/
    

    Note

    The control socket path may vary; run unitd -h or see Startup and Shutdown for details.

    After a successful update, browse to http://localhost and set up your Review Board installation:

    Review Board on Unit - Dashboard Screen