Skip to content

Commit

Permalink
Merge pull request #36 from dpinto-pivotal/development
Browse files Browse the repository at this point in the history
Upgrade to support Spring Cloud Services
  • Loading branch information
David Ferreira Pinto committed Nov 15, 2015
2 parents 8fcd9cf + 4367e75 commit 8a40ec6
Show file tree
Hide file tree
Showing 78 changed files with 4,425 additions and 633 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
build/
.gradle/

*.classpath
*.project
*.settings/
*.ipr
*.iws
48 changes: 36 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This repository holds a collection of micro services that work together to prese

It was created to support workshops and demonstrations of building and using `microservices` architectures and running these in **Cloud Foundry** (although it is possible to run these on other runtimes).

The workshops follow a series of exercises, or labs, and you can find links to the guides for these exercises [below](#workshps).
The workshops follow a series of exercises, or labs, and you can find links to the guides for these exercises [below](#workshops).

##Table of Contents

Expand Down Expand Up @@ -79,6 +79,7 @@ At Pivotal we love education, not just educating ourselves, but also educating o
7. [Scaling the services] [scale]
8. Auto Scaling - TODO: use autoscaler service!
9. [Blue/Green deployments] [bluegreen]
10. Monitor workshop - TODO: show how to monitor microservices using springbootadmin, ELK tile and Zipkin.


[setup]: docs/lab_setup.md
Expand All @@ -99,28 +100,51 @@ TODO: document a walk through of this demo. This is a walkthough of the workshop

###2. Service discovery.
TODO: document a walk through of this demo.

###3. Scalability
TODO: document a walk through of this demo.
- provide a load generator to mimic users.
- scale instances.

###3. Configuration Management.
TODO: document a walk through of this demo.
###4. Traceability across all services.
###4. Configuration Management.
TODO: document a walk through of this demo.
###5. Continuous Integration/Continuous Delivery.

###5. Traceability across all services.
TODO: document a walk through of this demo using Zipkin and Kibana.

###6. Continuous Integration/Continuous Delivery.
TODO: document a walk through of this demo.

###7. Operations Demo
TODO: document how to operate/monitor several microservices, using Spring Boot Admin and ELK tile


#Features

- **Discovery service:**
All microservices register with the [Discovery Service](http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html) and discover other microservices through it.
- **Correlation/Traceability:**
Traceability of requests through all the microservices. This is done using [Spring-cloud-sleuth](http://cloud.spring.io/spring-cloud-sleuth/).
- **Config Server:**
The microservices obtain the configuration from a [Configuration Service](http://cloud.spring.io/spring-cloud-config/) backed by a git repository. This means that configuration is now auditables and version controlled, as well as providing the ability to refresh configuration during runtime.

#Roadmap

The roadmap for this project is constantly evolving. Please feel free to reach out with ideas.
- **Correlation/Traceability**
Provide a way to trace calls/requests through the microservices. This will be done with [Spring-cloud-sleuth](http://cloud.spring.io/spring-cloud-sleuth/).
- **Config Server:**
Currently, the microservices obtain their configuration from the application.yml file packaged with each of them or the configuration is in the code. In the future, they'll obtain their configuration from a [Config Server](http://cloud.spring.io/spring-cloud-config/) backed by github repos.
- **Better APIs:** Better APIs with documentation that conform to some standard and logic.
- **Stock analysis system:** a microservice, or set of microservices, to analyse stock and provide recommendations. Also, to show polyglot persistence as well as more sophisticated data workloads.
- **Mobile UI:** Mobile interface to expose the services on an iOS device and/or Android device natively, making use of the [Pivotal Cloud Foundry Mobile Services](http://docs.pivotal.io/mobile/index.html).
- **Better APIs:**
Better APIs with documentation that conform to some standard and logic.
- **Security:**
Secure microservices with OAUTH2.
- **Monitoring/Operations:**
Show how to monitor a distributed system comprising of multiple microservices.
This will comprise of:
- Spring Boot Admin
- ELK tile
- Zipkin
- **Stock analysis system:**
A microservice, or set of microservices, to analyse stock and provide recommendations. Also, to show polyglot persistence as well as more sophisticated data workloads.
- **Mobile UI:**
Mobile interface to expose the services on an iOS device and/or Android device natively, making use of the [Pivotal Cloud Foundry Mobile Services](http://docs.pivotal.io/mobile/index.html).

#Contributing
Everyone is encouraged to help improved this project.
Expand Down
126 changes: 100 additions & 26 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,81 +1,129 @@
buildscript {
ext {
springBootVersion = '1.2.6.RELEASE'
springCloudStarterParentTrain = 'Angel.SR3'
scsVersion = '1.0.0.M1'
springBootVersion = '1.3.0.RC1'
//springCloudStarterParentTrain = 'Brixton.BUILD-SNAPSHOT'
scsVersion = '1.0.0.RELEASE'
junitVersion = '4.12'
bootstrapVersion = '2.3.2'
thymeleafExtras = '2.1.2.RELEASE'
dependencyPlugin = '0.5.3.RELEASE'
}

repositories { mavenCentral() }
repositories {
mavenCentral()
maven { url "http://repo.spring.io/milestone" }
maven { url "http://repo.spring.io/snapshot" }
maven { url "https://plugins.gradle.org/m2/" }
}


dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
classpath "io.spring.gradle:dependency-management-plugin:${dependencyPlugin}"
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
classpath "gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:1.4.7"
}
}

repositories {
mavenLocal()
mavenCentral()
}

// Apply versioning to all projects from versioning script.
allprojects { apply from: "$rootDir/gradle/versioning.gradle" }
allprojects {
apply plugin: 'java'
apply plugin: 'jacoco'
apply from: "$rootDir/gradle/versioning.gradle"
}

subprojects {
apply plugin: 'java'

apply plugin: 'eclipse'
apply plugin: 'jacoco'
apply plugin: "io.spring.dependency-management"
apply plugin: 'spring-boot'
apply plugin: "io.spring.dependency-management"
apply plugin: "com.gorylenko.gradle-git-properties"

println version


jacoco { toolVersion = "0.7.1.201405082137" // reportsDir = file("$buildDir/customJacocoReportDir")
test { finalizedBy jacocoTestReport }

task manifestFilter(type: Copy) {
from 'manifest-unversioned.yml'
into "${buildDir}/"
rename { String fileName ->
fileName.replace('-unversioned', '')
}
def myPath = System.getenv("JAR_PATH") ?: "${libsDir}/"
expand(version: "${version}", path: "${myPath}")
}

assemble { finalizedBy manifestFilter }

jacocoTestReport {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {

csv.enabled false

html{
enabled true
destination "${buildDir}/reports/jacoco"
}

xml.enabled false
}

additionalSourceDirs = files(sourceSets.main.allJava.srcDirs)
}

test { finalizedBy jacocoTestReport }

jacoco { toolVersion = "0.7.5+" // reportsDir = file("$buildDir/customJacocoReportDir")
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
mavenCentral()
maven { url "http://repo.spring.io/release" }
maven { url "http://repo.spring.io/milestone" }
maven { url "http://repo.spring.io/snapshot" }
}

dependencyManagement {
imports {
mavenBom "io.pivotal.spring.cloud:spring-cloud-services-starter-parent:${scsVersion}"
mavenBom "org.springframework.boot:spring-boot-starter-parent:${springBootVersion}"
imports { mavenBom "org.springframework.boot:spring-boot-starter-parent:${springBootVersion}" //mavenBom "org.springframework.cloud:spring-cloud-starter-parent:${springCloudStarterParentTrain}"
}
}
dependencies {

// shared dependencies for all services
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.cloud:spring-cloud-starter-eureka"
compile "org.springframework.cloud:spring-cloud-starter-hystrix"
compile "io.pivotal.spring.cloud:spring-cloud-services-starter-config-client"
compile "io.pivotal.spring.cloud:spring-cloud-services-starter-service-registry"
compile "io.pivotal.spring.cloud:spring-cloud-services-starter-circuit-breaker"
compile "org.springframework.cloud:spring-cloud-starter-sleuth:1.0.0.M2"
compile "io.pivotal.spring.cloud:spring-cloud-services-starter-config-client:${scsVersion}"
compile "io.pivotal.spring.cloud:spring-cloud-services-starter-service-registry:${scsVersion}"
compile "io.pivotal.spring.cloud:spring-cloud-services-starter-circuit-breaker:${scsVersion}"

//test packages
testCompile "org.springframework.boot:spring-boot-starter-test"
testCompile "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
testCompile "junit:junit:$junitVersion"

}
// process substitutions in yml files.
processResources {
filesMatching("**/*.yml") { expand(project.properties) }
}


}

project(':springboottrades-accounts') {
jar { baseName = 'accounts' }
description = "Micro-service to deal with accounts and user logins"

dependencies {
compile "org.springframework.boot:spring-boot-starter-data-jpa"
compile "org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion}"

// test packages
testRuntime "com.jayway.jsonpath:json-path"
Expand All @@ -102,13 +150,13 @@ project(':springboottrades-portfolio') {
jar { baseName = 'portfolio' }
description = "Micro-service to manage portfolios"
dependencies {
compile "org.springframework.boot:spring-boot-starter-data-jpa"
compile "org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion}"

//runtime
runtime "org.hsqldb:hsqldb"

//test packages
testRuntime "com.jayway.jsonpath:json-path:2.0.0"
testRuntime "com.jayway.jsonpath:json-path"
testRuntime "org.hsqldb:hsqldb"
}
}
Expand All @@ -117,15 +165,41 @@ project(':springboottrades-web') {
jar { baseName = 'web' }
description = "Web interface to the springboot set of services"
dependencies {
compile "org.springframework.boot:spring-boot-starter-thymeleaf"
compile "org.springframework.boot:spring-boot-starter-security"
compile "org.springframework.boot:spring-boot-starter-thymeleaf:${springBootVersion}"
compile "org.springframework.boot:spring-boot-starter-security:${springBootVersion}"
compile "org.thymeleaf.extras:thymeleaf-extras-springsecurity4:${thymeleafExtras}"

//runtime
runtime "org.webjars:bootstrap:${bootstrapVersion}"
runtime "org.webjars:jquery:2.1.1"

//test packages
}
}

//create a joint code coverage report from subprojects
task codeCoverageReport(type: JacocoReport) {

// Gather execution data from all subprojects
// (change this if you e.g. want to calculate unit test/integration test coverage separately)
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")

// Add all relevant sourcesets from the subprojects
subprojects.each { sourceSets it.sourceSets.main }

reports {
xml.enabled false
html.enabled true
html.destination "${buildDir}/reports/jacoco"
csv.enabled false
}
jacoco { toolVersion = "0.7.5+" // reportsDir = file("$buildDir/customJacocoReportDir")
}
}

// always run the tests before generating the report
codeCoverageReport.dependsOn { subprojects*.test }
//run full report after test
test.finalizedBy(codeCoverageReport)

task wrapper(type: Wrapper) { gradleVersion = '2.7' }
1 change: 0 additions & 1 deletion config-repo/accounts-service-cloud.yml

This file was deleted.

2 changes: 0 additions & 2 deletions config-repo/accounts-service-local.yml

This file was deleted.

6 changes: 0 additions & 6 deletions config-repo/accounts-service.yml

This file was deleted.

3 changes: 0 additions & 3 deletions config-repo/application-cloud.yml

This file was deleted.

6 changes: 0 additions & 6 deletions config-repo/application-local.yml

This file was deleted.

22 changes: 0 additions & 22 deletions config-repo/application.yml

This file was deleted.

1 change: 0 additions & 1 deletion config-repo/portfolio-service-cloud.yml

This file was deleted.

2 changes: 0 additions & 2 deletions config-repo/portfolio-service-local.yml

This file was deleted.

6 changes: 0 additions & 6 deletions config-repo/portfolio-service.yml

This file was deleted.

Empty file.
2 changes: 0 additions & 2 deletions config-repo/quotes-service-local.yml

This file was deleted.

7 changes: 0 additions & 7 deletions config-repo/quotes-service.yml

This file was deleted.

Empty file removed config-repo/web-service-cloud.yml
Empty file.
2 changes: 0 additions & 2 deletions config-repo/web-service-local.yml

This file was deleted.

13 changes: 0 additions & 13 deletions config-repo/web-service.yml

This file was deleted.

Loading

0 comments on commit 8a40ec6

Please sign in to comment.