Skip to content

Latest commit

 

History

History
 
 

todo-app-java-on-azure.jar

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Deploy Todo List App =TO=> Tomcat in Azure App Service Linux

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.

TOC

Requirements

Create Azure Cosmos DB documentDB

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.

  1. login your Azure CLI, and set your subscription id

    az login
    az account set -s <your-subscription-id>
  2. create an Azure Resource Group, and note your group name

    az group create -n <your-azure-group-name> -l <your-resource-group-region>
  3. 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.

  4. 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>

Configuration

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

Build Todo List Web App - JAR

gradle bootJar

Run it locally - OPTIONAL STEP

Run the todo list app locally.

java -jar todoapp.jar

Deploy Spring Boot Jar to Azure App Service on Windows

Temporary Step - Until the Gradle Plugin for Azure Web Apps is released

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 to Azure App Service on Windows

Deploy in one step. You can redeploy the app with the same command once the changes are made.

gradle azureWebappDeploy

Open the todo list Web app

Open it in a browser

Clean up

Delete the Azure resources you created by running the following command:

az group delete -y --no-wait -n <your-resource-group-name>