Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

458 lines (304 sloc) 14.48 kB


Core developers run Kuma in a Vagrant-managed virtual machine so we can run the entire MDN stack. (Django, KumaScript, Search, Celery, etc.) If you're on Mac OS X or Linux and looking for a quick way to get started, you should try these instructions.


If you have problems getting vagrant up, check Errors below.

Install and run everything

  1. Install VirtualBox >= 4.2.x from


    (Windows) After installing VirtualBox you need to set PATH=C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe;

  2. Install vagrant >= 1.7 using the installer from

  3. Install Ansible on your machine so that Vagrant is able to set up the VM the way we need it.

    See the Ansible Installation docs for which way to use on your computer's platform.

    The most common platforms:

    Mac OS X:

    brew install ansible

    or if you have a globally installed pip:

    sudo pip install ansible


    $ sudo apt-get install software-properties-common
    $ sudo apt-add-repository ppa:ansible/ansible
    $ sudo apt-get update
    $ sudo apt-get install ansible

    Fedora / RPM-based distribution:

    $ sudo dnf install ansible.noarch

    For previous versions based on yum, use:

    $ sudo yum install ansible.noarch


    Installation on Windows is complicated but we strive to make it easier in the future. Until then see this blog post for how to Run Vagrant with Ansible Provisioning on Windows

  4. Fork the project. (See GitHub <>)

  5. Clone your fork of Kuma and update submodules:

    git clone<your_username>/kuma.git
    cd kuma
    git submodule update --init --recursive
  6. Start the VM and install everything. (approx. 15 minutes on a fast net connection).:

    vagrant up


    VirtualBox creates VMs in your system drive. Kuma's VM is approx. 2GB. If it won't fit on your system drive, you will need to change that directory to another drive.

    At the end, you should see:

    Finished catalog run in .... seconds

    If the above process fails with an error, check Errors.

  7. Log into the VM with ssh:

    vagrant ssh
  8. Use foreman inside the VM to start all site services:

    foreman start

    You should see output like:

    20:32:59 web.1        | started with pid 2244
    20:32:59 celery.1     | started with pid 2245
    20:32:59 kumascript.1 | started with pid 2246
    20:32:59 stylus.1     | started with pid 2247
  9. Visit and add an exception for the security certificate if prompted.

  10. Visit the homepage at

  11. You've installed Kuma!

    If you want the badge please email a screenshot of your browser to receive the badge.


Pure Python Packages

All of the pure Python dependencies are included in the git repository, in the vendor subdirectory. This allows them to be available on the Python path without needing to be installed in the system, allowing multiple versions for multiple projects simultaneously.

Compiled Python Packages

There are a small number of compiled packages, including the MySQL Python client. You can install these using pip or via a package manager. To use pip, you only need to do the following.

First SSH into the Vagrant VM:

vagrant ssh

Then disable the virtualenv that is auto-enabled and install the compiled dependencies:

sudo pip install -r requirements/compiled.txt



If you'd like to change the way Vagrant works, we've added a few configuration values that may be worthwhile to look at. In case something doesn't suffice for your machine, please let us know!

To change the config values, simply create a dotenv file (.env) in the directory (/home/vagrant/src/.env in the Vagrant VM) and write <KEY>=<VALUE> for each configuration variable you'd like to set.

Here's the configuration variables that are available for Vagrant:


    Default: true (Windows: false) Whether or not to use NFS for the synced folder.


    The size of the Virtualbox VM memory in MB. Default: 2048


    The number of virtual CPU core the Virtualbox VM should have. Default: 2


    The static IP the Virtualbox VM should be assigned to. Default:


    Whether the Virtualbox VM should boot with a GUI. Default: false


    Whether the Ansible provisioner should print verbose output. Default: false

A possible /home/vagrant/src/.env file could look like this for example:


The kuma project

Start by creating a file named, and putting this line in it:

from settings import *

Now you can copy and modify any settings from into and the value will override the default.


For some basic features you'll need to use :doc:`feature toggles <feature-toggles>` to enable them.


At a minimum, you will need to define a database connection. An example configuration is:

    'default': {
        'NAME': 'kuma',
        'ENGINE': 'django.db.backends.mysql',
        'HOST': 'localhost',
        'PORT': '3306',
        'USER': 'kuma',
        'PASSWORD': 'kuma',
        'OPTIONS': {
            'sql_mode': 'TRADITIONAL',
            'charset': 'utf8',
            'init_command': 'SET '
        'ATOMIC_REQUESTS': True,
        'TEST': {
            'CHARSET': 'utf8',
            'COLLATION': 'utf8_general_ci',

Note the two values CHARSET and COLLATION of the TEST setting. Without these, the test suite will use MySQL's (moronic) defaults when creating the test database (see below) and lots of tests will fail. Hundreds.

Once you've set up the database, you can generate the schema with Django's migrate command:

./ migrate

This will generate an empty database, which will get you started!


If you want to see images and have the pages formatted with CSS you need to set your with the following:

DEBUG = True

Setting DEBUG = False will put the installation in production mode and ask for minified assets. In that case, you will need to generate CSS from stylus and compress resource:

./ compress_assets


To enable KumaScript (Kuma's template system):

  1. Sign in
  2. Visit the constance config admin panel
  3. Change KUMASCRIPT_TIMEOUT to 600
  4. Click "Save" at the bottom

KumaScript is now enabled. You will also want to import the KumaScript auto-loaded modules. You can simply copy & paste them from the production site to your local site at the same slugs. Or you can email the list to get a .json file to load in your local django admin interface as described in this comment.

Mozilla Product Details

One of the packages Kuma uses, Django Mozilla Product Details, needs to fetch JSON files containing historical Firefox version data and write them to disk. To set this up, just run:

./ update_product_details do the initial fetch or run it again to update it.

GitHub Auth

To enable GitHub authentication ...

Register your own OAuth application on GitHub:

Add a django-allauth social app for GitHub:

  • Provider: GitHub
  • Name:
  • Client id: <your GitHub App Client ID>
  • Secret key: <your GitHub App Client Secret>
  • Sites: -> Chosen sites

Now you can sign in with GitHub at

Persona Auth

Add the following to so that Persona works with the development instance:

SITE_URL = 'http://localhost:8000'
PROTOCOL = 'http://'
DOMAIN = 'localhost'
PORT = 8000
SESSION_COOKIE_SECURE = False # needed if the server is running on http://

The SESSION_EXPIRE_AT_BROWSER_CLOSE setting is not strictly necessary, but it's convenient for development.

Secure Cookies

To prevent error messages like Forbidden (CSRF cookie not set.):, you need to set your with the following:


Testing it Out

To start the dev server, run ./ runserver, then open up http://localhost:8000. If everything's working, you should see the MDN home page!

You might need to first set LC_CTYPE if you're on Mac OS X until bug 754728 is fixed:

export LC_CTYPE=en_US

Create an admin user

You will want to make yourself an admin user to enable important site features.

  1. Sign up/in with Persona

  2. After you sign in, SSH into the VM and make yourself an admin (exchange << YOUR_USERNAME >> with the username you used when signing up for Persona):

    vagrant ssh
    mysql -ukuma -pkuma kuma -e "UPDATE auth_user set is_staff = 1, is_active=1, is_superuser = 1 WHERE username = '<< YOUR_USERNAME >>';"

    You should see:

    Query OK, 1 row affected (0.01 sec)
    Rows matched: 1  Changed: 1  Warnings: 0

Create pages

You can visit to create new wiki pages as needed.

Many core MDN contributors create a personal User:<username> page as a testing sandbox.

Developing with Vagrant

Edit files as usual on your host machine; the current directory is mounted via NFS at /home/vagrant/src within the VM. Updates should be reflected without any action on your part.

  • See :doc:`development <development>` for tips not specific to vagrant.

  • Useful vagrant sub-commands:

    vagrant ssh     # Connect to the VM via ssh
    vagrant suspend # Sleep the VM, saving state
    vagrant halt    # Shutdown the VM
    vagrant up      # Boot up the VM
    vagrant destroy # Destroy the VM

Errors during vagrant up

vagrant up starts the virtual machine. The first time you run vagrant up it also provisions the VM - i.e., it automatically installs and configures Kuma software in the VM. We provision the VM with Ansible roles in the provisioning directory.

Sometimes we put Ansible roles in the wrong order. Which means some errors can be fixed by simply provisioning the VM again:

vagrant provision

In some rare occasions you might need to run this multiple times. If you find an error that is fixed by running vagrant provision again, please email us the error at and we'll see if we can fix it.

If you see the same error over and over, please ask for :ref:`more help <more-help>`.

Django database migrations

If you see errors that have "Django database migrations" in their title try to manually run them in the VM to see more about them. To do so:

vagrant ssh
python migrate

If you get an error, please ask for :ref:`more help <more-help>`.


On Ubuntu, vagrant up might fail after being unable to mount NFS shared folders. First, make sure you have the nfs-common and nfs-server packages installed and also note that you can't export anything via NFS inside an encrypted volume or home dir. On Windows NFS won't be used ever by the way.

If that doesn't help you can disable NFS by setting the VAGRANT_NFS configration value in a .env file. See the :ref:`Vagrant configuration <vagrant-config>` options for more info.

If you have other problems during vagrant up, please check :doc:`Troubleshooting <troubleshooting>`.

Jump to Line
Something went wrong with that request. Please try again.