An example project that demonstrates how to create a hypermedia API using Django REST framework and document it using Gherkin tests, developed for PyCon Sette. (slides)
It also demonstrates how to do continuous delivery using Docker and Ansible. (slides)
Read the documentation at Relish
The source code is available on GitHub.
A Docker image is available on Docker Hub.
registronavale
: The Django projectship_registry
: The ship registry appdrf_hal
: HAL-specific functionality
The Dockerfile
, scripts in scripts
and the files in config
are used to
build a Docker container to run the Django project.
The ansible
directory contains an Ansible playbook and roles that deploy the
project to a server. It will deploy both the master branch and any GitHub pull
requests.
You need to set ANSIBLE_VAULT_PASSWORD
to the Ansible Vault password used to
encrypt sensitive information.
EXPORT ANSIBLE_VAULT_PASSWORD=xxxxxx
cd ansible
ansible-playbook deploy.yml
The project is tested using feature tests written in the Gherkin language. These
can be found in features
. When deploying the master branch, the features are
pushed to Relish where they are rendered as HTML documentation.
The scripts/integration.sh
script handles the continuous deployment. Although
the project is set up to deploy using Travis CI, it uses Docker containers in
orden to be independent of the CI implementation. Running the deployment scripts
requires the following variables to be set:
ANSIBLE_VAULT_PASSWORD
: for decrypting sensitive variables when running the Ansible playbook.DOCKER_EMAIL
,DOCKER_USERNAME
andDOCKER_PASSWORD
: for pushing the Docker image to Docker Hub.RELISH_API_TOKEN
: for pushing the features to Relish.