Developer Setup with Docker

The following describes how to set up an instance of the site on your computer for development with Docker and docker-compose.

Warning

These installation steps are made for development only. It is not recommended to run Pontoon via Docker in production.

Note

Installation via Docker is still a fresh feature. Problems might happen, bugs might be met. If you have any troubles with it, please file a bug or propose a patch!

Prerequisites

  1. Install Docker.
  2. Install docker-compose. You need 1.10 or higher.
  3. Install make using either your system’s package manager (Linux) or homebrew (OSX). On Windows, you can use MozillaBuild.

Quickstart

Make sure to clone the repository using the --recursive option, or initialize submodules with git submodule update --init --recursive.

  1. From the root of the repository, run:

    $ make dockerbuild
    

    That will build the containers required for development: base and webapp.

  2. Then run the webapp:

    $ make dockerrun
    

    Note

    The first time you run this, the PostgreSQL container needs to do some work before it becomes available to the webapp container. Hence, the webapp might not be able to perform things like migrations. You can simply wait for the postgresql container to report that it’s ready, then abort the process, then restart it. That should let the webapp do all its setup as expected.

    Alternatively, you can run docker-compose up postgresql and wait until it reports that the database is ready, then stop that and run make dockerrun.

  3. Finally you need to run some setup steps, while the webapp is running:

    $ make dockersetup
    

    This will ask you to create a superuser, and then will update your Firefox account settings.

At that point, you’re good to go. Access the webapp via this URL: http://localhost:8000/

Database

By default, you will have default data loaded for only the Pontoon Intro project. If you have a database dump, you can load it into your PostgreSQL database by running:

$ make dockerloaddb DB_DUMP_FILE=path/to/my/dump

Note that your database container needs to be running while you do that. You can start just the postgresql container by runnin:

$ docker-compose run postgresql

Running tests

To run the entire test suite, simply run:

$ make dockertest

If you want to run only some unit tests, or want to avoid rebuilding the docker container every time you run tests, you can start a shell that will allow to run your own commands. To do that, run:

$ make dockershell
app@675af05d66ae:/app$ python manage.py test