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.
Make sure to clone the repository using the
--recursive option, or
initialize submodules with
git submodule update --init --recursive.
From the root of the repository, run:
$ make dockerbuild
That will build the containers required for development: base and webapp.
Then run the webapp:
$ make dockerrun
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 postgresqland wait until it reports that the database is ready, then stop that and run
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/
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
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