Our system is split into two distinct halves. One is the app which includes the react front-end and the Azure function back end, the deployment for which is nearly entirely automated by scripts in the deploy
folder. The other is the Sharepoint side of our project for which automatic deployment is not possible. TODO: the "Sharepoint" deployment isn't just sharepoint and some of it is automated, this sentence should be fixed.
The Sharepoint deployment must happen before the app deployment as the app depends on URLs from the Sharepoint deployment. Below is the guide for SharePoint deployment: Deployment Guide
python
version 3 installed.virtualenv
(You can run pip install virtualenv
, you must ensure that this is the pip
for python3).nodejs
(which should come with npm
) for you system. Make sure you install a recent LTS version.terraform
(a tested version is 0.14
).npm i -g azure-functions-core-tools@3 --unsafe-perm true
(npm
should be installed when you installed node). You must install version 3.az login
then login with the account that you want to deploy with (this account will own all the resources).az account set --subscription <subscription-id>
.The deployment of the app is configured using a file called app_config.yaml
. It is configured so that it will not be stored in the git
history as it may contain sensitive information. An example is found at app_config.yaml.example
. You should copy this file and rename the copy to app_config.yaml
. It must be stored in the root of the project. The example file is self documented.
The next commands assume that you have a shell open in the deploy
directory.
Before you begin the deployment script you must first setup the environment by running the setup_env.sh
script. This will install the python dependencies for the script. To run the script you can run sh setup_env.sh
or ./setup_env.sh
. Once that's done you can enter the python virtual environment by running source env/bin/activate
(NOTE: you can skip entering the virtualenv if pyyaml
is installed globally, but this it not recommended).
You are now ready to run python deploy.py
(again assuming that python3 is installed as python
).
It will first check all the dependencies telling you if you need to install anything or run any commands. If everything is ready to go it will print out your deploy config and the subscription that it's going to deploy to, if it looks good you can type y
and then hit enter.
The deployment of azure resources can take a very long time (sometimes multiple hours) so you need to be patient. You may be asked for confirmation later on, usually you can just accept.
At the end of the deployment you are given the deployed URL of the app (future developers extending our app will allow for custom URLs to be given rather than long auto-generated ones).
You should create backups of the app_config.yaml
file in the root and the file terraform.tfstate
in the terraform
folder. Both these files are hidden from the git history and both contain sensitive data and they are all that is required (apart from the source code) for redeployment/upgrades. If you do not save the terraform.tfstate
and the app is updated you will have to create a new instance of the app (it will not update the old version).
At any time you are able to re-download our source code and then place app_config.yaml
and terraform.tfstate
in the correct locations and everything will work fine.