Setting up Azure Functions
The functions
backend is an Azure Durable Functions app that can execute SAME runs. In order to use it, you will first need to deploy the app to an Azure subscription that you own, and then configure SAME to send requests to it.
Prerequisites¶
You will need the following tools to deploy the functions
backend:
Initial Setup¶
First, clone the same-project
git repository:
git clone https://github.com/SAME-Project/same-project.git
cd same-project
Next, you will need to authorise terraform
to deploy resources to your Azure account. This can either be done using your personal user account, or by using a service principal you have created for this purpose.
Apply the Terraform¶
The functions
backend provides Terraform scripts for provisioning the Azure resources it needs:
cd sameproject/ops/functions/terraform
terraform init
terraform apply
Once terraform
has finished provisioning the resources, take note of the name and hostname of the function app that was created:
export FUNCTIONS_APP_NAME=$(terraform output -raw app_name)
export FUNCTIONS_HOST_NAME=$(terraform output -raw host_name)
Deploy the Functions App¶
Next, you will need to deploy the SAME functions
backend to your newly provisioned resources:
cd - && cd sameproject/ops/functions/functions
func azure functionapp publish $FUNCTIONS_APP_NAME
Once the deployment has finished you should be able to see the functions in the Azure Functions portal:
The portal allows you to see which functions are active in the function app:
Clicking on one of these functions will bring up some useful tools for debugging and monitoring the app:
Test the Deployment¶
You are now ready to execute SAME runs on Azure Functions!
To test your deployment, you can run one of the test suite notebooks in the same-project
repository:
cd - && cd test/testdata/features/singlestep
same run -t functions -f same.yaml \
--functions-host-name "${FUNCTIONS_HOST_NAME}"
Limitations¶
The Azure Functions backend does not support custom Docker images in SAME config files. All python dependencies must be specified using a requirements.txt
, and non-python dependencies are not currently supported.