From 26e827bc769a5b2467b9acd381ec2e9a8ba56ca1 Mon Sep 17 00:00:00 2001 From: nicolehaugen79 Date: Tue, 16 Jan 2018 15:04:38 -0600 Subject: [PATCH 1/4] Update README.md Updated the ReadMe to reflect the specific steps required to configure AI. --- README.md | 122 ++++++++++-------------------------------------------- 1 file changed, 21 insertions(+), 101 deletions(-) diff --git a/README.md b/README.md index 31e60b09..5efee193 100644 --- a/README.md +++ b/README.md @@ -1,108 +1,28 @@ # Todo App Java On Azure -This TodoList app is an Azure 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](https://docs.microsoft.com/en-us/azure/cosmos-db/documentdb-introduction). This application uses [Azure CosmosDB DocumentDB Spring Boot Starter](https://github.com/Microsoft/azure-spring-boot/tree/master/azure-starters/azure-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 plugins and Eclipse/IntelliJ plugins, Azure Java application development and deployment is effortless now. - - -## TOC - -* [Requirements](#requirements) -* [Create Azure Cosmos DB documentDB](#create-azure-cosmos-db-documentdb) -* [Configuration](#configuration) -* [Run it](#run-it) -* [Contribution](#contribution) -* Add new features - * [Add AAD](https://github.com/Microsoft/todo-app-java-on-azure/tree/aad-start) - * [Add KeyVault]() -* Deployment - * [Deploy to Azure Web App for Containers using IntelliJ plugin](./doc/deployment/deploy-to-azure-web-app-using-intelliJ-plugin.md) - * [Deploy to Azure Web App for Containers using Eclipse plugin](./doc/deployment/deploy-to-azure-web-app-using-eclipse-plugin.md) - * [Deploy to Azure Container Service Kubernetes cluster using Maven plugin](./doc/deployment/deploy-to-azure-container-service-using-maven-plugin.md) - * [Deploy to Azure Web App for Containers using Maven plugin](./doc/deployment/deploy-to-azure-web-app-using-maven-plugin.md) -* [Useful link](#useful-link) +This TodoList app is an Azure 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](https://docs.microsoft.com/en-us/azure/cosmos-db/documentdb-introduction). This application uses [Azure CosmosDB DocumentDB Spring Boot Starter](https://github.com/Microsoft/azure-spring-boot/tree/master/azure-starters/azure-documentdb-spring-boot-starter) and AngularJS to interact with Azure. In particular, this version of the application shows how to use [Azure Application Insights](https://docs.microsoft.com/en-us/azure/application-insights/app-insights-java-get-started) to monitor the performance and usage of the application. ## Requirements - -* [JDK](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) 1.8 and above -* [Maven](https://maven.apache.org/) 3.0 and above - -## Create Azure Cosmos DB documentDB - -You can follow our steps using [Azure CLI 2.0](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) to deploy an Azure Cosmos DB documentDB, -or follow [this article](https://docs.microsoft.com/en-us/azure/cosmos-db/create-documentdb-java) to create it from Azure portal. - -1. login your Azure CLI, and set your subscription id - - ```bash - az login - az account set -s - ``` -1. create an Azure Resource Group, and note your group name - - ```bash - az group create -n -l - ``` - -1. create Azure Cosmos DB with DocumentDB kind. Note the `documentEndpoint` field in the response. - - ```bash - az cosmosdb create --kind GlobalDocumentDB -g -n - ``` - **Note** name of cosmos db must be in lowercase. - -1. get your Azure Cosmos DB key, get the `primaryMasterKey` of the DocumentDB you just created. - - ```bash - az cosmosdb list-keys -g -n - ``` +* [Azure Cosmos DB DocumentDB](https://docs.microsoft.com/en-us/azure/cosmos-db/create-sql-api-java) +* [Azure App Insights](https://docs.microsoft.com/en-us/azure/application-insights/app-insights-create-new-resource) +* JDK 1.8 and above +* Maven 3.0 and above +* Clone ai branch ## Configuration -* Note your DocumentDB uri and key from last step, specify a database name but no need to create it. - Then modify `src/main/resources/application.properties` file and save it. - - ``` txt - azure.documentdb.uri=put-your-documentdb-uri-here - azure.documentdb.key=put-your-documentdb-key-here - azure.documentdb.database=put-your-documentdb-databasename-here - ``` - -* If you don't want to modify configuration in the source code manually, you can put variables in this file and - set their values in system environment variables: `DOCUMENTDB_URI`, `DOCUMENTDB_KEY` and `DOCUMENTDB_DBNAME`. - Then maven will substitute them during the build phase. - ``` txt - azure.documentdb.uri=@env.DOCUMENTDB_URI@ - azure.documentdb.key=@env.DOCUMENTDB_KEY@ - azure.documentdb.database=@env.DOCUMENTDB_DBNAME@ - ``` - -## Run it - -1. package the project using `mvn package` -1. Run the project using `java -jar target/todo-app-java-on-azure-1.0-SNAPSHOT.jar` -1. Open `http://localhost:8080` you can see the web pages to show the todo list app - -## Clean up - -Delete the Azure resources you created by running the following command: - -```bash -az group delete -y --no-wait -n -``` - -## Contributing - -This project welcomes contributions and suggestions. Most contributions require you to agree to a -Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us -the rights to use your contribution. For details, visit https://cla.microsoft.com. - -When you submit a pull request, a CLA-bot will automatically determine whether you need to provide -a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions -provided by the bot. You will only need to do this once across all repos using our CLA. - -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or -contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. - -## Useful link -- [Azure Spring Boot Starters](https://github.com/Microsoft/azure-spring-boot) -- [Azure Maven plugins](https://github.com/Microsoft/azure-maven-plugins) +* Follow the steps for creating the Azure App Insights resource (as shown in the Requirements section) and copy the instrumentation key. + Paste the instrumentation key into the 'src/main/resources/ApplicationInsights.xml' file and save it. + + + put-your-instrumentation-key-here + +* In addition, you may notice that the following has already been configured for you to setup App Insights: +1. The dependency to Application Insights has been added to the pom.xml: + + com.microsoft.azure + applicationinsights-web + [1.0,) + + +2. The 'src/main/java/com/microsoft/azure/sample/AppInsightsConfig.java' file has been added to register the HTTP filter using SpringBoot's FilterRegistrationBean. This results in each of the HTTP requests to be logged to Application Insights. From 9dd4220ed4a3671f7330b3e8ca9cddaa0e0e103e Mon Sep 17 00:00:00 2001 From: nicolehaugen79 Date: Wed, 17 Jan 2018 09:01:44 -0600 Subject: [PATCH 2/4] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5efee193..52ea4e25 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Todo App Java On Azure -This TodoList app is an Azure 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](https://docs.microsoft.com/en-us/azure/cosmos-db/documentdb-introduction). This application uses [Azure CosmosDB DocumentDB Spring Boot Starter](https://github.com/Microsoft/azure-spring-boot/tree/master/azure-starters/azure-documentdb-spring-boot-starter) and AngularJS to interact with Azure. In particular, this version of the application shows how to use [Azure Application Insights](https://docs.microsoft.com/en-us/azure/application-insights/app-insights-java-get-started) to monitor the performance and usage of the application. +This TodoList app is an Azure Java SpringBoot application. It provides end-to-end CRUD operations on todo list items from front-end AngularJS code. Behind the scenes, the todo list item data store is [Azure CosmosDB DocumentDB](https://docs.microsoft.com/en-us/azure/cosmos-db/documentdb-introduction). This application uses [Azure CosmosDB DocumentDB Spring Boot Starter](https://github.com/Microsoft/azure-spring-boot/tree/master/azure-starters/azure-documentdb-spring-boot-starter) and AngularJS to interact with Azure. In particular, this version of the application shows how to use [Azure Application Insights](https://docs.microsoft.com/en-us/azure/application-insights/app-insights-overview) to monitor the performance and usage of a Java SpringBoot application. For more information on how to use Application Insights in other types of Java applications, refer to [Get started with Application Insights in a Java web project] (https://docs.microsoft.com/en-us/azure/application-insights/app-insights-java-get-started). ## Requirements * [Azure Cosmos DB DocumentDB](https://docs.microsoft.com/en-us/azure/cosmos-db/create-sql-api-java) @@ -22,7 +22,7 @@ This TodoList app is an Azure Java application. It provides end-to-end CRUD oper com.microsoft.azure applicationinsights-web - [1.0,) + 2.0.0-BETA -2. The 'src/main/java/com/microsoft/azure/sample/AppInsightsConfig.java' file has been added to register the HTTP filter using SpringBoot's FilterRegistrationBean. This results in each of the HTTP requests to be logged to Application Insights. +2. The 'src/main/java/com/microsoft/azure/sample/AppInsightsConfig.java' file has been added to register the HTTP filter using SpringBoot's FilterRegistrationBean. This results in each of the HTTP requests being logged to Application Insights. To monitor the telemetry gathered by Application Insights, open your Application Insights resource using the Azure Portal. From fe8ed4218c1e2a0ebe81aff30292aa598b052891 Mon Sep 17 00:00:00 2001 From: nicolehaugen79 Date: Mon, 22 Jan 2018 11:13:15 -0600 Subject: [PATCH 3/4] Fixed markup, added link to master's ReadMe --- README.md | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 52ea4e25..95009d02 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,53 @@ # Todo App Java On Azure -This TodoList app is an Azure Java SpringBoot application. It provides end-to-end CRUD operations on todo list items from front-end AngularJS code. Behind the scenes, the todo list item data store is [Azure CosmosDB DocumentDB](https://docs.microsoft.com/en-us/azure/cosmos-db/documentdb-introduction). This application uses [Azure CosmosDB DocumentDB Spring Boot Starter](https://github.com/Microsoft/azure-spring-boot/tree/master/azure-starters/azure-documentdb-spring-boot-starter) and AngularJS to interact with Azure. In particular, this version of the application shows how to use [Azure Application Insights](https://docs.microsoft.com/en-us/azure/application-insights/app-insights-overview) to monitor the performance and usage of a Java SpringBoot application. For more information on how to use Application Insights in other types of Java applications, refer to [Get started with Application Insights in a Java web project] (https://docs.microsoft.com/en-us/azure/application-insights/app-insights-java-get-started). +This TodoList app is an Azure Java SpringBoot application. It provides end-to-end CRUD operations on todo list items from front-end AngularJS code. Behind the scenes, the todo list item data store is [Azure CosmosDB DocumentDB](https://docs.microsoft.com/en-us/azure/cosmos-db/documentdb-introduction). This application uses [Azure CosmosDB DocumentDB Spring Boot Starter](https://github.com/Microsoft/azure-spring-boot/tree/master/azure-starters/azure-documentdb-spring-boot-starter) and AngularJS to interact with Azure. In particular, this version of the application shows how to use [Azure Application Insights](https://docs.microsoft.com/en-us/azure/application-insights/app-insights-overview) to monitor the performance and usage of a Java SpringBoot application. For more information on how to use Application Insights in other types of Java applications, refer to [Get started with Application Insights in a Java web project](https://docs.microsoft.com/en-us/azure/application-insights/app-insights-java-get-started). ## Requirements * [Azure Cosmos DB DocumentDB](https://docs.microsoft.com/en-us/azure/cosmos-db/create-sql-api-java) * [Azure App Insights](https://docs.microsoft.com/en-us/azure/application-insights/app-insights-create-new-resource) -* JDK 1.8 and above -* Maven 3.0 and above +* [JDK](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) 1.8 and above +* [Maven](https://maven.apache.org/) 3.0 and above * Clone ai branch ## Configuration +First, follow the instructions in the [master branch's ReadMe](https://github.com/Microsoft/todo-app-java-on-azure) to configure the app with Document DB. -* Follow the steps for creating the Azure App Insights resource (as shown in the Requirements section) and copy the instrumentation key. +Follow the steps for creating the Azure App Insights resource (as shown in the Requirements section) and copy the instrumentation key. Paste the instrumentation key into the 'src/main/resources/ApplicationInsights.xml' file and save it. - + ``` txt put-your-instrumentation-key-here - -* In addition, you may notice that the following has already been configured for you to setup App Insights: -1. The dependency to Application Insights has been added to the pom.xml: + ``` +In addition, you may notice that the following has already been configured for you to setup App Insights: +* The dependency to Application Insights has been added to the pom.xml: + ``` txt com.microsoft.azure applicationinsights-web 2.0.0-BETA + ``` +* The 'src/main/java/com/microsoft/azure/sample/AppInsightsConfig.java' file has been added to register the HTTP filter using SpringBoot's FilterRegistrationBean. This results in each of the HTTP requests being logged to Application Insights. + +## Run it + +1. `mvn package` +1. `java -jar target/todo-app-java-on-azure-0.0.1-SNAPSHOT.jar` +1. Open `http://localhost:8080` you can see the web pages to show the todo list app + +To monitor the telemetry gathered by Application Insights, open your Application Insights resource using the Azure Portal. + +## Contributing + +This project welcomes contributions and suggestions. Most contributions require you to agree to a +Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us +the rights to use your contribution. For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide +a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions +provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or +contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. -2. The 'src/main/java/com/microsoft/azure/sample/AppInsightsConfig.java' file has been added to register the HTTP filter using SpringBoot's FilterRegistrationBean. This results in each of the HTTP requests being logged to Application Insights. To monitor the telemetry gathered by Application Insights, open your Application Insights resource using the Azure Portal. From 8ce7097e15818987ef6e7c7f3b7226d8d0c5780b Mon Sep 17 00:00:00 2001 From: nicolehaugen79 Date: Mon, 22 Jan 2018 11:29:06 -0600 Subject: [PATCH 4/4] Added info about SDK logger. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 95009d02..ebdc55f4 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ In addition, you may notice that the following has already been configured for y ``` * The 'src/main/java/com/microsoft/azure/sample/AppInsightsConfig.java' file has been added to register the HTTP filter using SpringBoot's FilterRegistrationBean. This results in each of the HTTP requests being logged to Application Insights. +* The SDK Logger has been enabled in the 'src/main/resources/ApplicationInsights.xml' file which turns on logging messages so that they are displayed in the IDE's console window. This is particularly useful for troubleshooting setting up the app to use Application Insights. + ## Run it 1. `mvn package`