-
Notifications
You must be signed in to change notification settings - Fork 251
Update README.md - ai branch #34
base: ai
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. those steps are still necessary for user to finish a complete end to end todo app with application insight. please add steps of application insight into original steps, instead of overwrite it. thanks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So that I don't duplicate all the steps, I simply added a link to the master's ReadMe for reference. |
||
* [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 <your-subscription-id> | ||
``` | ||
1. create an Azure Resource Group, and note your group name | ||
|
||
```bash | ||
az group create -n <your-azure-group-name> -l <your-resource-group-region> | ||
``` | ||
|
||
1. create Azure Cosmos DB with DocumentDB kind. Note the `documentEndpoint` field in the response. | ||
|
||
```bash | ||
az cosmosdb create --kind GlobalDocumentDB -g <your-azure-group-name> -n <your-azure-documentDB-name> | ||
``` | ||
**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 <your-azure-group-name> -n <your-azure-documentDB-name> | ||
``` | ||
* [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 | ||
[email protected]_URI@ | ||
[email protected]_KEY@ | ||
[email protected]_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 <your-resource-group-name> | ||
``` | ||
|
||
## 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 [[email protected]](mailto:[email protected]) 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. | ||
|
||
<!-- The key from the portal: --> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. following markdown code snippet syntax. like
|
||
<InstrumentationKey>put-your-instrumentation-key-here</InstrumentationKey> | ||
|
||
* 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: | ||
<dependency> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above, please follow above markdown code snippet syntax |
||
<groupId>com.microsoft.azure</groupId> | ||
<artifactId>applicationinsights-web</artifactId> | ||
<version>[1.0,)</version> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please update version to 2.0.0-BETA for time being. The [1.0.,) will pull the last 1.x version which won't be the latest. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
</dependency> | ||
|
||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we still point to https://docs.microsoft.com/en-us/azure/application-insights/app-insights-java-get-started. as it doesn't have instructions on configuration with SpringBoot. Might be customers get mislead? Just brainstorming, if answer is no - where should we point them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reminder - I meant to ask Asir about whether there are plans to improve this documentation to mention SpringBoot. Also, I clarified in the ReadMe that this sample shows SpringBoot and that for other examples, refer to the 'getting started' docs. Let me know if you still think this is unclear.