Azure Web Apps
Provision an Azure Web App via the Azure Portal and deploy an OntoPop API application to it.
Please note that the OntoPop backend open-source software project, which includes the event-driven data pipelines and APIs, is undergoing extensive redesign and refactoring as part of OntoPop Community 3.x in order to improve performance, security, extensibility and maintainability. As a result, the documentation on this page will be significantly updated. Please refer to the OntoPop Roadmap for further information.
Azure Web Apps (part of the Azure App Service) is an Azure cloud computing platform service that enables developers and platform engineers to deploy and scale web applications and web services developed in industry-standard languages including Java, Python, PHP, Ruby and Node.js. This page provides instructions on how to provision Azure Web Apps and then deploy the OntoPop API Spring Boot applications to them.
For further information regarding the Azure App Service, please visit https://azure.microsoft.com/en-gb/services/app-service.
It is recommended that you configure and integrate the steps described in this page into a CI/CD pipeline in order to automate the build, testing and deployment stages.
OntoPop provides Azure API Spring Boot application deployments that wrap around each of the API collections described in the logical system architecture. These Azure Spring Boot applications are provided out-of-the-box to enable quick and easy deployment to Azure Web Apps. Assuming that you have followed the instructions detailed in Build from Source, the Azure Spring Boot applications for each of the API collections may be found in the
$ONTOPOP_BASE/ontopop-apps/ontopop-apps-azure Maven module, which itself contains the following child modules pertinent to the OntoPop APIs:
ontopop-azure-app-api-ontology-management- Azure Spring Boot application deployment wrapper for the Management API endpoints.
ontopop-azure-app-api-ontology-triplestore- Azure Spring Boot application deployment wrapper for the Triplestore API endpoints.
ontopop-azure-app-api-ontology-graph- Azure Spring Boot application deployment wrapper for the Graph API endpoints.
ontopop-azure-app-api-ontology-search- Azure Spring Boot application deployment wrapper for the Search API endpoints.
Build from Source
In order to compile and build the OntoPop Azure API Spring Boot applications in preparation for deployment to Azure Web Apps, please follow the instructions detailed in Build from Source.
If you have not already done so when deploying the OntoPop Azure Function apps as described in Azure Functions, please install the Azure CLI as follows:
The instructions below are for Ubuntu 20.04. Installation instructions for other Linux distributions and other operating systems such as Windows may be found at https://docs.microsoft.com/en-us/cli/azure.
# Remove any old installations of the Azure CLI
$ sudo apt remove azure-cli -y && sudo apt autoremove -y
# Install the Azure CLI
$ curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
# Sign into your Azure account
$ az login
Azure Web App
We shall use the Azure Portal to provision Azure Web Apps. To do so, navigate to the App Services service via the Azure Portal, select "Create" and follow the instructions below:
- Subscription and Resource Group - select the Azure subscription and resource group to use for the new Azure Web App.
- Name - enter a custom name for the Azure Web app, for example
- Publish - select "Code".
- Runtime Stack - select "Java 11".
- Java Web Server Stack - select "Java SE (Embedded Web Server)".
- Operating System - select "Linux".
- App Service Plan - select (or create) a new app service plan, making a note of its SKU (for example p1v2).
Once configured, select "Review + Create" to create the new Azure Web App.
In the following instructions we use the
ontopop-azure-app-api-ontology-management child Maven module as an example with which to demonstrate how to deploy an API Spring Boot application to an Azure Web App. However these instructions can be equally applied to deploy any and all of the Azure API Spring Boot applications listed above.
- Create a new Azure Web App configured with the Java 11 runtime via the Azure Portal as detailed in the Setup section above. We shall call this Azure Web App
ontopop-management-apifor the purposes of these instructions.
- Assuming that you are integrating OntoPop with the Azure Key Vault secrets engine, to integrate the OntoPop Spring bootstrap context with Azure Key Vault we configure bootstrap.yml as follows:
The Azure Key Vault client ID (i.e. the app ID of the service principal object with privileges to read secrets from the relevant Azure Key Vault instance), client secret (i.e. the password of the service principal object to privileges to read secrets from the relevant Azure Key Vault instance), tenant ID and URI properties should be set as environment variables and NOT stored as plaintext in
bootstrap.yml. Thus these environment variables should be set in our Azure Web App as application settings. To do this, navigate to the relevant Azure Web App via the Azure Portal, then select "Configuration" and "Application Settings". Select "New Application Setting" and create all the environment variables defined in
- When deploying Java-based apps to Azure Web Apps, Azure requires us to explicitly provide the main Java class to invoke as an environment variable called
MAIN_CLASS. To do this, navigate to the relevant Azure Web App via the Azure Portal, then select "Configuration" and "Application Settings". Select "New Application Setting" and create a new application setting called
MAIN_CLASSwith the relevant value from the following table:
- Next we need to configure another environment variable called
JAVA_OPTSconfigured with the JVM memory parameters for our Azure Web App. To do this, navigate to the relevant Azure Web App via the Azure Portal, then select "Configuration" and "Application Settings". Select "New Application Setting" and create a new application setting called
JAVA_OPTSwith the value
- We have now set all the required Azure Web App environment variables. Press save to persist the new application settings (which will restart the Azure Web App).
- We are now ready to deploy the packaged Java Spring application artifact to the relevant Azure Web App. Assuming that you have followed the instructions detailed in the Setup section above, navigate to
$ONTOPOP_BASE/ontopop-apps/ontopop-apps-azure/ontopop-azure-app-api-ontology-management(in our example). Next open the
pom.xmlfile inside this directory with your preferred text editor. In order to deploy the compiled Java Spring application artifact to the remote Azure Web App using the Azure Webapp Maven Plugin, we need to define seven (7) environment variables in our deployment environment that are used in the
|The ID of the Azure subscription in which this Azure Web App is provisioned.
|The name of the resource group in which this Azure Web App is provisioned.
|The name of the Azure Web App.
|The SKU of the app service plan in which this Azure Web App is provisioned.
|The region in which this Azure Web App is provisioned.
|The name of the app service plan in which this Azure Web App is provisioned.
|The name of the resource group of the app service plan in which this Azure Web App is provisioned.
- Once these environment variables are set in our deployment environment, we can upload and deploy the packaged Java Spring application artifact to the relevant Azure Web App by executing the following commands via our command line:
# Login to the relevant Azure account
$ az login
# Explicitly set the name of the Azure subscription to use
$ az account set --subscription my-subscription
# Navigate to the relevant project folder
# Deploy the packaged artifact to the remote Azure Web App
$ mvn azure-webapp:deploy
The OntoPop API collection is now publicly available to serve HTTP requests at
https://ontopop-management-api.azurewebsites.net (in our example).
To configure a custom domain and secure the API, please configure Azure API Management accordingly as detailed at https://docs.microsoft.com/en-us/azure/api-management/configure-custom-domain.