Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
[Github #51] Add Gradle deploy code and README for Tomcat in App Serv…
Browse files Browse the repository at this point in the history
…ice Linux (#53)

* [Github #51] Add Gradle deploy code and README for Tomcat in App Service Linux

* [Github #51] fixing tests

* [Github #51] Adding cargo plugin and instructiona to run locally

* [Github #51] Using environment variables in build script
  • Loading branch information
lenala authored and selvasingh committed Jun 1, 2018
1 parent 9169244 commit aed34e4
Show file tree
Hide file tree
Showing 11 changed files with 105 additions and 661 deletions.
Binary file removed .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
1 change: 0 additions & 1 deletion .mvn/wrapper/maven-wrapper.properties

This file was deleted.

4 changes: 0 additions & 4 deletions Dockerfile

This file was deleted.

49 changes: 13 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This application uses [Azure CosmosDB DocumentDB Spring Boot Starter](https://gi
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,
Starters, maven and gradle plugins and Eclipse / IntelliJ plugins,
Java application development and deployment on Azure
are effortless now.

Expand All @@ -27,9 +27,8 @@ are effortless now.
## 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
* [Gradle](https://gradle.org/) 4.0 and above
* [Tomcat](https://tomcat.apache.org/download-80.cgi) 8.5 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,
Expand Down Expand Up @@ -66,7 +65,7 @@ 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 Linux - you can use an existing resource group and Web
app or let the Maven plugin create these for you. Set these values in system environment variables:
app or let the Gradle plugin create these for you. Set these values in system environment variables:

``` txt
DOCUMENTDB_URI=put-your-documentdb-uri-here
Expand All @@ -88,56 +87,34 @@ TOMCAT_HOME=put-your-tomcat-home-here
## Build Todo List Web App - WAR

```bash
mvn package
gradle bootWar
```

## Run it locally - OPTIONAL STEP

Deploy the todo list app to local Tomcat. You must start
a local instance of Tomcat.
Deploy the todo list app to local Tomcat.

```bash
mvn cargo:deploy
gradle cargoRunLocal
```

Open `http://localhost:8080/todo-app-java-on-azure` you can see the todo list app

## Deploy to Tomcat on Azure App Service on Linux

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

Install a SNAPSHOT version of the Maven Plugin for Azure Web Apps:
Install a SNAPSHOT version of the Gradle Plugin for Azure Web Apps:

```bash
git clone https://github.com/Microsoft/azure-maven-plugins.git
cd azure-maven-plugins
git checkout cs/wardeploy
mvn clean install -DskipTests
git clone https://github.com/lenala/azure-gradle-plugins.git
cd azure-webapp-gradle-plugin
./gradlew install
```
### Deploy to Tomcat on Azure App Service on Linux

Deploy in one step. You can continue to deploy again and
again without restarting Tomcat.

```bash
mvn azure-webapp:deploy
```

```bash
...
...
[INFO] Updating target Web App...
[INFO] Successfully updated Web App.
[INFO] Starting to deploy the war file...
[INFO] Successfully deployed Web App at https://todo-app-180317185136711.azurewebsites.net
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:01 min
[INFO] Finished at: 2018-03-17T13:00:06-07:00
[INFO] Final Memory: 51M/859M
[INFO] ------------------------------------------------------------------------
gradle azureWebappDeploy
```

TODO: show how to deploy multiple applications.
Expand Down Expand Up @@ -183,4 +160,4 @@ contact [[email protected]](mailto:[email protected]) with any additio
## Useful link
- [Azure Spring Boot Starters](https://github.com/Microsoft/azure-spring-boot)
- [Azure Maven plugins](https://github.com/Microsoft/azure-maven-plugins)
- [Azure Gradle plugins](https://github.com/lenala/azure-gradle-plugins.git)
68 changes: 68 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

buildscript {
repositories {
jcenter()
maven {
url uri('/Users/farlen/.m2/repository')
}
}
dependencies {
classpath group: 'com.microsoft.azure', name: 'azure-webapp-gradle-plugin',
version: '1.0-SNAPSHOT'
classpath 'io.spring.gradle:dependency-management-plugin:1.0.5.RELEASE'
classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.2.RELEASE"
classpath 'com.bmuschko:gradle-cargo-plugin:2.3'
}
}

apply plugin: 'war'
apply plugin: 'io.spring.dependency-management'
apply plugin: "org.springframework.boot"
apply plugin: 'com.microsoft.azure.azurewebapp'
apply plugin: 'com.bmuschko.cargo'


repositories {
jcenter()
}

dependencies {
compile group: 'commons-io', name: 'commons-io', version: '1.4'
compile group: 'log4j', name: 'log4j', version: '1.2.15', ext: 'jar'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version:'2.0.2.RELEASE'
compile group: 'com.microsoft.azure', name: 'spring-data-documentdb', version: '2.0.2'
compile group: 'com.microsoft.azure', name: 'azure-documentdb-spring-boot-starter', version: '0.2.0'
testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.0.2.RELEASE'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
}

cargo {
containerId = 'tomcat8x'
deployable {
context = 'todoapp'
}
local {
homeDir = file("$System.env.TOMCAT_HOME")
outputFile = file('/Users/farlen/stuff/todo-app-java-on-azure.main/output.log')
}
}

azurewebapp {
deploymentType = 'wardeploy'
resourceGroup = "${System.env.WEBAPP_RESOURCE_GROUP}"
appName = "${System.env.WEBAPP_NAME}"
pricingTier = "S2"
authFile = file('/Users/farlen/stuff/my2.azureauth')
// if 'target' is not specified, dafault output of the 'war' plugin will be used
// target = file('C:/stuff/azure-gradle-plugins.4/samples/todo-app-java-on-azure.appservice-on-linux/build/libs/todoapp.war')
appServiceOnLinux = {
runtimeStack = 'TOMCAT 9.0-jre8'
// urlPath = 'todoapp'
}
// appServiceOnWindows = {
// javaWebContainer = "tomcat 8.5"
// javaVersion = "1.8.0_102"
// urlPath = 'todoapp'
// }
}

Loading

0 comments on commit aed34e4

Please sign in to comment.