Verify NIF certified data; MyTardis, Celery task, Django application
To use the latest production MyTardis Docker image to base the code against perform the following:
- Install Docker and Compose. Add your user account to the docker group so that you can control the docker daemon without having to run the instructions as a root user.
- Create a development directory.
- Inside the development directory add a src/ directory.
- git clone any source code you are working on in relation to your development into your src/ directory.
- Do not use git sub-modules as this Git feature is not for actively working on code.
- Copy or symlink (preferred) the docker-compose.yml to the root of your development directory and alter the yaml "volumes:" array to bind mount your code into the correct location inside the docker image.
- From your development directory issue the 'docker-compose up -d' command.
- This will download the appropriate Docker images and start the services in Development mode to begin and test your new code.
Directory structure:
- Dev/
|- src/
| |- nifcert/ ; git clone https://github.com/UWA-FoS/mytardis-nifcert src/nifcert
|- docker-compose.yml ; ln -s ./src/nifcert/docs/docker-compose.yml
Basic work example:
docker-compose exec django python manage.py shell
>>> from nifcert.tasks import add
>>> res = add.delay(2,2)
>>> res.id
>>> res.get(timeout=1)
This example starts the django shell within the django Docker container, loads the task method that is to be tested, submits the task to the message queue and then requests the returned value with a timeout of 1 second. Logged outputs for both Django and Celery can be viewed using the commands bellow.
docker-compose logs celery
docker-compose logs django