DEPRECATED: The settings that this image manages are now available through environment variables in GPII/universal.
Builds a GPII Preference Server Docker container image. The image is built using the Ansible role.
A separate sidecar container exists for initializing the dataset.
- build Ansible-provisioned image:
docker build -t gpii/preferences-server .
COUCHDB_HOST_ADDRESS
: host address of the couchdb instance to use. You will typically need to be explicit about this. (default:localhost:5984
)NODE_ENV
: specifies the configuration file to be used from https://github.com/GPII/universal/tree/master/gpii/configs when launching (default:preferencesServer.production
)CONTAINER_TEST
: whether or not to run the container in test mode, then exit (default:false
)
The container can be tested by setting the CONTAINER_TEST environment variable to true:
docker run -d --name couchdb klaemo/couchdb
docker run --rm --link couchdb -e CLEAR_INDEX=true -e COUCHDB_HOST_ADDRESS=couchdb:5984 gpii/preferences-server-data-loader
docker run --rm -it --name prefservertest --link couchdb -e NODE_ENV=preferencesServer.production -e CONTAINER_TEST=true -e NODE_ENV=preferencesServer.production -e COUCHDB_HOST_ADDRESS="couchdb:5984" gpii/preferences-server
This is expected to be run after launching a couchdb container & priming it with test data (or similar) as part of a smoke integration test before pushing a rebuilt image. The container will exit after the test and the exit code as a result of the run command can be used for further actions.
- running requires a couchdb instance accessible to the container (likely primed with test data)
- fully containerized example, assuming the DB needs to be primed (using the sidecar container):
docker run -d -p 5984:5984 --name couchdb klaemo/couchdb
docker run --rm --link couchdb -e CLEAR_INDEX=true COUCHDB_HOST_ADDRESS=couchdb:5984 gpii/preferences-server-data-loader
docker run --name prefserver -d -p 8082:8082 --link couchdb -e NODE_ENV=preferencesServer.production -e COUCHDB_HOST_ADDRESS=couchdb:5984 gpii/preferences-server
build.yml
- playbook for building the container imagerun.yml
- playbook for runtime deployment steps (reconfiguring couchdb address, application environment and priming the DB), runs when the container is run - uses dynamically createdrun-vars.yml
to pass environment variables fromdocker run
to Ansible playbook, then starts the application as a foreground process using supervisordrun.sh
- createsrun-vars.yml
based on environment variables fromdocker run
, runsrun.yml
for runtime deployment steps, and starts the preferencesServer using supervisord