Docker for QA¶
The following describes how to get a pre-built instance of Normandy for testing. This is not suitable for development, or serving traffic on the public internet.
This guide assumes you have already installed and set up the following:
Getting the code¶
We’ll be using Docker Compose to run Normandy and the needed services. The
repository normandy-compose contains the
docker-compose.yml file to
describe a Normandy system.
$ git clone https://github.com/mozilla/normandy-compose.git $ cd normandy-compose
Starting the server, and initial setup¶
Generate keys to use for SSL.
Start everything, in the background. This downloads Docker images if needed.
$ docker-compose up -d
Setup the database schema, and needed data
$ docker-compose run normandy ./manage.py migrate $ docker-compose run normandy ./manage.py update_actions $ docker-compose run normandy ./manage.py update_product_details $ docker-compose run normandy ./manage.py initial_data $ docker-compose run normandy ./manage.py createsuperuser
Open the site. If you are using Docker Machine, get your VM’s IP with
docker-machine ip. Otherwise, use localhost. A full URL (on Linux) is:
https://localhost:8443/control. Accept the self-signed certificate.
When finished, shut everything down.
$ docker-compose stop
This will preserve all data used by the containers. In the future, follow step 2 again to start the servers.
Any customization of the server should be done by editing
Using a different version of Normandy¶
To use a different version of Normandy (or any other Docker image in the group)
Normandy, change the line
image: mozilla/normandy:latest to
Changing configuration options¶
Normandy is configured through environment variables, which can be set by
services.normandy.environment. For example, to change the time that
recipes are cached for, add a line
DJANGO_CACHES_RECIPE_TIME: 5 in the
Any reference to
localhost should be replaced with the IP where Docker is
actually running. When using Docker Machine, this is the output of
The URL that the add-on will fetch recipes from. Set this to
https://localhost:8443/api/v1to use the local Normandy.
Note that this value must start with
https, otherwise the add-on will reject it.
Hash of the root key use for signing recipes. If you are testing against a local development server (using normandy-compose as mentioned above), you must set this to:
If you are testing against the production Normandy server, leave this set to its default value.