Feature/Add Azure deployment automation #72
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently the application can easily be deployed to Heroku via the Procfile. This change adds an ARM template to additionally easily deploy the application to Azure.
To make management of the application as straight forward as possible, the ARM template leverages PaaS solutions: the Django application is deployed via the Docker container to a Web App for Containers and the app's data storage is a managed PostgreSQL instance.
For additional security, the PostgreSQL database is configured to only allow connections from other Azure IPs. If someone wishes to connect to the database manually, e.g. via pgadmin, the client's IP must be white-listed in the database server's firewall (instructions).
Given that the resources are deployed asynchronously by ARM, sometimes the web app may be provisioned before the database is set up or before the database server's firewall is correctly set up. To prevent race conditions, this change includes a Django management script that makes the application wait until the database is available before starting up. This script will also be useful in other contexts such as using an external database linked to the application in docker-compose or kubernetes.