This Todo List app is a Java application. It provides end-to-end CRUD operation to todo list item from front-end AngularJS code. Behind the scene, todo list item data store is Azure CosmosDB DocumentDB. This application uses Azure CosmosDB DocumentDB Spring Boot Starter and AngularJS to interact with Azure. This sample application provides several deployment options to deploy to Azure, pls see deployment section below. With Azure support in Spring Starters, maven and gradle plugins and Eclipse / IntelliJ plugins, Java application development and deployment on Azure are effortless now.
- Requirements
- Create Azure Cosmos DB documentDB
- Configuration
- Build
- Run Locally
- Deploy Spring Boot Jar to Azure App Service on Windows
- Contribution
- Useful link
You can follow our steps using Azure CLI 2.0 to deploy an Azure Cosmos DB documentDB, or follow this article to create it from Azure portal.
-
login your Azure CLI, and set your subscription id
az login az account set -s <your-subscription-id>
-
create an Azure Resource Group, and note your group name
az group create -n <your-azure-group-name> -l <your-resource-group-region>
-
create Azure Cosmos DB with DocumentDB kind. Note the
documentEndpoint
field in the response.az cosmosdb create --kind GlobalDocumentDB -g <your-azure-group-name> -n <your-azure-documentDB-name>
Note name of cosmos db must be in lowercase.
-
get your Azure Cosmos DB key, get the
primaryMasterKey
of the DocumentDB you just created.az cosmosdb list-keys -g <your-azure-group-name> -n <your-azure-documentDB-name>
Note down your DocumentDB uri and key from last step, specify a database name but no need to create it. Pick an Azure Resource Group name and Web app name for App Service on Windows - you can use an existing resource group and Web app or let the Gradle plugin create these for you. Set these values in system environment variables:
DOCUMENTDB_URI=put-your-documentdb-uri-here
DOCUMENTDB_KEY=put-your-documentdb-key-here
DOCUMENTDB_DBNAME=put-your-documentdb-databasename-here
WEBAPP_RESOURCEGROUP_NAME=put-your-resourcegroup-name-here
WEBAPP_NAME=put-your-webapp-name-here
gradle bootJar
Run the todo list app locally.
java -jar todoapp.jar
Install a SNAPSHOT version of the Gradle Plugin for Azure Web Apps:
git clone https://github.com/lenala/azure-gradle-plugins.git
cd azure-webapp-gradle-plugin
./gradlew install
Deploy in one step. You can redeploy the app with the same command once the changes are made.
gradle azureWebappDeploy
Open it in a browser
Delete the Azure resources you created by running the following command:
az group delete -y --no-wait -n <your-resource-group-name>