Deployment Environment

RelengAPI is designed for flexible deployment. It is a simple WSGI application that can run on a developer's laptop or in a production environment.

In practice, it runs on a cluster of VMs at Mozilla, using Apache Httpd and mod_wsgi. However, in principle nothing in the design of the system precludes hosting on services like Elastic Beanstalk, Heroku or Mozilla's PaaS.

Mod_wsgi Configuration

The Mozilla deployment of RelengAPI has a WSGI file that looks like this:

import os
this_dir = os.path.dirname(__file__) or os.getcwd()

# activate the virtualenv containing relengapi's dependencies
activate_this = os.path.join(this_dir, 'virtualenv', 'bin', '')
execfile(activate_this, dict(__file__=activate_this))

# set up application logging
import sys
import structlog
import structlog.handlers

root = logging.getLogger('')

formatter = logging.Formatter('%(asctime)s [%(name)s] %(message)s')

apache_log = logging.StreamHandler(sys.stderr)

from cloghandler import ConcurrentRotatingFileHandler
relengapi_log = ConcurrentRotatingFileHandler('/var/log/relengapi/relengapi.log', 'a', 256*1024, 300)


# load the wsgi app with its settings
from import create_app
import os
os.environ['RELENGAPI_SETTINGS'] = os.path.join(this_dir, '')
application = create_app()

RelengAPI processes the Authorization header on its own to handle token authentication. However, mod_wsgi filters this header out by default. To fix this, set WSGIPassAuthorization On in your Apache configuration.