Skip to content

Commit

Permalink
Update petclinic with latest spring integration libraries (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
backwind1233 authored Jan 10, 2022
1 parent 26f7faf commit f782870
Show file tree
Hide file tree
Showing 22 changed files with 140 additions and 350 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env bash

# ==== Resource Group ====
export SUBSCRIPTION=subscription-id # customize this
export RESOURCE_GROUP=resource-group-name # customize this
export LOCATION=SouthCentralUS #customize this
export COSMOSDB_NAME=mycosmosdbaccname # customize this
Expand Down
153 changes: 0 additions & 153 deletions spring-petclinic-microservices/README-petclinic.md

This file was deleted.

48 changes: 27 additions & 21 deletions spring-petclinic-microservices/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Deploy Spring Microservices using Azure Spring starters for Cosmos DB, Redis, KeyVault
# Deploy Spring Microservices using Azure Spring starters for Cosmos DB, Redis, Key Vault

Azure Spring Cloud enables you to easily run a Spring Boot based microservices application on Azure.

Expand All @@ -12,7 +12,7 @@ You will:

- Build existing Spring microservices applications
- Provision azure resources required for the application
- Run the application locally with CosmosDB backend, Azure Redis Cache and using KeyVault for
- Run the application locally with Cosmos DB backend, Azure Redis Cache and using Key Vault for
storing secrets
- Open the application

Expand All @@ -26,20 +26,18 @@ or sign up for a

In addition, you will need the following:

| [Azure CLI version 2.0.67 or higher](https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest)
| [Java 8](https://www.azul.com/downloads/azure-only/zulu/?version=java-8-lts&architecture=x86-64-bit&package=jdk)
| [Maven](https://maven.apache.org/download.cgi)
| [MySQL CLI](https://dev.mysql.com/downloads/shell/)
| [Git](https://git-scm.com/)
| [Jq](https://stedolan.github.io/jq/)
|
- [Azure CLI version 2.0.67 or higher](https://docs.microsoft.com/cli/azure/install-azure-cli?view=azure-cli-latest)
- [Java 8](https://www.azul.com/downloads/azure-only/zulu/?version=java-8-lts&architecture=x86-64-bit&package=jdk)
- [Maven](https://maven.apache.org/download.cgi)
- [MySQL CLI](https://dev.mysql.com/downloads/shell/)
- [Git](https://git-scm.com/)
- [Jq](https://stedolan.github.io/jq/)

## Clone and build the repo

### Create a new folder and clone the sample app repository to your Azure Cloud account
### Clone the sample app repository

```bash
mkdir source-code
git clone https://github.com/Azure-Samples/azure-spring-boot-samples
```

Expand Down Expand Up @@ -77,7 +75,6 @@ Open `.scripts/setup-env-variables-azure.sh` and enter the following information

```bash

export SUBSCRIPTION=subscription-id # customize this
export RESOURCE_GROUP=resource-group-name # customize this
export LOCATION=SouthCentralUS #customize this
export COSMOSDB_NAME=mycosmosdbaccname # customize this
Expand All @@ -98,13 +95,23 @@ make sure keyvault.env file is created at the root of the repo.
## Starting services locally with docker-compose

In order to start entire infrastructure using Docker, you have to build images by
executing `./mvnw clean install -P buildDocker -DskipTests`
from a project root. Once images are ready, you can start them with a single command
`docker-compose up`. Containers startup order is coordinated
with [`dockerize` script](https://github.com/jwilder/dockerize). After starting services it takes a
while for API Gateway to be in sync with service registry, so don't be scared of initial Spring
Cloud Gateway timeouts. You can track services availability using Eureka dashboard available by
default at http://localhost:8761.
executing command below from a project root:

```shell
mvn clean install -P buildDocker -DskipTests
```


Once images are ready, you can start them with a single command.


```shell
docker-compose up
```

Containers startup order is coordinated with [`dockerize` script](https://github.com/jwilder/dockerize). After starting services it takes a while for API Gateway to be in sync with service registry, so don't be scared of initial Spring
Cloud Gateway timeouts.
You can track services availability using Eureka dashboard available by default at `http://localhost:8761`.

## Understanding the Spring Petclinic application

Expand All @@ -117,7 +124,7 @@ You can then access petclinic here: http://localhost:8080/

![Spring Petclinic Microservices screenshot](docs/application-screenshot.png)

**Architecture diagram of the Spring Petclinic Microservices with CosmosDB**
**Architecture diagram of the Spring Petclinic Microservices with Cosmos DB**

![Spring Petclinic Microservices architecture](docs/microservices-architecture-diagram-cosmosdb.jpg)

Expand Down Expand Up @@ -145,7 +152,6 @@ more about Spring on Azure, go to:

This Spring microservices sample is forked from
[spring-petclinic/spring-petclinic-microservices](https://github.com/spring-petclinic/spring-petclinic-microservices)
- see [Petclinic README](./README-petclinic.md).

## Contributing

Expand Down
25 changes: 0 additions & 25 deletions spring-petclinic-microservices/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,6 @@ services:
ports:
- 8080:8080

tracing-server:
image: openzipkin/zipkin
container_name: tracing-server
mem_limit: 512M
environment:
- JAVA_OPTS=-XX:+UnlockExperimentalVMOptions -Djava.security.egd=file:/dev/./urandom
ports:
- 9411:9411

admin-server:
image: springcommunity/spring-petclinic-admin-server
container_name: admin-server
Expand All @@ -88,19 +79,3 @@ services:
entrypoint: ["./dockerize","-wait=tcp://discovery-server:8761","-timeout=60s","--","java", "org.springframework.boot.loader.JarLauncher"]
ports:
- 9090:9090

## Grafana / Prometheus

grafana-server:
build: ./docker/grafana
container_name: grafana-server
mem_limit: 256M
ports:
- 3000:3000

prometheus-server:
build: ./docker/prometheus
container_name: prometheus-server
mem_limit: 256M
ports:
- 9091:9090
57 changes: 12 additions & 45 deletions spring-petclinic-microservices/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.6.RELEASE</version>
<version>2.5.4</version>
</parent>

<groupId>org.springframework.samples</groupId>
Expand All @@ -27,18 +27,15 @@

<properties>
<java.version>1.8</java.version>
<assertj.version>3.11.1</assertj.version>

<spring-boot.version>2.3.4.RELEASE</spring-boot.version>
<spring-cloud.version>Hoxton.SR8</spring-cloud.version>

<maven-surefire-plugin.version>2.22.0</maven-surefire-plugin.version>

<spring-cloud.version>2020.0.3</spring-cloud.version>
<docker.image.prefix>springcommunity</docker.image.prefix>
<docker.image.exposed.port>9090</docker.image.exposed.port>
<docker.image.dockerfile.dir>${basedir}</docker.image.dockerfile.dir>
<docker.image.dockerize.version>v0.6.1</docker.image.dockerize.version>
<docker.plugin.version>1.2.0</docker.plugin.version>
<docker.plugin.version>1.2.2</docker.plugin.version>
<spring-boot-admin.version>2.5.5</spring-boot-admin.version>
<spring-cloud-azure.version>4.0.0-beta.2</spring-cloud-azure.version>
<azure-spring-data-cosmos.version>3.16.0</azure-spring-data-cosmos.version><!-- {x-version-update;com.azure:azure-spring-data-cosmos;dependency} -->
</properties>

<dependencyManagement>
Expand All @@ -51,24 +48,15 @@
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring-boot.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
<groupId>com.azure</groupId>
<artifactId>azure-spring-data-cosmos</artifactId>
<version>${azure-spring-data-cosmos.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
<groupId>com.azure.spring</groupId>
<artifactId>spring-cloud-azure-starter-keyvault-secrets</artifactId>
<version>${spring-cloud-azure.version}</version>
</dependency>

</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -109,27 +97,6 @@
</execution>
</executions>
</plugin>

<!-- Spring Boot Actuator displays build-related information if a META-INF/build-info.properties file is present -->
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<verbose>true</verbose>
<dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties
</generateGitPropertiesFilename>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Loading

0 comments on commit f782870

Please sign in to comment.