├── microservices ├── support │ ├── auth-server │ │ ├── src │ │ │ ├── main │ │ │ │ ├── wro │ │ │ │ │ ├── main.less │ │ │ │ │ ├── wro.properties │ │ │ │ │ └── wro.xml │ │ │ │ ├── resources │ │ │ │ │ ├── server.jks │ │ │ │ │ ├── truststore.jks │ │ │ │ │ ├── bootstrap.yml │ │ │ │ │ └── templates │ │ │ │ │ │ ├── login.ftl │ │ │ │ │ │ └── authorize.ftl │ │ │ │ └── java │ │ │ │ │ └── se │ │ │ │ │ └── callista │ │ │ │ │ └── microservises │ │ │ │ │ └── support │ │ │ │ │ └── oauth │ │ │ │ │ └── AuthserverApplication.java │ │ │ └── test │ │ │ │ └── java │ │ │ │ └── se │ │ │ │ └── callista │ │ │ │ └── microservises │ │ │ │ └── support │ │ │ │ └── oauth │ │ │ │ └── ApplicationTests.java │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── Dockerfile │ │ ├── build.gradle │ │ ├── gradlew.bat │ │ └── gradlew │ ├── zipkin-server │ │ ├── src │ │ │ ├── main │ │ │ │ ├── resources │ │ │ │ │ ├── bootstrap.yml │ │ │ │ │ └── application.yml │ │ │ │ └── java │ │ │ │ │ └── se │ │ │ │ │ └── callista │ │ │ │ │ └── microservises │ │ │ │ │ └── workshop │ │ │ │ │ └── zipkin │ │ │ │ │ └── ZipkinServerApplication.java │ │ │ └── test │ │ │ │ └── java │ │ │ │ └── se │ │ │ │ └── callista │ │ │ │ └── microservises │ │ │ │ └── workshop │ │ │ │ └── zipkin │ │ │ │ └── ZipkinServerApplicationTests.java │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── Dockerfile │ │ ├── build.gradle │ │ └── gradlew.bat │ ├── config-server │ │ ├── src │ │ │ ├── main │ │ │ │ ├── resources │ │ │ │ │ ├── bootstrap.yml │ │ │ │ │ ├── server.jks │ │ │ │ │ └── application.yml │ │ │ │ └── java │ │ │ │ │ └── se │ │ │ │ │ └── callista │ │ │ │ │ └── microservises │ │ │ │ │ └── support │ │ │ │ │ └── ConfigServerApplication.java │ │ │ └── test │ │ │ │ └── java │ │ │ │ └── se │ │ │ │ └── callista │ │ │ │ └── microservises │ │ │ │ └── support │ │ │ │ └── ConfigServerApplicationTests.java │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── Dockerfile │ │ ├── build.gradle │ │ └── gradlew.bat │ ├── turbine │ │ ├── README.md │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── src │ │ │ └── main │ │ │ │ ├── resources │ │ │ │ ├── truststore.jks │ │ │ │ ├── bootstrap.yml │ │ │ │ └── application.yml │ │ │ │ └── java │ │ │ │ └── se │ │ │ │ └── callista │ │ │ │ └── microservises │ │ │ │ └── support │ │ │ │ └── turbine │ │ │ │ └── TurbineApplication.java │ │ ├── build.gradle │ │ ├── gradlew.bat │ │ └── gradlew │ ├── edge-server │ │ ├── src │ │ │ └── main │ │ │ │ ├── resources │ │ │ │ ├── server.jks │ │ │ │ ├── truststore.jks │ │ │ │ └── bootstrap.yml │ │ │ │ └── java │ │ │ │ └── se │ │ │ │ └── callista │ │ │ │ └── microservises │ │ │ │ └── support │ │ │ │ └── edge │ │ │ │ └── ZuulApplication.java │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── build.gradle │ │ └── gradlew.bat │ ├── discovery-server │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── src │ │ │ ├── main │ │ │ │ ├── java │ │ │ │ │ └── se │ │ │ │ │ │ └── callista │ │ │ │ │ │ └── microservises │ │ │ │ │ │ └── support │ │ │ │ │ │ └── discovery │ │ │ │ │ │ └── EurekaApplication.java │ │ │ │ └── resources │ │ │ │ │ ├── bootstrap.yml │ │ │ │ │ └── application.yml │ │ │ └── test │ │ │ │ └── java │ │ │ │ └── se │ │ │ │ └── callista │ │ │ │ └── microservises │ │ │ │ └── support │ │ │ │ └── discovery │ │ │ │ └── ApplicationTests.java │ │ ├── build.gradle │ │ └── gradlew.bat │ └── monitor-dashboard │ │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ ├── truststore.jks │ │ │ ├── log4j.properties │ │ │ └── bootstrap.yml │ │ │ └── java │ │ │ └── se │ │ │ └── callista │ │ │ └── microservises │ │ │ └── support │ │ │ └── monitordashboard │ │ │ └── HystrixDashboardApplication.java │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── build.gradle │ │ └── gradlew.bat ├── core │ ├── review-service │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── src │ │ │ ├── main │ │ │ │ ├── resources │ │ │ │ │ ├── truststore.jks │ │ │ │ │ └── bootstrap.yml │ │ │ │ └── java │ │ │ │ │ └── se │ │ │ │ │ └── callista │ │ │ │ │ └── microservices │ │ │ │ │ └── core │ │ │ │ │ └── review │ │ │ │ │ ├── ReviewServiceApplication.java │ │ │ │ │ └── service │ │ │ │ │ └── ReviewService.java │ │ │ └── test │ │ │ │ └── java │ │ │ │ └── se │ │ │ │ └── callista │ │ │ │ └── microservices │ │ │ │ └── core │ │ │ │ └── review │ │ │ │ └── ReviewServiceApplicationTests.java │ │ ├── Dockerfile │ │ ├── build.gradle │ │ ├── gradlew.bat │ │ └── gradlew │ ├── product-service │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── src │ │ │ ├── main │ │ │ │ ├── resources │ │ │ │ │ ├── truststore.jks │ │ │ │ │ └── bootstrap.yml │ │ │ │ └── java │ │ │ │ │ └── se │ │ │ │ │ └── callista │ │ │ │ │ └── microservices │ │ │ │ │ └── core │ │ │ │ │ └── product │ │ │ │ │ ├── ProductServiceApplication.java │ │ │ │ │ └── service │ │ │ │ │ └── ProductService.java │ │ │ └── test │ │ │ │ └── java │ │ │ │ └── se │ │ │ │ └── callista │ │ │ │ └── microservices │ │ │ │ └── core │ │ │ │ └── product │ │ │ │ └── ProductServiceApplicationTests.java │ │ ├── Dockerfile │ │ ├── build.gradle │ │ ├── gradlew.bat │ │ └── gradlew │ └── recommendation-service │ │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── src │ │ ├── main │ │ │ ├── resources │ │ │ │ ├── truststore.jks │ │ │ │ └── bootstrap.yml │ │ │ └── java │ │ │ │ └── se │ │ │ │ └── callista │ │ │ │ └── microservices │ │ │ │ └── core │ │ │ │ └── recommendation │ │ │ │ ├── RecommendationServiceApplication.java │ │ │ │ └── service │ │ │ │ └── RecommendationService.java │ │ └── test │ │ │ └── java │ │ │ └── se │ │ │ └── callista │ │ │ └── microservices │ │ │ └── core │ │ │ └── recommendation │ │ │ └── RecommendationServiceApplicationTests.java │ │ ├── Dockerfile │ │ ├── build.gradle │ │ └── gradlew.bat └── composite │ └── product-composite-service │ ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties │ ├── src │ ├── main │ │ ├── resources │ │ │ ├── truststore.jks │ │ │ └── bootstrap.yml │ │ └── java │ │ │ └── se │ │ │ └── callista │ │ │ └── microservices │ │ │ └── composite │ │ │ └── product │ │ │ ├── model │ │ │ ├── ReviewSummary.java │ │ │ ├── RecommendationSummary.java │ │ │ ├── ServiceAddresses.java │ │ │ └── ProductAggregated.java │ │ │ └── ProductCompositeServiceApplication.java │ └── test │ │ └── java │ │ └── se │ │ └── callista │ │ └── microservices │ │ └── composite │ │ └── product │ │ ├── ProductCompositeServiceApplicationTests.java │ │ └── service │ │ └── AsyncCallTests.java │ ├── Dockerfile │ ├── build.gradle │ └── gradlew.bat ├── util ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── src │ ├── main │ │ ├── java │ │ │ └── se │ │ │ │ └── callista │ │ │ │ └── microservices │ │ │ │ ├── util │ │ │ │ ├── LambdaServletFilter.java │ │ │ │ ├── SetProcTimeBean.java │ │ │ │ ├── CpuCruncherBean.java │ │ │ │ └── ServiceUtils.java │ │ │ │ └── model │ │ │ │ ├── Product.java │ │ │ │ ├── Review.java │ │ │ │ └── Recommendation.java │ │ └── resources │ │ │ └── defaultLogbackConfig.xml │ └── test │ │ └── java │ │ └── se │ │ └── callista │ │ └── microservices │ │ └── util │ │ └── ServiceUtilsTests.java ├── build.gradle ├── gradlew.bat └── gradlew ├── README.md ├── setup-env.sh ├── cf-stop-all.sh ├── cf-start-all.sh ├── .gitignore ├── Termfile-services-boot-run ├── Termfile-infra-boot-run ├── Termfile-infra-java-jar ├── gen-wrappers.sh ├── Termfile-services-java-jar ├── clean-all.sh ├── dependencies-all.sh ├── elk-config └── logstash.config ├── manifest-pcf.yml ├── docker-compose-without-elk.yml ├── test-all.sh └── circle.yml /microservices/support/auth-server/src/main/wro/main.less: -------------------------------------------------------------------------------- 1 | @brand-primary: #de8579; -------------------------------------------------------------------------------- /microservices/support/zipkin-server/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: zipkin-server 4 | 5 | -------------------------------------------------------------------------------- /util/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/util/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /microservices/support/config-server/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring.application.name: config-server 2 | 3 | encrypt.key: ${MY_CONFIG_ENCRYPT_KEY} 4 | 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # blog-microservices 2 | 3 | Source code for blogs regarding microservices at http://callistaenterprise.se/blogg/teknik/2015/05/20/blog-series-building-microservices/ -------------------------------------------------------------------------------- /microservices/support/auth-server/src/main/wro/wro.properties: -------------------------------------------------------------------------------- 1 | #List of preProcessors 2 | preProcessors=lessCssImport 3 | #List of postProcessors 4 | postProcessors=less4j,jsMin -------------------------------------------------------------------------------- /microservices/support/turbine/README.md: -------------------------------------------------------------------------------- 1 | turbine 2 | ======= 3 | After running, use this url in the hystrix dashboard: http://localhost:8989/turbine.stream?cluster=CUSTOMERS 4 | -------------------------------------------------------------------------------- /microservices/support/auth-server/src/main/resources/server.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/support/auth-server/src/main/resources/server.jks -------------------------------------------------------------------------------- /microservices/support/config-server/src/main/resources/server.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/support/config-server/src/main/resources/server.jks -------------------------------------------------------------------------------- /microservices/support/edge-server/src/main/resources/server.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/support/edge-server/src/main/resources/server.jks -------------------------------------------------------------------------------- /microservices/support/turbine/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/support/turbine/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /microservices/support/turbine/src/main/resources/truststore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/support/turbine/src/main/resources/truststore.jks -------------------------------------------------------------------------------- /microservices/core/review-service/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/core/review-service/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /microservices/core/review-service/src/main/resources/truststore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/core/review-service/src/main/resources/truststore.jks -------------------------------------------------------------------------------- /microservices/support/auth-server/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/support/auth-server/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /microservices/support/auth-server/src/main/resources/truststore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/support/auth-server/src/main/resources/truststore.jks -------------------------------------------------------------------------------- /microservices/support/edge-server/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/support/edge-server/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /microservices/support/edge-server/src/main/resources/truststore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/support/edge-server/src/main/resources/truststore.jks -------------------------------------------------------------------------------- /microservices/core/product-service/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/core/product-service/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /microservices/core/product-service/src/main/resources/truststore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/core/product-service/src/main/resources/truststore.jks -------------------------------------------------------------------------------- /microservices/support/config-server/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/support/config-server/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /microservices/support/zipkin-server/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/support/zipkin-server/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /microservices/support/discovery-server/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/support/discovery-server/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /microservices/core/recommendation-service/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/core/recommendation-service/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /microservices/core/recommendation-service/src/main/resources/truststore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/core/recommendation-service/src/main/resources/truststore.jks -------------------------------------------------------------------------------- /microservices/support/monitor-dashboard/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/support/monitor-dashboard/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /microservices/support/monitor-dashboard/src/main/resources/truststore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/support/monitor-dashboard/src/main/resources/truststore.jks -------------------------------------------------------------------------------- /microservices/composite/product-composite-service/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/composite/product-composite-service/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /microservices/composite/product-composite-service/src/main/resources/truststore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/callistaenterprise/blog-microservices/HEAD/microservices/composite/product-composite-service/src/main/resources/truststore.jks -------------------------------------------------------------------------------- /util/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 06 06:13:48 CEST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip 7 | -------------------------------------------------------------------------------- /microservices/support/auth-server/src/main/wro/wro.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | webjar:bootstrap/3.2.0/less/bootstrap.less 4 | file:${project.basedir}/src/main/wro/main.less 5 | webjar:jquery/2.1.1/jquery.min.js 6 | 7 | -------------------------------------------------------------------------------- /microservices/support/turbine/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 06 06:14:05 CEST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip 7 | -------------------------------------------------------------------------------- /microservices/core/product-service/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 06 06:14:07 CEST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip 7 | -------------------------------------------------------------------------------- /microservices/core/review-service/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 06 06:14:07 CEST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip 7 | -------------------------------------------------------------------------------- /microservices/support/auth-server/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 06 06:14:06 CEST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip 7 | -------------------------------------------------------------------------------- /microservices/support/config-server/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 06 06:14:04 CEST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip 7 | -------------------------------------------------------------------------------- /microservices/support/edge-server/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 06 06:14:12 CEST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip 7 | -------------------------------------------------------------------------------- /microservices/support/zipkin-server/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 06 06:14:12 CEST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip 7 | -------------------------------------------------------------------------------- /microservices/core/recommendation-service/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 06 06:14:05 CEST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip 7 | -------------------------------------------------------------------------------- /microservices/support/discovery-server/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 06 06:14:05 CEST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip 7 | -------------------------------------------------------------------------------- /microservices/support/monitor-dashboard/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 06 06:14:04 CEST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip 7 | -------------------------------------------------------------------------------- /setup-env.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export MY_JAVA_TOOL_OPTIONS=-Xmx256M 4 | export MY_CONFIG_USER=config_client 5 | export MY_CONFIG_PWD=config_client_pwd 6 | export MY_CONFIG_ENCRYPT_KEY=my-very-secret-encryption-key 7 | export COMPOSE_FILE=docker-compose-with-elk.yml 8 | #export COMPOSE_FILE=docker-compose-without-elk.yml 9 | -------------------------------------------------------------------------------- /microservices/composite/product-composite-service/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Sep 06 06:14:04 CEST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-bin.zip 7 | -------------------------------------------------------------------------------- /cf-stop-all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cf stop auth-server 4 | cf stop discovery-server 5 | cf stop config-server 6 | cf stop edge-server 7 | cf stop monitor-dashboard 8 | cf stop product-composite-service 9 | cf stop product-service 10 | cf stop recommendation-service 11 | cf stop review-service 12 | cf stop turbine 13 | 14 | cf apps 15 | 16 | -------------------------------------------------------------------------------- /cf-start-all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cf start auth-server 4 | cf start discovery-server 5 | cf start config-server 6 | cf start edge-server 7 | cf start monitor-dashboard 8 | cf start product-composite-service 9 | cf start product-service 10 | cf start recommendation-service 11 | cf start review-service 12 | cf start turbine 13 | 14 | cf apps 15 | 16 | -------------------------------------------------------------------------------- /microservices/support/monitor-dashboard/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO, FILE 2 | log4j.appender.FILE=org.apache.log4j.ConsoleAppender 3 | log4j.appender.FILE.layout=org.apache.log4j.PatternLayout 4 | log4j.appender.FILE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %p %C:%L [%C{1}] [%M]: %m%n 5 | 6 | log4j.appender.FILE.httpclient=ERROR 7 | -------------------------------------------------------------------------------- /microservices/support/config-server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8u111-jre-alpine 2 | MAINTAINER Magnus Larsson 3 | 4 | EXPOSE 8888 5 | 6 | ADD ./build/libs/*.jar app.jar 7 | 8 | # Regarding settings of java.security.egd, see http://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source 9 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 10 | -------------------------------------------------------------------------------- /microservices/support/discovery-server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8u111-jre-alpine 2 | MAINTAINER Magnus Larsson 3 | 4 | EXPOSE 8761 5 | 6 | ADD ./build/libs/*.jar app.jar 7 | 8 | # Regarding settings of java.security.egd, see http://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source 9 | ENTRYPOINT ["java","-Dspring.profiles.active=docker","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 10 | -------------------------------------------------------------------------------- /microservices/support/zipkin-server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8u111-jre-alpine 2 | MAINTAINER Magnus Larsson 3 | 4 | EXPOSE 9411 5 | 6 | ADD ./build/libs/*.jar app.jar 7 | 8 | # Regarding settings of java.security.egd, see http://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source 9 | ENTRYPOINT ["java","-Dspring.profiles.active=docker","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 10 | -------------------------------------------------------------------------------- /util/src/main/java/se/callista/microservices/util/LambdaServletFilter.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.util; 2 | 3 | import javax.servlet.Filter; 4 | import javax.servlet.FilterConfig; 5 | import javax.servlet.ServletException; 6 | 7 | /** 8 | * Created by magnus on 01/05/15. 9 | */ 10 | public interface LambdaServletFilter extends Filter { 11 | 12 | default public void init(FilterConfig filterConfig) throws ServletException {} 13 | default public void destroy() {} 14 | } 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Java Files # 2 | *.class 3 | 4 | # Package Files # 5 | # *.jar, we need to checkin gradle/wrapper/gradle-wrapper.jar 6 | *.war 7 | *.ear 8 | 9 | # Eclipse files # 10 | .settings 11 | .classpath 12 | .project 13 | 14 | # IntelliJ files # 15 | .idea 16 | local.properties 17 | *.iml 18 | out 19 | 20 | # Gradle files # 21 | .gradle 22 | build 23 | 24 | target 25 | logs 26 | ML-to-do-notes.md 27 | data 28 | mycert.pem 29 | incubator 30 | build-all-fast.sh 31 | gradlew 32 | gradlew.bat 33 | gradle 34 | -------------------------------------------------------------------------------- /microservices/support/zipkin-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server.port: 9411 2 | 3 | spring.rabbitmq.host: localhost 4 | spring.rabbitmq.port: 5672 5 | 6 | logging: 7 | level: 8 | ROOT: INFO 9 | org.springframework.cloud.sleuth.instrument.messaging.MessagingSpanExtractor: ERROR 10 | org.springframework.cloud.sleuth.util.ExceptionUtils: ERROR 11 | 12 | --- 13 | # For deployment in Docker containers 14 | spring: 15 | profiles: docker 16 | 17 | spring.rabbitmq.host: rabbitmq 18 | 19 | 20 | -------------------------------------------------------------------------------- /microservices/support/discovery-server/README.md: -------------------------------------------------------------------------------- 1 | # Eureka Server Sample 2 | 3 | Run this project as a Spring Boot app (e.g. import into IDE and run 4 | main method, or use "mvn spring-boot:run"). It will start up on port 5 | 8761 and serve the Eureka API from "/eureka". 6 | 7 | ## Resources 8 | 9 | | Path | Description | 10 | |------------------|--------------| 11 | | / | Home page (HTML UI) listing service registrations | 12 | | /eureka/apps | Raw registration metadata | 13 | -------------------------------------------------------------------------------- /microservices/core/product-service/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8u111-jre-alpine 2 | MAINTAINER Magnus Larsson 3 | 4 | EXPOSE 8080 5 | 6 | ADD ./build/libs/*.jar app.jar 7 | ADD src/main/resources/truststore.jks truststore.jks 8 | 9 | # Regarding settings of java.security.egd, see http://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source 10 | ENTRYPOINT ["java","-Dspring.profiles.active=docker","-Djavax.net.ssl.trustStore=truststore.jks","-Djavax.net.ssl.trustStorePassword=password","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 11 | -------------------------------------------------------------------------------- /microservices/core/review-service/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8u111-jre-alpine 2 | MAINTAINER Magnus Larsson 3 | 4 | EXPOSE 8080 5 | 6 | ADD ./build/libs/*.jar app.jar 7 | ADD src/main/resources/truststore.jks truststore.jks 8 | 9 | # Regarding settings of java.security.egd, see http://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source 10 | ENTRYPOINT ["java","-Dspring.profiles.active=docker","-Djavax.net.ssl.trustStore=truststore.jks","-Djavax.net.ssl.trustStorePassword=password","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 11 | -------------------------------------------------------------------------------- /microservices/support/auth-server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8u111-jre-alpine 2 | MAINTAINER Magnus Larsson 3 | 4 | EXPOSE 9999 5 | 6 | ADD ./build/libs/*.jar app.jar 7 | ADD src/main/resources/truststore.jks truststore.jks 8 | 9 | # Regarding settings of java.security.egd, see http://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source 10 | ENTRYPOINT ["java","-Dspring.profiles.active=docker","-Djavax.net.ssl.trustStore=truststore.jks","-Djavax.net.ssl.trustStorePassword=password","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 11 | -------------------------------------------------------------------------------- /microservices/support/edge-server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8u111-jre-alpine 2 | MAINTAINER Magnus Larsson 3 | 4 | EXPOSE 8765 5 | 6 | ADD ./build/libs/*.jar app.jar 7 | ADD src/main/resources/truststore.jks truststore.jks 8 | 9 | # Regarding settings of java.security.egd, see http://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source 10 | ENTRYPOINT ["java","-Dspring.profiles.active=docker","-Djavax.net.ssl.trustStore=truststore.jks","-Djavax.net.ssl.trustStorePassword=password","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 11 | -------------------------------------------------------------------------------- /microservices/support/monitor-dashboard/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8u111-jre-alpine 2 | MAINTAINER Magnus Larsson 3 | 4 | EXPOSE 7979 5 | 6 | ADD ./build/libs/*.jar app.jar 7 | ADD src/main/resources/truststore.jks truststore.jks 8 | 9 | # Regarding settings of java.security.egd, see http://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source 10 | ENTRYPOINT ["java","-Dspring.profiles.active=docker","-Djavax.net.ssl.trustStore=truststore.jks","-Djavax.net.ssl.trustStorePassword=password","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 11 | -------------------------------------------------------------------------------- /microservices/core/recommendation-service/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8u111-jre-alpine 2 | MAINTAINER Magnus Larsson 3 | 4 | EXPOSE 8080 5 | 6 | ADD ./build/libs/*.jar app.jar 7 | ADD src/main/resources/truststore.jks truststore.jks 8 | 9 | # Regarding settings of java.security.egd, see http://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source 10 | ENTRYPOINT ["java","-Dspring.profiles.active=docker","-Djavax.net.ssl.trustStore=truststore.jks","-Djavax.net.ssl.trustStorePassword=password","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 11 | -------------------------------------------------------------------------------- /microservices/composite/product-composite-service/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM openjdk:8u111-jre-alpine 2 | MAINTAINER Magnus Larsson 3 | 4 | EXPOSE 8080 5 | 6 | ADD ./build/libs/*.jar app.jar 7 | ADD src/main/resources/truststore.jks truststore.jks 8 | 9 | # Regarding settings of java.security.egd, see http://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source 10 | ENTRYPOINT ["java","-Dspring.profiles.active=docker","-Djavax.net.ssl.trustStore=truststore.jks","-Djavax.net.ssl.trustStorePassword=password","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 11 | -------------------------------------------------------------------------------- /microservices/support/monitor-dashboard/README.md: -------------------------------------------------------------------------------- 1 | # Hystrix Dashboard 2 | 3 | Run this app as a normal Spring Boot app and then go to the home page 4 | in a browser. If you run from this project it will be on port 7979 5 | (per the `application.yml`). On the home page is a form where you can 6 | enter the URL for an event stream to monitor, for example (the 7 | customers service running locally): 8 | `http://localhost:9000/hystrix.stream`. Any app that uses 9 | `@EnableHystrix` will expose the stream. 10 | 11 | To aggregate many streams together you can use the 12 | [Turbine sample](https://github.com/spring-cloud-samples/turbine). 13 | -------------------------------------------------------------------------------- /microservices/support/zipkin-server/src/main/java/se/callista/microservises/workshop/zipkin/ZipkinServerApplication.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservises.workshop.zipkin; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.sleuth.zipkin.stream.EnableZipkinStreamServer; 6 | 7 | @EnableZipkinStreamServer 8 | @SpringBootApplication 9 | public class ZipkinServerApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(ZipkinServerApplication.class, args); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /microservices/support/discovery-server/src/main/java/se/callista/microservises/support/discovery/EurekaApplication.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservises.support.discovery; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; 7 | 8 | @SpringBootApplication 9 | @EnableEurekaServer 10 | @EnableDiscoveryClient 11 | public class EurekaApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(EurekaApplication.class, args); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /microservices/support/edge-server/README.md: -------------------------------------------------------------------------------- 1 | # Zuul Server 2 | 3 | Run this app as a normal Spring Boot app. If you run from this project 4 | it will be on port 8765 (per the `application.yml`). Also run the 5 | [stores](https://github.com/spring-cloud-samples/customers-stores/tree/master/rest-microservices-store) 6 | and [customers](https://github.com/spring-cloud-samples/customers-stores/tree/master/rest-microservices-customers) 7 | samples from the [customer-stores](https://github.com/spring-cloud-samples/customers-stores) 8 | sample. 9 | 10 | You should then be able to view json content from 11 | `http://localhost:8765/stores` and `http://localhost:8765/customers` which are 12 | configured in `application.yml` as proxy routes. 13 | -------------------------------------------------------------------------------- /Termfile-services-boot-run: -------------------------------------------------------------------------------- 1 | # Use: 2 | # $ termrc start Termfile-services 3 | 4 | root: 5 | ~/Documents/projects/blogs/git/blog-microservices/microservices 6 | 7 | commands: 8 | product: cd core/product-service; ./gradlew bootRun 9 | recommendation: cd core/recommendation-service; ./gradlew bootRun 10 | review: cd core/review-service; ./gradlew bootRun 11 | product-composite: cd composite/product-composite-service; ./gradlew bootRun 12 | product-api: cd api/product-api-service; ./gradlew bootRun 13 | 14 | webapp: cd ../webapp/ui; mvn spring-boot:run 15 | 16 | layout_type: row 17 | 18 | layout: 19 | - [ product, recommendation, review, product-composite, product-api ] 20 | # - [ webapp ] 21 | -------------------------------------------------------------------------------- /microservices/composite/product-composite-service/src/main/java/se/callista/microservices/composite/product/model/ReviewSummary.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.composite.product.model; 2 | 3 | /** 4 | * Created by magnus on 05/03/15. 5 | */ 6 | public class ReviewSummary { 7 | 8 | private int reviewId; 9 | private String author; 10 | private String subject; 11 | 12 | public ReviewSummary(int reviewId, String author, String subject) { 13 | this.reviewId = reviewId; 14 | this.author = author; 15 | this.subject = subject; 16 | } 17 | 18 | public int getReviewId() { 19 | return reviewId; 20 | } 21 | 22 | public String getAuthor() { 23 | return author; 24 | } 25 | 26 | public String getSubject() { 27 | return subject; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /microservices/support/turbine/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: turbine-server 4 | cloud: 5 | config: 6 | failFast: true 7 | retry: 8 | initialInterval: 3000 9 | multiplier: 1.3 10 | maxInterval: 5000 11 | maxAttempts: 20 12 | discovery: 13 | serviceId: config-server 14 | enabled: false 15 | uri: https://localhost:8888 16 | 17 | #eureka.client.serviceUrl.defaultZone: http://localhost:8761/eureka/ 18 | 19 | --- 20 | # For deployment in Docker containers 21 | spring: 22 | profiles: docker 23 | cloud: 24 | config: 25 | discovery: 26 | enabled: false 27 | uri: https://${MY_CONFIG_USER}:${MY_CONFIG_PWD}@config:8888 28 | 29 | #eureka.client.serviceUrl.defaultZone: http://discovery:8761/eureka/ 30 | -------------------------------------------------------------------------------- /microservices/support/discovery-server/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: discovery-server 4 | # cloud: 5 | # config: 6 | # failFast: true 7 | # retry: 8 | # initialInterval: 3000 9 | # multiplier: 1.3 10 | # maxInterval: 5000 11 | # maxAttempts: 20 12 | # discovery: 13 | # serviceId: config-server 14 | # enabled: false 15 | # uri: https://localhost:8888 16 | # 17 | ##eureka.client.serviceUrl.defaultZone: http://localhost:8761/eureka/ 18 | # 19 | #--- 20 | ## For deployment in Docker containers 21 | #spring: 22 | # profiles: docker 23 | # cloud: 24 | # config: 25 | # discovery: 26 | # enabled: false 27 | # uri: https://${MY_CONFIG_USER}:${MY_CONFIG_PWD}@config:8888 28 | # 29 | ##eureka.client.serviceUrl.defaultZone: http://discovery:8761/eureka/ 30 | -------------------------------------------------------------------------------- /microservices/composite/product-composite-service/src/main/java/se/callista/microservices/composite/product/model/RecommendationSummary.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.composite.product.model; 2 | 3 | /** 4 | * Created by magnus on 05/03/15. 5 | */ 6 | public class RecommendationSummary { 7 | 8 | private int recommendationId; 9 | private String author; 10 | private int rate; 11 | 12 | public RecommendationSummary(int recommendationId, String author, int rate) { 13 | this.recommendationId = recommendationId; 14 | this.author = author; 15 | this.rate = rate; 16 | } 17 | 18 | public int getRecommendationId() { 19 | return recommendationId; 20 | } 21 | 22 | public String getAuthor() { 23 | return author; 24 | } 25 | 26 | public int getRate() { 27 | return rate; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /microservices/support/auth-server/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | info: 2 | component: OAuth Auth Server 3 | 4 | spring: 5 | application: 6 | name: auth-server 7 | cloud: 8 | config: 9 | failFast: true 10 | retry: 11 | initialInterval: 3000 12 | multiplier: 1.3 13 | maxInterval: 5000 14 | maxAttempts: 20 15 | discovery: 16 | serviceId: config-server 17 | enabled: false 18 | uri: https://localhost:8888 19 | 20 | #eureka.client.serviceUrl.defaultZone: http://localhost:8761/eureka/ 21 | 22 | --- 23 | # For deployment in Docker containers 24 | spring: 25 | profiles: docker 26 | cloud: 27 | config: 28 | discovery: 29 | enabled: false 30 | uri: https://${MY_CONFIG_USER}:${MY_CONFIG_PWD}@config:8888 31 | 32 | #eureka.client.serviceUrl.defaultZone: http://discovery:8761/eureka/ 33 | -------------------------------------------------------------------------------- /microservices/support/auth-server/src/main/resources/templates/login.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |
8 |
9 | 10 | 11 |
12 |
13 | 14 | 15 |
16 | 17 | 18 |
19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /microservices/core/review-service/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | info: 2 | component: Review Core Service 3 | 4 | spring: 5 | application: 6 | name: review-service 7 | cloud: 8 | config: 9 | failFast: true 10 | retry: 11 | initialInterval: 3000 12 | multiplier: 1.3 13 | maxInterval: 5000 14 | maxAttempts: 20 15 | discovery: 16 | serviceId: config-server 17 | enabled: false 18 | uri: https://localhost:8888 19 | 20 | #eureka.client.serviceUrl.defaultZone: http://localhost:8761/eureka/ 21 | 22 | --- 23 | # For deployment in Docker containers 24 | spring: 25 | profiles: docker 26 | cloud: 27 | config: 28 | discovery: 29 | enabled: false 30 | uri: https://${MY_CONFIG_USER}:${MY_CONFIG_PWD}@config:8888 31 | 32 | #eureka.client.serviceUrl.defaultZone: http://discovery:8761/eureka/ 33 | -------------------------------------------------------------------------------- /microservices/core/product-service/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | info: 2 | component: Product Core Service 3 | 4 | spring: 5 | application: 6 | name: product-service 7 | cloud: 8 | config: 9 | failFast: true 10 | retry: 11 | initialInterval: 3000 12 | multiplier: 1.3 13 | maxInterval: 5000 14 | maxAttempts: 20 15 | discovery: 16 | serviceId: config-server 17 | enabled: false 18 | uri: https://localhost:8888 19 | 20 | #eureka.client.serviceUrl.defaultZone: http://localhost:8761/eureka/ 21 | 22 | --- 23 | # For deployment in Docker containers 24 | spring: 25 | profiles: docker 26 | cloud: 27 | config: 28 | discovery: 29 | enabled: false 30 | uri: https://${MY_CONFIG_USER}:${MY_CONFIG_PWD}@config:8888 31 | 32 | #eureka.client.serviceUrl.defaultZone: http://discovery:8761/eureka/ 33 | -------------------------------------------------------------------------------- /Termfile-infra-boot-run: -------------------------------------------------------------------------------- 1 | # Use: 2 | # $ termrc start Termfile-infra 3 | 4 | root: 5 | ~/Documents/projects/blogs/git/blog-microservices/microservices 6 | 7 | commands: 8 | rabbitMq: ~/Applications/rabbitmq_server-3.4.3/sbin/rabbitmq-server 9 | 10 | auth-server: cd support/auth-server; ./gradlew bootRun 11 | config-server: cd support/config-server; ./gradlew bootRun 12 | discovery-server: cd support/discovery-server; ./gradlew bootRun 13 | monitor-dashboard: cd support/monitor-dashboard; ./gradlew bootRun 14 | edge-server: cd support/edge-server; ./gradlew bootRun 15 | turbine: cd support/turbine; ./gradlew bootRun 16 | 17 | layout_type: row 18 | 19 | layout: 20 | # - [ rabbitMq, auth-server, config-server, discovery-server ] 21 | - [ rabbitMq, auth-server, discovery-server ] 22 | - [ monitor-dashboard, turbine, edge-server ] 23 | -------------------------------------------------------------------------------- /microservices/support/config-server/src/test/java/se/callista/microservises/support/ConfigServerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservises.support; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.IntegrationTest; 6 | import org.springframework.boot.test.SpringApplicationConfiguration; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | 9 | @RunWith(SpringJUnit4ClassRunner.class) 10 | @SpringApplicationConfiguration(classes = ConfigServerApplication.class) 11 | // Instruct embedded Tomcat to run on a random free port and skip talking to the Bus and the Discovery server 12 | @IntegrationTest({"server.port=0", "spring.cloud.bus.enabled=false", "spring.cloud.discovery.enabled=false"}) 13 | public class ConfigServerApplicationTests { 14 | 15 | @Test 16 | public void contextLoads() { 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /microservices/support/edge-server/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | info: 2 | component: Edge server (based on Netflix Zuul) 3 | 4 | spring: 5 | application: 6 | name: edge-server 7 | cloud: 8 | config: 9 | failFast: true 10 | retry: 11 | initialInterval: 3000 12 | multiplier: 1.3 13 | maxInterval: 5000 14 | maxAttempts: 20 15 | discovery: 16 | serviceId: config-server 17 | enabled: false 18 | uri: https://localhost:8888 19 | 20 | #eureka.client.serviceUrl.defaultZone: http://localhost:8761/eureka/ 21 | 22 | --- 23 | # For deployment in Docker containers 24 | spring: 25 | profiles: docker 26 | cloud: 27 | config: 28 | discovery: 29 | enabled: false 30 | uri: https://${MY_CONFIG_USER}:${MY_CONFIG_PWD}@config:8888 31 | 32 | #eureka.client.serviceUrl.defaultZone: http://discovery:8761/eureka/ 33 | -------------------------------------------------------------------------------- /microservices/support/monitor-dashboard/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | info: 2 | component: Hystrix Dashboard 3 | 4 | spring: 5 | application: 6 | name: monitor-dashboard 7 | cloud: 8 | config: 9 | failFast: true 10 | retry: 11 | initialInterval: 3000 12 | multiplier: 1.3 13 | maxInterval: 5000 14 | maxAttempts: 20 15 | discovery: 16 | serviceId: config-server 17 | enabled: false 18 | uri: https://localhost:8888 19 | 20 | #eureka.client.serviceUrl.defaultZone: http://localhost:8761/eureka/ 21 | 22 | --- 23 | # For deployment in Docker containers 24 | spring: 25 | profiles: docker 26 | cloud: 27 | config: 28 | discovery: 29 | enabled: false 30 | uri: https://${MY_CONFIG_USER}:${MY_CONFIG_PWD}@config:8888 31 | 32 | #eureka.client.serviceUrl.defaultZone: http://discovery:8761/eureka/ 33 | -------------------------------------------------------------------------------- /microservices/composite/product-composite-service/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | info: 2 | component: Product Composite Service 3 | 4 | spring: 5 | application: 6 | name: composite-service 7 | cloud: 8 | config: 9 | failFast: true 10 | retry: 11 | initialInterval: 3000 12 | multiplier: 1.3 13 | maxInterval: 5000 14 | maxAttempts: 20 15 | discovery: 16 | serviceId: config-server 17 | enabled: false 18 | uri: https://localhost:8888 19 | 20 | #eureka.client.serviceUrl.defaultZone: http://localhost:8761/eureka/ 21 | 22 | --- 23 | # For deployment in Docker containers 24 | spring: 25 | profiles: docker 26 | cloud: 27 | config: 28 | discovery: 29 | enabled: false 30 | uri: https://${MY_CONFIG_USER}:${MY_CONFIG_PWD}@config:8888 31 | 32 | #eureka.client.serviceUrl.defaultZone: http://discovery:8761/eureka/ 33 | -------------------------------------------------------------------------------- /microservices/core/recommendation-service/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | info: 2 | component: Recommendation Core Service 3 | 4 | spring: 5 | application: 6 | name: recommendation-service 7 | cloud: 8 | config: 9 | failFast: true 10 | retry: 11 | initialInterval: 3000 12 | multiplier: 1.3 13 | maxInterval: 5000 14 | maxAttempts: 20 15 | discovery: 16 | serviceId: config-server 17 | enabled: false 18 | uri: https://localhost:8888 19 | 20 | #eureka.client.serviceUrl.defaultZone: http://localhost:8761/eureka/ 21 | 22 | --- 23 | # For deployment in Docker containers 24 | spring: 25 | profiles: docker 26 | cloud: 27 | config: 28 | discovery: 29 | enabled: false 30 | uri: https://${MY_CONFIG_USER}:${MY_CONFIG_PWD}@config:8888 31 | 32 | #eureka.client.serviceUrl.defaultZone: http://discovery:8761/eureka/ 33 | 34 | -------------------------------------------------------------------------------- /Termfile-infra-java-jar: -------------------------------------------------------------------------------- 1 | # Use: 2 | # $ termrc start Termfile-infra 3 | 4 | root: 5 | ~/Documents/projects/blogs/git/blog-microservices/microservices 6 | 7 | commands: 8 | rabbitMq: ~/Applications/rabbitmq_server-3.4.3/sbin/rabbitmq-server 9 | 10 | auth-server: cd support/auth-server; java -jar build/libs/*.jar 11 | config-server: cd support/config-server; java -jar build/libs/*.jar 12 | discovery-server: cd support/discovery-server; java -jar build/libs/*.jar 13 | monitor-dashboard: cd support/monitor-dashboard; java -jar build/libs/*.jar 14 | edge-server: cd support/edge-server; java -jar build/libs/*.jar 15 | turbine: cd support/turbine; java -jar build/libs/*.jar 16 | 17 | layout_type: row 18 | 19 | layout: 20 | # - [ rabbitMq, auth-server, config-server, discovery-server ] 21 | - [ rabbitMq, auth-server, discovery-server ] 22 | - [ monitor-dashboard, turbine, edge-server ] 23 | -------------------------------------------------------------------------------- /gen-wrappers.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd util; ./gradlew wrapper; cd - 6 | 7 | cd microservices/core/product-service; ./gradlew wrapper; cd - 8 | cd microservices/core/recommendation-service; ./gradlew wrapper; cd - 9 | cd microservices/core/review-service; ./gradlew wrapper; cd - 10 | cd microservices/composite/product-composite-service; ./gradlew wrapper; cd - 11 | 12 | cd microservices/support/auth-server; ./gradlew wrapper; cd - 13 | cd microservices/support/config-server; ./gradlew wrapper; cd - 14 | cd microservices/support/discovery-server; ./gradlew wrapper; cd - 15 | cd microservices/support/edge-server; ./gradlew wrapper; cd - 16 | cd microservices/support/monitor-dashboard; ./gradlew wrapper; cd - 17 | cd microservices/support/turbine; ./gradlew wrapper; cd - -------------------------------------------------------------------------------- /Termfile-services-java-jar: -------------------------------------------------------------------------------- 1 | # Use: 2 | # $ termrc start Termfile-services 3 | 4 | root: 5 | ~/Documents/projects/blogs/git/blog-microservices/microservices 6 | 7 | commands: 8 | product: cd core/product-service; java -jar build/libs/*.jar 9 | recommendation: cd core/recommendation-service; java -jar build/libs/*.jar 10 | review: cd core/review-service; java -jar build/libs/*.jar 11 | product-composite: cd composite/product-composite-service; java -jar build/libs/*.jar 12 | product-api: cd api/product-api-service; java -Djavax.net.ssl.trustStore=src/main/resources/truststore.jks -Djavax.net.ssl.trustStorePassword=password -jar build/libs/*.jar 13 | webapp: cd ../webapp/ui; java -jar target/*.jar 14 | 15 | layout_type: row 16 | 17 | layout: 18 | - [ product, recommendation, review, product-composite, product-api ] 19 | # - [ webapp ] 20 | -------------------------------------------------------------------------------- /clean-all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd util; ./gradlew clean; cd - 4 | 5 | cd microservices/core/product-service; ./gradlew clean; cd - 6 | cd microservices/core/recommendation-service; ./gradlew clean; cd - 7 | cd microservices/core/review-service; ./gradlew clean; cd - 8 | cd microservices/composite/product-composite-service; ./gradlew clean; cd - 9 | 10 | cd microservices/support/auth-server; ./gradlew clean; cd - 11 | cd microservices/support/config-server; ./gradlew clean; cd - 12 | cd microservices/support/discovery-server; ./gradlew clean; cd - 13 | cd microservices/support/edge-server; ./gradlew clean; cd - 14 | cd microservices/support/monitor-dashboard; ./gradlew clean; cd - 15 | cd microservices/support/turbine; ./gradlew clean; cd - 16 | cd microservices/support/zipkin-server; ./gradlew clean; cd - 17 | -------------------------------------------------------------------------------- /microservices/core/product-service/src/test/java/se/callista/microservices/core/product/ProductServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.core.product; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.IntegrationTest; 6 | import org.springframework.boot.test.SpringApplicationConfiguration; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | import org.springframework.test.context.web.WebAppConfiguration; 9 | 10 | @RunWith(SpringJUnit4ClassRunner.class) 11 | @SpringApplicationConfiguration(classes = ProductServiceApplication.class) 12 | @WebAppConfiguration 13 | // Instruct embedded Tomcat to run on a random free port and skip talking to the Config, Bus and Discovery server 14 | @IntegrationTest({"server.port=0", "spring.cloud.config.enabled=false", "spring.cloud.bus.enabled=false", "spring.cloud.discovery.enabled=false"}) 15 | public class ProductServiceApplicationTests { 16 | 17 | @Test 18 | public void contextLoads() { 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /microservices/composite/product-composite-service/src/main/java/se/callista/microservices/composite/product/model/ServiceAddresses.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.composite.product.model; 2 | 3 | /** 4 | * Created by magnus on 2017-04-16. 5 | */ 6 | public class ServiceAddresses { 7 | private String cmp; 8 | private String pro; 9 | private String rev; 10 | private String rec; 11 | 12 | public ServiceAddresses() { 13 | } 14 | 15 | public ServiceAddresses(String compositeAddress, String productAddress, String reviewAddress, String recommendationAddress) { 16 | this.cmp = compositeAddress; 17 | this.pro = productAddress; 18 | this.rev = reviewAddress; 19 | this.rec = recommendationAddress; 20 | } 21 | 22 | public String getCmp() { 23 | return cmp; 24 | } 25 | 26 | public String getPro() { 27 | return pro; 28 | } 29 | 30 | public String getRev() { 31 | return rev; 32 | } 33 | 34 | public String getRec() { 35 | return rec; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /microservices/core/recommendation-service/src/test/java/se/callista/microservices/core/recommendation/RecommendationServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.core.recommendation; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.IntegrationTest; 6 | import org.springframework.boot.test.SpringApplicationConfiguration; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | import org.springframework.test.context.web.WebAppConfiguration; 9 | 10 | @RunWith(SpringJUnit4ClassRunner.class) 11 | @SpringApplicationConfiguration(classes = RecommendationServiceApplication.class) 12 | @WebAppConfiguration 13 | // Instruct embedded Tomcat to run on a random free port and skip talking to the Config, Bus and Discovery server 14 | @IntegrationTest({"server.port=0", "spring.cloud.config.enabled=false", "spring.cloud.bus.enabled=false", "spring.cloud.discovery.enabled=false"}) 15 | public class RecommendationServiceApplicationTests { 16 | 17 | @Test 18 | public void contextLoads() { 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /microservices/composite/product-composite-service/src/test/java/se/callista/microservices/composite/product/ProductCompositeServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.composite.product; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.IntegrationTest; 6 | import org.springframework.boot.test.SpringApplicationConfiguration; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | import org.springframework.test.context.web.WebAppConfiguration; 9 | 10 | @RunWith(SpringJUnit4ClassRunner.class) 11 | @SpringApplicationConfiguration(classes = ProductCompositeServiceApplication.class) 12 | @WebAppConfiguration 13 | // Instruct embedded Tomcat to run on a random free port and skip talking to the Config, Bus and Discovery server 14 | @IntegrationTest({"server.port=0", "spring.cloud.config.enabled=false", "spring.cloud.bus.enabled=false", "spring.cloud.discovery.enabled=false"}) 15 | public class ProductCompositeServiceApplicationTests { 16 | 17 | @Test 18 | public void contextLoads() { 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /microservices/core/review-service/src/test/java/se/callista/microservices/core/review/ReviewServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.core.review; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.IntegrationTest; 6 | import org.springframework.boot.test.SpringApplicationConfiguration; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | import org.springframework.test.context.web.WebAppConfiguration; 9 | 10 | @RunWith(SpringJUnit4ClassRunner.class) 11 | @SpringApplicationConfiguration(classes = ReviewServiceApplication.class) 12 | @WebAppConfiguration 13 | // Instruct embedded Tomcat to run on a random free port and skip talking to the Config, Bus and Discovery server 14 | @IntegrationTest({ 15 | "server.port=0", 16 | "spring.cloud.config.enabled=false", 17 | "spring.cloud.bus.enabled=false", 18 | "spring.cloud.discovery.enabled=false", 19 | "my-secret-property=my-secret-test-property" 20 | }) 21 | public class ReviewServiceApplicationTests { 22 | 23 | @Test 24 | public void contextLoads() { 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /util/src/main/java/se/callista/microservices/model/Product.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.model; 2 | 3 | /** 4 | * Created by magnus on 04/03/15. 5 | */ 6 | public class Product { 7 | private int productId; 8 | private String name; 9 | private int weight; 10 | private String serviceAddress; 11 | 12 | public Product() { 13 | } 14 | 15 | public Product(int productId, String name, int weight, String serviceAddress) { 16 | this.productId = productId; 17 | this.name = name; 18 | this.weight = weight; 19 | this.serviceAddress = serviceAddress; 20 | } 21 | 22 | public int getProductId() { 23 | return productId; 24 | } 25 | 26 | public void setProductId(int productId) { 27 | this.productId = productId; 28 | } 29 | 30 | public String getName() { 31 | return name; 32 | } 33 | 34 | public void setName(String name) { 35 | this.name = name; 36 | } 37 | 38 | public int getWeight() { 39 | return weight; 40 | } 41 | 42 | public void setWeight(int weight) { 43 | this.weight = weight; 44 | } 45 | 46 | public String getServiceAddress() { 47 | return serviceAddress; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /microservices/support/auth-server/src/main/resources/templates/authorize.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |
7 |

Please Confirm

8 | 9 |

10 | Do you authorize "${authorizationRequest.clientId}" at "${authorizationRequest.redirectUri}" to access your protected resources 11 | with scope ${authorizationRequest.scope?join(", ")}. 12 |

13 |
15 | 16 | 17 | 18 |
19 |
21 | 22 | 23 | 24 |
25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /microservices/support/config-server/src/main/java/se/callista/microservises/support/ConfigServerApplication.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservises.support; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; 6 | import org.springframework.amqp.rabbit.connection.ConnectionFactory; 7 | import org.springframework.beans.factory.annotation.Value; 8 | import org.springframework.boot.SpringApplication; 9 | import org.springframework.boot.autoconfigure.SpringBootApplication; 10 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 11 | import org.springframework.cloud.config.server.EnableConfigServer; 12 | import org.springframework.context.ConfigurableApplicationContext; 13 | import org.springframework.context.annotation.Bean; 14 | 15 | @EnableConfigServer 16 | @EnableDiscoveryClient 17 | @SpringBootApplication 18 | public class ConfigServerApplication { 19 | 20 | private static final Logger LOG = LoggerFactory.getLogger(ConfigServerApplication.class); 21 | 22 | public static void main(String[] args) { 23 | ConfigurableApplicationContext ctx = SpringApplication.run(ConfigServerApplication.class, args); 24 | 25 | LOG.info("Connected to RabbitMQ at: {}", ctx.getEnvironment().getProperty("spring.rabbitmq.host")); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /util/src/test/java/se/callista/microservices/util/ServiceUtilsTests.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.util; 2 | 3 | import org.junit.Test; 4 | import org.slf4j.MDC; 5 | 6 | import static org.junit.Assert.assertEquals; 7 | import static org.junit.Assert.assertNull; 8 | 9 | public class ServiceUtilsTests { 10 | 11 | 12 | @Test 13 | public void someTest() { 14 | assertEquals("ok", "ok"); 15 | } 16 | 17 | @Test 18 | public void mdcTest() { 19 | 20 | final String KEY = "A"; 21 | 22 | try { 23 | 24 | { 25 | String a0 = MDC.get(KEY); 26 | assertNull(a0); 27 | } 28 | 29 | { 30 | MDC.put(KEY, "1"); 31 | String a1 = MDC.get(KEY); 32 | assertEquals(a1, "1"); 33 | } 34 | 35 | { 36 | MDC.remove(KEY); 37 | String a1_gone = MDC.get(KEY); 38 | assertNull(a1_gone); 39 | } 40 | 41 | { 42 | MDC.put(KEY, "2"); 43 | String a2 = MDC.get(KEY); 44 | assertEquals(a2, "2"); 45 | } 46 | 47 | } finally { 48 | MDC.remove(KEY); 49 | String a2_gone = MDC.get(KEY); 50 | assertNull(a2_gone); 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /util/src/main/resources/defaultLogbackConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | System.out 7 | 8 | ${LOG_PATTERN} 9 | 10 | 11 | 12 | 13 | 14 | ${LOG_FILE} 15 | 16 | ${LOG_FILE}.%i 17 | 21 | 22 | 23 | 10MB 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /dependencies-all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd util; ./gradlew dependencies --configuration compile; cd - 6 | 7 | cd microservices/core/product-service; ./gradlew dependencies --configuration compile; cd - 8 | cd microservices/core/recommendation-service; ./gradlew dependencies --configuration compile; cd - 9 | cd microservices/core/review-service; ./gradlew dependencies --configuration compile; cd - 10 | cd microservices/composite/product-composite-service; ./gradlew dependencies --configuration compile; cd - 11 | 12 | cd microservices/support/auth-server; ./gradlew dependencies --configuration compile; cd - 13 | cd microservices/support/config-server; ./gradlew dependencies --configuration compile; cd - 14 | cd microservices/support/discovery-server; ./gradlew dependencies --configuration compile; cd - 15 | cd microservices/support/edge-server; ./gradlew dependencies --configuration compile; cd - 16 | cd microservices/support/monitor-dashboard; ./gradlew dependencies --configuration compile; cd - 17 | cd microservices/support/turbine; ./gradlew dependencies --configuration compile; cd - 18 | cd microservices/support/zipkin-server; ./gradlew dependencies --configuration compile; cd - 19 | 20 | -------------------------------------------------------------------------------- /microservices/support/auth-server/src/main/java/se/callista/microservises/support/oauth/AuthserverApplication.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservises.support.oauth; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; 8 | import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | import javax.net.ssl.HttpsURLConnection; 13 | import java.security.Principal; 14 | 15 | @RestController 16 | @EnableResourceServer 17 | @EnableAuthorizationServer 18 | @SpringBootApplication 19 | public class AuthserverApplication { 20 | 21 | private static final Logger LOG = LoggerFactory.getLogger(AuthserverApplication.class); 22 | 23 | @RequestMapping("/user") 24 | public Principal user(Principal user) { 25 | return user; 26 | } 27 | 28 | static { 29 | // for localhost testing only 30 | LOG.warn("Will now disable hostname check in SSL, only to be used during development"); 31 | HttpsURLConnection.setDefaultHostnameVerifier((hostname, sslSession) -> true); 32 | } 33 | 34 | public static void main(String[] args) { 35 | SpringApplication.run(AuthserverApplication.class, args); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /microservices/support/zipkin-server/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '1.3.7.RELEASE' 4 | springCloudVersion = 'Brixton.SR5' 5 | } 6 | repositories { 7 | mavenCentral() 8 | } 9 | dependencies { 10 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 11 | } 12 | } 13 | 14 | apply plugin: 'java' 15 | apply plugin: 'eclipse' 16 | apply plugin: 'spring-boot' 17 | 18 | jar { 19 | baseName = 'zipkin-server' 20 | version = '1.0.0-SNAPSHOT' 21 | } 22 | sourceCompatibility = 1.8 23 | targetCompatibility = 1.8 24 | 25 | repositories { 26 | mavenCentral() 27 | } 28 | 29 | 30 | dependencies { 31 | compile('org.springframework.boot:spring-boot-starter') 32 | compile "org.springframework.cloud:spring-cloud-sleuth-zipkin-stream" 33 | compile "org.springframework.cloud:spring-cloud-starter-sleuth" 34 | compile "org.springframework.cloud:spring-cloud-stream-binder-rabbit" 35 | runtime('io.zipkin.java:zipkin-autoconfigure-ui') 36 | testCompile('org.springframework.boot:spring-boot-starter-test') 37 | } 38 | 39 | dependencyManagement { 40 | imports { 41 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 42 | } 43 | } 44 | 45 | eclipse { 46 | classpath { 47 | containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 48 | containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' 49 | } 50 | } 51 | 52 | task wrapper(type: Wrapper) { 53 | gradleVersion = '2.9' 54 | } 55 | -------------------------------------------------------------------------------- /microservices/core/product-service/src/main/java/se/callista/microservices/core/product/ProductServiceApplication.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.core.product; 2 | 3 | import com.netflix.discovery.DiscoveryManager; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.boot.SpringApplication; 7 | import org.springframework.boot.autoconfigure.SpringBootApplication; 8 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 9 | import org.springframework.context.ConfigurableApplicationContext; 10 | import org.springframework.context.annotation.ComponentScan; 11 | 12 | import javax.net.ssl.HttpsURLConnection; 13 | 14 | @SpringBootApplication 15 | @EnableDiscoveryClient 16 | @ComponentScan({"se.callista.microservices.core.product", "se.callista.microservices.util"}) 17 | public class ProductServiceApplication { 18 | 19 | private static final Logger LOG = LoggerFactory.getLogger(ProductServiceApplication.class); 20 | 21 | static { 22 | // for localhost testing only 23 | LOG.warn("Will now disable hostname check in SSL, only to be used during development"); 24 | HttpsURLConnection.setDefaultHostnameVerifier((hostname, sslSession) -> true); 25 | } 26 | 27 | public static void main(String[] args) { 28 | 29 | ConfigurableApplicationContext ctx = SpringApplication.run(ProductServiceApplication.class, args); 30 | 31 | LOG.info("Connected to RabbitMQ at: {}", ctx.getEnvironment().getProperty("spring.rabbitmq.host")); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /microservices/core/recommendation-service/src/main/java/se/callista/microservices/core/recommendation/RecommendationServiceApplication.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.core.recommendation; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 8 | import org.springframework.context.ConfigurableApplicationContext; 9 | import org.springframework.context.annotation.ComponentScan; 10 | 11 | import javax.net.ssl.HttpsURLConnection; 12 | 13 | @SpringBootApplication 14 | @EnableDiscoveryClient 15 | @ComponentScan({"se.callista.microservices.core.recommendation", "se.callista.microservices.util"}) 16 | public class RecommendationServiceApplication { 17 | 18 | private static final Logger LOG = LoggerFactory.getLogger(RecommendationServiceApplication.class); 19 | 20 | static { 21 | // for localhost testing only 22 | LOG.warn("Will now disable hostname check in SSL, only to be used during development"); 23 | HttpsURLConnection.setDefaultHostnameVerifier((hostname, sslSession) -> true); 24 | } 25 | 26 | public static void main(String[] args) { 27 | 28 | ConfigurableApplicationContext ctx = SpringApplication.run(RecommendationServiceApplication.class, args); 29 | 30 | LOG.info("Connected to RabbitMQ at: {}", ctx.getEnvironment().getProperty("spring.rabbitmq.host")); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /elk-config/logstash.config: -------------------------------------------------------------------------------- 1 | input { 2 | 3 | http { 4 | port => 8080 5 | type => "healthcheck" 6 | } 7 | 8 | syslog { 9 | type => syslog 10 | port => 25826 11 | 12 | codec => multiline { 13 | pattern => "^<%{POSINT}>%{SYSLOGTIMESTAMP} %{SYSLOGHOST}\[%{POSINT}\]: %{TIMESTAMP_ISO8601}" 14 | negate => true 15 | what => previous 16 | } 17 | } 18 | 19 | } 20 | 21 | filter { 22 | 23 | if [type] == "healthcheck" { 24 | drop {} 25 | } 26 | 27 | mutate { 28 | strip => "message" 29 | } 30 | 31 | grok { 32 | match => { 33 | "message" => "<%{POSINT:syslog_pri}>%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname}\[%{POSINT:syslog_pid}\]: %{TIMESTAMP_ISO8601:ml_date}(%{SPACE})? %{LOGLEVEL:ml_level} \[%{DATA:ml_service},%{DATA:ml_traceId},%{DATA:ml_spanId},%{DATA:ml_zipkin}\] %{INT} --- \[%{DATA:ml_thread}\] %{DATA:ml_classname} : %{GREEDYDATA:ml_message}" 34 | } 35 | } 36 | 37 | if "multiline" in [tags] { 38 | mutate { 39 | gsub => [ "message", "<\d+>.*?:\s", ""] 40 | } 41 | } 42 | 43 | mutate { 44 | strip => "ml_thread" 45 | remove_field => [ "level", "version", "command", "created", "message", "tag", "image_id", "severity", "priority", "facility", "severity_label", "facility_label", "syslog_pri"] 46 | } 47 | 48 | } 49 | 50 | output { 51 | elasticsearch { 52 | hosts => "elasticsearch" 53 | ssl => "false" 54 | user => "logstash_system" 55 | password => "changeme" 56 | } 57 | stdout { 58 | codec => rubydebug 59 | } 60 | } -------------------------------------------------------------------------------- /util/src/main/java/se/callista/microservices/util/SetProcTimeBean.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.util; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.cloud.context.config.annotation.RefreshScope; 8 | import org.springframework.stereotype.Component; 9 | 10 | @RefreshScope 11 | @Component 12 | public class SetProcTimeBean { 13 | 14 | private static final Logger LOG = LoggerFactory.getLogger(SetProcTimeBean.class); 15 | 16 | private int minMs; 17 | private int maxMs; 18 | 19 | @Autowired 20 | public SetProcTimeBean( 21 | @Value("${service.defaultMinMs:0}") int minMs, 22 | @Value("${service.defaultMaxMs:0}") int maxMs) { 23 | 24 | setDefaultProcessingTime(minMs, maxMs); 25 | } 26 | 27 | public void setDefaultProcessingTime(int minMs, int maxMs) { 28 | 29 | if (minMs < 0) { 30 | minMs = 0; 31 | } 32 | if (maxMs < minMs) { 33 | maxMs = minMs; 34 | } 35 | 36 | this.minMs = minMs; 37 | this.maxMs = maxMs; 38 | LOG.info("Set response time to {} - {} ms.", this.minMs, this.maxMs); 39 | } 40 | 41 | public int calculateProcessingTime() { 42 | int processingTimeMs = minMs + (int) (Math.random() * (maxMs - minMs)); 43 | LOG.debug("Return calculated processing time: {} ms", processingTimeMs); 44 | return processingTimeMs; 45 | } 46 | } -------------------------------------------------------------------------------- /microservices/support/config-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8888 3 | ssl: 4 | key-store: classpath:server.jks 5 | key-store-password: password 6 | key-password: password 7 | 8 | security.basic.enabled: false 9 | 10 | # Configuration of a local Git-repo for development locally without Docker 11 | # note that we are still using git; We just access the git-repo via file: protocol 12 | spring.cloud.config.server.git.uri: file:///${PWD}/../../../../blog-microservices-config/ 13 | 14 | eureka.client.serviceUrl.defaultZone: http://localhost:8761/eureka/ 15 | 16 | spring.rabbitmq: 17 | host: localhost 18 | port: 5672 19 | 20 | logging: 21 | level: 22 | root: WARN 23 | se.callista: INFO 24 | 25 | org.springframework.amqp.rabbit.listener.BlockingQueueConsumer: INFO 26 | org.apache.catalina.session.ManagerBase: INFO 27 | 28 | # Set INFO to see the allocated port 29 | org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer: INFO 30 | org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainer: INFO 31 | 32 | 33 | --- 34 | # For deployment in Docker containers 35 | spring: 36 | profiles: docker 37 | 38 | security.basic.enabled: true 39 | 40 | spring.rabbitmq.host: rabbitmq 41 | 42 | # when running docker locally on a dev pc the config-repo is mounted to a local git-repo in docker-compose file 43 | spring.cloud.config.server.git.uri: /config-repo 44 | 45 | eureka: 46 | instance: 47 | preferIpAddress: true 48 | client: 49 | serviceUrl: 50 | defaultZone: http://discovery:8761/eureka/ 51 | 52 | -------------------------------------------------------------------------------- /util/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '1.3.7.RELEASE' 4 | springCloudNetflixVersion = '1.1.4.RELEASE' 5 | springVersion = '4.0.4.RELEASE' 6 | } 7 | } 8 | 9 | apply plugin: 'java' 10 | apply plugin: 'eclipse' 11 | apply plugin: 'idea' 12 | apply plugin: 'maven-publish' 13 | 14 | jar { 15 | baseName = 'util' 16 | version = '0.0.1-SNAPSHOT' 17 | } 18 | 19 | // $ gradle publishToMavenLocal 20 | publishing { 21 | publications { 22 | mavenJava(MavenPublication) { 23 | // TODO: Where to place these properties? 24 | groupId 'se.callista.microservises' 25 | artifactId 'util' 26 | version '0.0.1-SNAPSHOT' 27 | 28 | from components.java 29 | } 30 | } 31 | } 32 | 33 | sourceCompatibility = 1.8 34 | targetCompatibility = 1.8 35 | 36 | repositories { 37 | mavenCentral() 38 | maven { url "https://repo.spring.io/milestone" } 39 | } 40 | 41 | dependencies { 42 | compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}") 43 | compile("org.springframework.cloud:spring-cloud-starter-hystrix:${springCloudNetflixVersion}") 44 | 45 | // TODO: Should be changed to provided to minimize class load conflicts over time??? 46 | compile("org.springframework.security:spring-security-core:${springVersion}") 47 | 48 | compile("net.logstash.logback:logstash-logback-encoder:4.3") 49 | 50 | testCompile("org.springframework.boot:spring-boot-starter-test:${springBootVersion}") 51 | } 52 | 53 | task wrapper(type: Wrapper) { 54 | gradleVersion = '2.9' 55 | } -------------------------------------------------------------------------------- /microservices/support/turbine/src/main/java/se/callista/microservises/support/turbine/TurbineApplication.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservises.support.turbine; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; 6 | import org.springframework.amqp.rabbit.connection.ConnectionFactory; 7 | import org.springframework.beans.factory.annotation.Value; 8 | import org.springframework.boot.autoconfigure.SpringBootApplication; 9 | import org.springframework.boot.builder.SpringApplicationBuilder; 10 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 11 | import org.springframework.cloud.netflix.turbine.stream.EnableTurbineStream; 12 | import org.springframework.context.ConfigurableApplicationContext; 13 | import org.springframework.context.annotation.Bean; 14 | 15 | import javax.net.ssl.HttpsURLConnection; 16 | 17 | @SpringBootApplication 18 | @EnableTurbineStream 19 | @EnableDiscoveryClient 20 | public class TurbineApplication { 21 | 22 | private static final Logger LOG = LoggerFactory.getLogger(TurbineApplication.class); 23 | 24 | static { 25 | // for localhost testing only 26 | LOG.warn("Will now disable hostname check in SSL, only to be used during development"); 27 | HttpsURLConnection.setDefaultHostnameVerifier((hostname, sslSession) -> true); 28 | } 29 | 30 | public static void main(String[] args) { 31 | 32 | ConfigurableApplicationContext ctx = new SpringApplicationBuilder(TurbineApplication.class).run(args); 33 | 34 | LOG.info("Connected to RabbitMQ at: {}", ctx.getEnvironment().getProperty("spring.rabbitmq.host")); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /microservices/support/discovery-server/src/test/java/se/callista/microservises/support/discovery/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservises.support.discovery; 2 | 3 | import org.junit.Ignore; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.boot.test.IntegrationTest; 8 | import org.springframework.boot.test.SpringApplicationConfiguration; 9 | import org.springframework.boot.test.TestRestTemplate; 10 | import org.springframework.http.HttpStatus; 11 | import org.springframework.http.ResponseEntity; 12 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 13 | import org.springframework.test.context.web.WebAppConfiguration; 14 | 15 | import java.util.Map; 16 | 17 | import static org.junit.Assert.assertEquals; 18 | 19 | @RunWith(SpringJUnit4ClassRunner.class) 20 | @SpringApplicationConfiguration(classes = EurekaApplication.class) 21 | @WebAppConfiguration 22 | @IntegrationTest("server.port=0") 23 | @Ignore 24 | public class ApplicationTests { 25 | 26 | @Value("${local.server.port}") 27 | private int port = 0; 28 | 29 | @Test 30 | public void catalogLoads() { 31 | @SuppressWarnings("rawtypes") 32 | ResponseEntity entity = new TestRestTemplate("user", "password").getForEntity("http://localhost:" + port + "/eureka/apps", Map.class); 33 | assertEquals(HttpStatus.OK, entity.getStatusCode()); 34 | } 35 | 36 | @Test 37 | public void adminLoads() { 38 | @SuppressWarnings("rawtypes") 39 | ResponseEntity entity = new TestRestTemplate("user", "password").getForEntity("http://localhost:" + port + "/env", Map.class); 40 | assertEquals(HttpStatus.OK, entity.getStatusCode()); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /microservices/support/monitor-dashboard/src/main/java/se/callista/microservises/support/monitordashboard/HystrixDashboardApplication.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservises.support.monitordashboard; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.builder.SpringApplicationBuilder; 7 | import org.springframework.boot.context.web.SpringBootServletInitializer; 8 | import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; 9 | import org.springframework.stereotype.Controller; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | 12 | import javax.net.ssl.HttpsURLConnection; 13 | 14 | @SpringBootApplication 15 | @Controller 16 | @EnableHystrixDashboard 17 | public class HystrixDashboardApplication extends SpringBootServletInitializer { 18 | 19 | private static final Logger LOG = LoggerFactory.getLogger(HystrixDashboardApplication.class); 20 | 21 | static { 22 | // for localhost testing only 23 | LOG.warn("Will now disable hostname check in SSL, only to be used during development"); 24 | HttpsURLConnection.setDefaultHostnameVerifier((hostname, sslSession) -> true); 25 | } 26 | 27 | @RequestMapping("/") 28 | public String home() { 29 | return "forward:/hystrix"; 30 | } 31 | 32 | @Override 33 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 34 | return application.sources(HystrixDashboardApplication.class).web(true); 35 | } 36 | 37 | public static void main(String[] args) { 38 | new SpringApplicationBuilder(HystrixDashboardApplication.class).web(true).run(args); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /microservices/support/zipkin-server/src/test/java/se/callista/microservises/workshop/zipkin/ZipkinServerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservises.workshop.zipkin; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.IntegrationTest; 6 | import org.springframework.boot.test.SpringApplicationConfiguration; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | import org.springframework.test.context.web.WebAppConfiguration; 9 | 10 | /* 11 | 12 | THIS IS FOR SPRING BOOT 1.4 and SPRING CLOUD CAMDEN 13 | import org.springframework.boot.test.context.SpringBootTest; 14 | import org.springframework.test.context.junit4.SpringRunner; 15 | 16 | import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; 17 | 18 | // Instruct embedded Tomcat to run on a random free port and skip talking to the Config Server and the Bus 19 | // Regarding settings of java.security.egd, see http://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source 20 | @RunWith(SpringRunner.class) 21 | @SpringBootTest(classes=ZipkinServerApplication.class, webEnvironment=RANDOM_PORT, properties = { 22 | "spring.cloud.bus.enabled=false", 23 | "spring.cloud.config.enabled=false", 24 | "spring.sleuth.stream.enabled=false", 25 | "java.security.egd=file:/dev/./urandom", 26 | "logging.level.org.springframework.amqp.rabbit.core.RabbitAdmin=ERROR" 27 | }) 28 | */ 29 | @RunWith(SpringJUnit4ClassRunner.class) 30 | @SpringApplicationConfiguration(classes = ZipkinServerApplication.class) 31 | @WebAppConfiguration 32 | @IntegrationTest("server.port=0") 33 | public class ZipkinServerApplicationTests { 34 | 35 | @Test 36 | public void contextLoads() { 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /manifest-pcf.yml: -------------------------------------------------------------------------------- 1 | --- 2 | memory: 512M 3 | instances: 1 4 | applications: 5 | #- name: auth-server 6 | # host: ml-public-auth 7 | # path: microservices/support/auth-server/build/libs/auth-server-0.0.1-SNAPSHOT.jar 8 | #- name: discovery-server 9 | # host: ml-public-ds-1 10 | # path: microservices/support/discovery-server/build/libs/discovery-server-0.0.1-SNAPSHOT.jar 11 | - name: edge-server 12 | host: ml-public-edge 13 | path: microservices/support/edge-server/build/libs/edge-server-0.0.1-SNAPSHOT.jar 14 | #- name: monitor-dashboard 15 | # host: ml-public-md 16 | # path: microservices/support/monitor-dashboard/build/libs/monitor-dashboard-0.0.1-SNAPSHOT.jar 17 | # services: 18 | # - RabbitMQ 19 | #- name: turbine 20 | # host: ml-private-t 21 | # path: microservices/support/turbine/build/libs/turbine-0.0.1-SNAPSHOT.jar 22 | # services: 23 | # - RabbitMQ 24 | #- name: product-service 25 | # host: ml-private-pro 26 | # path: microservices/core/product-service/build/libs/product-service-0.0.1-SNAPSHOT.jar 27 | #- name: recommendation-service 28 | # host: ml-private-rec 29 | # path: microservices/core/recommendation-service/build/libs/recommendation-service-0.0.1-SNAPSHOT.jar 30 | #- name: review-service 31 | # host: ml-private-rev 32 | # path: microservices/core/review-service/build/libs/review-service-0.0.1-SNAPSHOT.jar 33 | #- name: product-composite-service 34 | # host: ml-private-comp-pro 35 | # path: microservices/composite/product-composite-service/build/libs/product-composite-service-0.0.1-SNAPSHOT.jar 36 | # services: 37 | # - RabbitMQ 38 | #- name: product-api-service 39 | # host: ml-private-api-pro 40 | # path: microservices/api/product-api-service/build/libs/product-api-service-0.0.1-SNAPSHOT.jar 41 | # services: 42 | # - RabbitMQ 43 | 44 | -------------------------------------------------------------------------------- /microservices/support/turbine/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '1.3.7.RELEASE' 4 | springCloudVersion = 'Brixton.SR5' 5 | } 6 | repositories { 7 | mavenCentral() 8 | jcenter() 9 | } 10 | dependencies { 11 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 12 | } 13 | } 14 | 15 | apply plugin: 'java' 16 | apply plugin: 'eclipse' 17 | apply plugin: 'idea' 18 | apply plugin: 'spring-boot' 19 | 20 | jar { 21 | baseName = 'turbine' 22 | version = '0.0.1-SNAPSHOT' 23 | } 24 | 25 | sourceCompatibility = 1.8 26 | targetCompatibility = 1.8 27 | 28 | repositories { 29 | mavenCentral() 30 | } 31 | 32 | dependencies { 33 | compile("org.springframework.boot:spring-boot-starter-web") { 34 | exclude module: 'spring-boot-starter-tomcat' 35 | } 36 | compile("org.springframework.boot:spring-boot-starter-undertow") 37 | compile("org.springframework.boot:spring-boot-starter-actuator") 38 | compile('org.springframework.cloud:spring-cloud-starter-turbine-amqp') 39 | compile('org.springframework.cloud:spring-cloud-starter-sleuth') 40 | compile('org.springframework.cloud:spring-cloud-sleuth-stream') 41 | } 42 | 43 | dependencyManagement { 44 | imports { 45 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 46 | } 47 | } 48 | 49 | eclipse { 50 | classpath { 51 | containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 52 | containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' 53 | } 54 | } 55 | 56 | task wrapper(type: Wrapper) { 57 | gradleVersion = '2.9' 58 | } 59 | 60 | -------------------------------------------------------------------------------- /microservices/core/review-service/src/main/java/se/callista/microservices/core/review/ReviewServiceApplication.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.core.review; 2 | 3 | import com.netflix.discovery.DiscoveryManager; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; 7 | import org.springframework.amqp.rabbit.connection.ConnectionFactory; 8 | import org.springframework.beans.factory.annotation.Value; 9 | import org.springframework.boot.SpringApplication; 10 | import org.springframework.boot.autoconfigure.SpringBootApplication; 11 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 12 | import org.springframework.context.ConfigurableApplicationContext; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.ComponentScan; 15 | 16 | import javax.net.ssl.HttpsURLConnection; 17 | 18 | @SpringBootApplication 19 | @EnableDiscoveryClient 20 | @ComponentScan({"se.callista.microservices.core.review", "se.callista.microservices.util"}) 21 | public class ReviewServiceApplication { 22 | 23 | private static final Logger LOG = LoggerFactory.getLogger(ReviewServiceApplication.class); 24 | 25 | static { 26 | // for localhost testing only 27 | LOG.warn("Will now disable hostname check in SSL, only to be used during development"); 28 | HttpsURLConnection.setDefaultHostnameVerifier((hostname, sslSession) -> true); 29 | } 30 | 31 | public static void main(String[] args) { 32 | 33 | ConfigurableApplicationContext ctx = SpringApplication.run(ReviewServiceApplication.class, args); 34 | 35 | LOG.info("Connected to RabbitMQ at: {}", ctx.getEnvironment().getProperty("spring.rabbitmq.host")); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /util/src/main/java/se/callista/microservices/model/Review.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.model; 2 | 3 | /** 4 | * Created by magnus on 04/03/15. 5 | */ 6 | public class Review { 7 | private int productId; 8 | private int reviewId; 9 | private String author; 10 | private String subject; 11 | private String content; 12 | private String serviceAddress; 13 | 14 | public Review() { 15 | } 16 | 17 | public Review(int productId, int reviewId, String author, String subject, String content, String serviceAddress) { 18 | this.productId = productId; 19 | this.reviewId = reviewId; 20 | this.author = author; 21 | this.subject = subject; 22 | this.content = content; 23 | this.serviceAddress = serviceAddress; 24 | } 25 | 26 | public int getProductId() { 27 | return productId; 28 | } 29 | 30 | public void setProductId(int productId) { 31 | this.productId = productId; 32 | } 33 | 34 | public int getReviewId() { 35 | return reviewId; 36 | } 37 | 38 | public void setReviewId(int reviewId) { 39 | this.reviewId = reviewId; 40 | } 41 | 42 | public String getAuthor() { 43 | return author; 44 | } 45 | 46 | public void setAuthor(String author) { 47 | this.author = author; 48 | } 49 | 50 | public String getSubject() { 51 | return subject; 52 | } 53 | 54 | public void setSubject(String subject) { 55 | this.subject = subject; 56 | } 57 | 58 | public String getContent() { 59 | return content; 60 | } 61 | 62 | public void setContent(String content) { 63 | this.content = content; 64 | } 65 | 66 | public String getServiceAddress() { 67 | return serviceAddress; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /microservices/support/monitor-dashboard/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '1.3.7.RELEASE' 4 | springCloudVersion = 'Brixton.SR5' 5 | } 6 | repositories { 7 | mavenCentral() 8 | jcenter() 9 | } 10 | dependencies { 11 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 12 | } 13 | } 14 | 15 | apply plugin: 'java' 16 | apply plugin: 'eclipse' 17 | apply plugin: 'idea' 18 | apply plugin: 'spring-boot' 19 | 20 | jar { 21 | baseName = 'monitor-dashboard' 22 | version = '0.0.1-SNAPSHOT' 23 | } 24 | 25 | sourceCompatibility = 1.8 26 | targetCompatibility = 1.8 27 | 28 | repositories { 29 | mavenCentral() 30 | } 31 | 32 | dependencies { 33 | compile("org.springframework.boot:spring-boot-starter-web") { 34 | exclude module: 'spring-boot-starter-tomcat' 35 | } 36 | compile("org.springframework.boot:spring-boot-starter-undertow") 37 | compile("org.springframework.boot:spring-boot-starter-actuator") 38 | 39 | compile("org.springframework.cloud:spring-cloud-starter-config") 40 | compile('org.springframework.cloud:spring-cloud-starter-bus-amqp') 41 | compile('org.springframework.cloud:spring-cloud-starter-hystrix-dashboard') 42 | compile('org.springframework.cloud:spring-cloud-starter-sleuth') 43 | } 44 | 45 | dependencyManagement { 46 | imports { 47 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 48 | } 49 | } 50 | 51 | eclipse { 52 | classpath { 53 | containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 54 | containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' 55 | } 56 | } 57 | 58 | task wrapper(type: Wrapper) { 59 | gradleVersion = '2.9' 60 | } 61 | 62 | 63 | -------------------------------------------------------------------------------- /util/src/main/java/se/callista/microservices/model/Recommendation.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.model; 2 | 3 | /** 4 | * Created by magnus on 04/03/15. 5 | */ 6 | public class Recommendation { 7 | private int productId; 8 | private int recommendationId; 9 | private String author; 10 | private int rate; 11 | private String content; 12 | private String serviceAddress; 13 | 14 | public Recommendation() { 15 | } 16 | 17 | public Recommendation(int productId, int recommendationId, String author, int rate, String content, String serviceAddress) { 18 | this.productId = productId; 19 | this.recommendationId = recommendationId; 20 | this.author = author; 21 | this.rate = rate; 22 | this.content = content; 23 | this.serviceAddress = serviceAddress; 24 | } 25 | 26 | public int getProductId() { 27 | return productId; 28 | } 29 | 30 | public void setProductId(int productId) { 31 | this.productId = productId; 32 | } 33 | 34 | public int getRecommendationId() { 35 | return recommendationId; 36 | } 37 | 38 | public void setRecommendationId(int recommendationId) { 39 | this.recommendationId = recommendationId; 40 | } 41 | 42 | public String getAuthor() { 43 | return author; 44 | } 45 | 46 | public void setAuthor(String author) { 47 | this.author = author; 48 | } 49 | 50 | public int getRate() { 51 | return rate; 52 | } 53 | 54 | public void setRate(int rate) { 55 | this.rate = rate; 56 | } 57 | 58 | public String getContent() { 59 | return content; 60 | } 61 | 62 | public void setContent(String content) { 63 | this.content = content; 64 | } 65 | 66 | public String getServiceAddress() { 67 | return serviceAddress; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /microservices/support/edge-server/src/main/java/se/callista/microservises/support/edge/ZuulApplication.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservises.support.edge; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.builder.SpringApplicationBuilder; 7 | import org.springframework.cloud.netflix.zuul.EnableZuulProxy; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.web.filter.CommonsRequestLoggingFilter; 12 | 13 | import javax.net.ssl.HttpsURLConnection; 14 | import javax.servlet.Filter; 15 | 16 | @SpringBootApplication 17 | @Controller 18 | @EnableZuulProxy 19 | @EnableResourceServer 20 | public class ZuulApplication { 21 | 22 | private static final Logger LOG = LoggerFactory.getLogger(ZuulApplication.class); 23 | 24 | static { 25 | // for localhost testing only 26 | LOG.warn("Will now disable hostname check in SSL, only to be used during development"); 27 | HttpsURLConnection.setDefaultHostnameVerifier((hostname, sslSession) -> true); 28 | } 29 | 30 | @Bean 31 | public Filter logFilter() { 32 | // TODO: Extract bean-def to Util-component! 33 | CommonsRequestLoggingFilter filter = new CommonsRequestLoggingFilter(); 34 | filter.setIncludeQueryString(true); 35 | filter.setIncludePayload(true); 36 | filter.setMaxPayloadLength(5120); 37 | return filter; 38 | } 39 | 40 | public static void main(String[] args) { 41 | int buildNo = 15; 42 | LOG.info("Edge-server, starting build no. {}...", buildNo); 43 | 44 | new SpringApplicationBuilder(ZuulApplication.class).web(true).run(args); 45 | 46 | LOG.info("Edge-server, build no. {} started", buildNo); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /microservices/support/config-server/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '1.3.7.RELEASE' 4 | springCloudVersion = 'Brixton.SR5' 5 | } 6 | repositories { 7 | mavenCentral() 8 | } 9 | dependencies { 10 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 11 | } 12 | } 13 | 14 | apply plugin: 'java' 15 | apply plugin: 'eclipse' 16 | apply plugin: 'idea' 17 | apply plugin: 'spring-boot' 18 | 19 | jar { 20 | baseName = 'config-server' 21 | version = '0.0.1-SNAPSHOT' 22 | } 23 | sourceCompatibility = 1.8 24 | targetCompatibility = 1.8 25 | 26 | repositories { 27 | mavenCentral() 28 | } 29 | 30 | dependencies { 31 | compile("org.springframework.boot:spring-boot-starter-web") { 32 | exclude module: 'spring-boot-starter-tomcat' 33 | } 34 | compile("org.springframework.boot:spring-boot-starter-undertow") 35 | compile('org.springframework.boot:spring-boot-starter-actuator') 36 | compile('org.springframework.boot:spring-boot-starter-security') 37 | compile('org.springframework.cloud:spring-cloud-starter-bus-amqp') 38 | compile('org.springframework.cloud:spring-cloud-config-server') 39 | compile('org.springframework.cloud:spring-cloud-config-monitor') 40 | compile("org.springframework.cloud:spring-cloud-starter-eureka") 41 | compile('org.springframework.cloud:spring-cloud-starter-sleuth') 42 | compile('org.springframework.cloud:spring-cloud-sleuth-stream') 43 | 44 | testCompile('org.springframework.boot:spring-boot-starter-test') 45 | } 46 | 47 | dependencyManagement { 48 | imports { 49 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 50 | } 51 | } 52 | 53 | eclipse { 54 | classpath { 55 | containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 56 | containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' 57 | } 58 | } 59 | 60 | task wrapper(type: Wrapper) { 61 | gradleVersion = '2.9' 62 | } 63 | -------------------------------------------------------------------------------- /microservices/composite/product-composite-service/src/main/java/se/callista/microservices/composite/product/ProductCompositeServiceApplication.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.composite.product; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; 8 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 9 | import org.springframework.cloud.client.loadbalancer.LoadBalanced; 10 | import org.springframework.context.ConfigurableApplicationContext; 11 | import org.springframework.context.annotation.Bean; 12 | import org.springframework.context.annotation.ComponentScan; 13 | import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; 14 | import org.springframework.web.client.RestTemplate; 15 | 16 | import javax.net.ssl.HttpsURLConnection; 17 | 18 | @SpringBootApplication 19 | @EnableCircuitBreaker 20 | @EnableDiscoveryClient 21 | @EnableResourceServer 22 | @ComponentScan({"se.callista.microservices.composite.product", "se.callista.microservices.util"}) 23 | public class ProductCompositeServiceApplication { 24 | 25 | private static final Logger LOG = LoggerFactory.getLogger(ProductCompositeServiceApplication.class); 26 | 27 | static { 28 | // for localhost testing only 29 | LOG.warn("Will now disable hostname check in SSL, only to be used during development"); 30 | HttpsURLConnection.setDefaultHostnameVerifier((hostname, sslSession) -> true); 31 | } 32 | 33 | @Bean 34 | @LoadBalanced 35 | RestTemplate restTemplate() { 36 | return new RestTemplate(); 37 | } 38 | 39 | public static void main(String[] args) { 40 | 41 | ConfigurableApplicationContext ctx = SpringApplication.run(ProductCompositeServiceApplication.class, args); 42 | 43 | LOG.info("Connected to RabbitMQ at: {}", ctx.getEnvironment().getProperty("spring.rabbitmq.host")); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /microservices/support/discovery-server/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '1.3.7.RELEASE' 4 | springCloudVersion = 'Brixton.SR5' 5 | } 6 | repositories { 7 | mavenCentral() 8 | jcenter() 9 | } 10 | dependencies { 11 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 12 | } 13 | } 14 | 15 | apply plugin: 'java' 16 | apply plugin: 'eclipse' 17 | apply plugin: 'idea' 18 | apply plugin: 'spring-boot' 19 | 20 | // TODO: Is this still required? 21 | springBoot { 22 | requiresUnpack = ['com.netflix.eureka:eureka-core','com.netflix.eureka:eureka-client'] 23 | } 24 | 25 | jar { 26 | baseName = 'discovery-server' 27 | version = '0.0.1-SNAPSHOT' 28 | } 29 | 30 | sourceCompatibility = 1.8 31 | targetCompatibility = 1.8 32 | 33 | repositories { 34 | mavenCentral() 35 | } 36 | 37 | dependencies { 38 | 39 | compile("org.springframework.boot:spring-boot-starter-web") { 40 | exclude module: 'spring-boot-starter-tomcat' 41 | } 42 | compile("org.springframework.boot:spring-boot-starter-undertow") 43 | compile("org.springframework.boot:spring-boot-starter-actuator") 44 | compile('org.springframework.cloud:spring-cloud-starter-eureka-server') { 45 | // TODO: Is this still required? 46 | exclude(module: 'servlet-api') // Drags in an old 2.5 spec... 47 | } 48 | compile('org.springframework.cloud:spring-cloud-starter-sleuth') 49 | 50 | // compile('org.springframework.boot:spring-boot-starter-security') 51 | 52 | testCompile('org.springframework.boot:spring-boot-starter-test') 53 | } 54 | 55 | dependencyManagement { 56 | imports { 57 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 58 | } 59 | } 60 | 61 | eclipse { 62 | classpath { 63 | containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 64 | containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' 65 | } 66 | } 67 | 68 | task wrapper(type: Wrapper) { 69 | gradleVersion = '2.9' 70 | } -------------------------------------------------------------------------------- /microservices/support/turbine/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8989 3 | 4 | management: 5 | port: 8990 6 | 7 | info: 8 | component: Turbine 9 | 10 | PREFIX: 11 | 12 | endpoints: 13 | restart: 14 | enabled: true 15 | shutdown: 16 | enabled: true 17 | 18 | logging: 19 | level: 20 | root: WARN 21 | com.netflix.discovery: 'OFF' 22 | 23 | # Get info regarding connection to the cofig server and retries if required 24 | org.springframework.cloud.config.client.ConfigServicePropertySourceLocator: INFO 25 | org.springframework.retry.support.RetryTemplate: DEBUG 26 | 27 | # org.springframework.integration: DEBUG 28 | 29 | # Set INFO to see the allocated port 30 | org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer: INFO 31 | org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainer: INFO 32 | 33 | spring.rabbitmq: 34 | host: localhost 35 | port: 5672 36 | 37 | eureka: 38 | instance: 39 | leaseRenewalIntervalInSeconds: 10 40 | client: 41 | serviceUrl: 42 | defaultZone: ${vcap.services.${PREFIX:}eureka.credentials.uri:http://user:password@localhost:8761}/eureka/ 43 | 44 | #turbine: 45 | # appConfig: customers,stores,productapi 46 | # clusterNameExpression: 'default' 47 | 48 | #turbine: 49 | # aggregator: 50 | # clusterConfig: CUSTOMERS 51 | # appConfig: customers 52 | 53 | --- 54 | # For deployment in Docker containers 55 | spring: 56 | profiles: docker 57 | 58 | spring.rabbitmq.host: rabbitmq 59 | 60 | eureka: 61 | instance: 62 | hostname: turbine 63 | client: 64 | serviceUrl: 65 | defaultZone: http://discovery:8761/eureka/ 66 | 67 | --- 68 | # For deployment in Cloud Foundry 69 | spring: 70 | profiles: cloud 71 | 72 | server: 73 | port: 0 # Avoid collisions in the unknown CF djungle... 74 | 75 | management: 76 | port: 0 # Avoid collisions in the unknown CF djungle... 77 | 78 | turbine: 79 | amqp: 80 | port: 0 # Avoid collisions in the unknown CF djungle... 81 | 82 | eureka: 83 | instance: 84 | hostname: ${vcap.application.uris[0]:localhost} 85 | nonSecurePort: 80 86 | client: 87 | serviceUrl: 88 | defaultZone: http://ml-public-ds-1.cfapps.io/eureka/ 89 | -------------------------------------------------------------------------------- /microservices/core/review-service/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '1.3.7.RELEASE' 4 | springCloudVersion = 'Brixton.SR5' 5 | } 6 | repositories { 7 | mavenCentral() 8 | jcenter() 9 | } 10 | dependencies { 11 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 12 | } 13 | } 14 | 15 | plugins { 16 | id "com.jfrog.bintray" version "0.4.1" 17 | } 18 | 19 | apply plugin: 'java' 20 | apply plugin: 'eclipse' 21 | apply plugin: 'idea' 22 | apply plugin: 'spring-boot' 23 | 24 | jar { 25 | baseName = 'review-service' 26 | version = '0.0.1-SNAPSHOT' 27 | } 28 | 29 | sourceCompatibility = 1.8 30 | targetCompatibility = 1.8 31 | 32 | repositories { 33 | mavenLocal() 34 | jcenter() 35 | mavenCentral() 36 | } 37 | 38 | dependencies { 39 | compile("org.springframework.boot:spring-boot-starter-web") 40 | { 41 | exclude module: 'spring-boot-starter-tomcat' 42 | } 43 | compile("org.springframework.boot:spring-boot-starter-undertow") 44 | compile("org.springframework.boot:spring-boot-starter-actuator") 45 | 46 | compile("org.springframework.cloud:spring-cloud-starter-eureka") 47 | compile("org.springframework.cloud:spring-cloud-starter-config") 48 | compile("org.springframework.cloud:spring-cloud-starter-bus-amqp") 49 | compile("org.springframework.cloud:spring-cloud-starter-hystrix") 50 | compile('org.springframework.cloud:spring-cloud-starter-sleuth') 51 | compile('org.springframework.cloud:spring-cloud-sleuth-stream') 52 | 53 | compile("se.callista.microservises:util:0.0.1-SNAPSHOT") 54 | 55 | testCompile("org.springframework.boot:spring-boot-starter-test") 56 | } 57 | 58 | dependencyManagement { 59 | imports { 60 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 61 | } 62 | } 63 | 64 | eclipse { 65 | classpath { 66 | containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 67 | containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' 68 | } 69 | } 70 | 71 | task wrapper(type: Wrapper) { 72 | gradleVersion = '2.9' 73 | } 74 | -------------------------------------------------------------------------------- /microservices/core/product-service/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '1.3.7.RELEASE' 4 | springCloudVersion = 'Brixton.SR5' 5 | } 6 | repositories { 7 | mavenCentral() 8 | jcenter() 9 | } 10 | dependencies { 11 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 12 | } 13 | } 14 | 15 | plugins { 16 | id "com.jfrog.bintray" version "0.4.1" 17 | } 18 | 19 | apply plugin: 'java' 20 | apply plugin: 'eclipse' 21 | apply plugin: 'idea' 22 | apply plugin: 'spring-boot' 23 | 24 | jar { 25 | baseName = 'product-service' 26 | version = '0.0.1-SNAPSHOT' 27 | } 28 | 29 | sourceCompatibility = 1.8 30 | targetCompatibility = 1.8 31 | 32 | repositories { 33 | mavenLocal() 34 | jcenter() 35 | mavenCentral() 36 | } 37 | 38 | 39 | dependencies { 40 | compile("org.springframework.boot:spring-boot-starter-web") 41 | { 42 | exclude module: 'spring-boot-starter-tomcat' 43 | } 44 | compile("org.springframework.boot:spring-boot-starter-undertow") 45 | compile("org.springframework.boot:spring-boot-starter-actuator") 46 | 47 | compile("org.springframework.cloud:spring-cloud-starter-eureka") 48 | compile("org.springframework.cloud:spring-cloud-starter-hystrix") 49 | compile("org.springframework.cloud:spring-cloud-starter-config") 50 | compile("org.springframework.cloud:spring-cloud-starter-bus-amqp") 51 | compile('org.springframework.cloud:spring-cloud-starter-sleuth') 52 | compile('org.springframework.cloud:spring-cloud-sleuth-stream') 53 | 54 | compile("se.callista.microservises:util:0.0.1-SNAPSHOT") 55 | 56 | testCompile("org.springframework.boot:spring-boot-starter-test") 57 | } 58 | 59 | dependencyManagement { 60 | imports { 61 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 62 | } 63 | } 64 | 65 | eclipse { 66 | classpath { 67 | containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 68 | containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' 69 | } 70 | } 71 | 72 | task wrapper(type: Wrapper) { 73 | gradleVersion = '2.9' 74 | } 75 | -------------------------------------------------------------------------------- /microservices/core/recommendation-service/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '1.3.7.RELEASE' 4 | springCloudVersion = 'Brixton.SR5' 5 | } 6 | repositories { 7 | mavenCentral() 8 | jcenter() 9 | } 10 | dependencies { 11 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 12 | } 13 | } 14 | 15 | plugins { 16 | id "com.jfrog.bintray" version "0.4.1" 17 | } 18 | 19 | apply plugin: 'java' 20 | apply plugin: 'eclipse' 21 | apply plugin: 'idea' 22 | apply plugin: 'spring-boot' 23 | 24 | jar { 25 | baseName = 'recommendation-service' 26 | version = '0.0.1-SNAPSHOT' 27 | } 28 | 29 | sourceCompatibility = 1.8 30 | targetCompatibility = 1.8 31 | 32 | repositories { 33 | mavenLocal() 34 | jcenter() 35 | mavenCentral() 36 | } 37 | 38 | dependencies { 39 | compile("org.springframework.boot:spring-boot-starter-web") { 40 | exclude module: 'spring-boot-starter-tomcat' 41 | } 42 | compile("org.springframework.boot:spring-boot-starter-undertow") 43 | compile("org.springframework.boot:spring-boot-starter-actuator") 44 | 45 | compile("org.springframework.cloud:spring-cloud-starter-eureka") 46 | compile("org.springframework.cloud:spring-cloud-starter-hystrix") 47 | compile("org.springframework.cloud:spring-cloud-starter-config") 48 | compile("org.springframework.cloud:spring-cloud-starter-bus-amqp") 49 | compile('org.springframework.cloud:spring-cloud-starter-sleuth') 50 | compile('org.springframework.cloud:spring-cloud-sleuth-stream') 51 | 52 | compile("se.callista.microservises:util:0.0.1-SNAPSHOT") 53 | 54 | testCompile("org.springframework.boot:spring-boot-starter-test") 55 | } 56 | 57 | dependencyManagement { 58 | imports { 59 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 60 | } 61 | } 62 | 63 | eclipse { 64 | classpath { 65 | containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 66 | containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' 67 | } 68 | } 69 | 70 | task wrapper(type: Wrapper) { 71 | gradleVersion = '2.9' 72 | } 73 | -------------------------------------------------------------------------------- /microservices/support/auth-server/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '1.3.7.RELEASE' 4 | springCloudVersion = 'Brixton.SR5' 5 | } 6 | repositories { 7 | mavenCentral() 8 | jcenter() 9 | } 10 | dependencies { 11 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 12 | } 13 | } 14 | 15 | apply plugin: 'java' 16 | apply plugin: 'eclipse' 17 | apply plugin: 'idea' 18 | apply plugin: 'spring-boot' 19 | 20 | jar { 21 | baseName = 'auth-server' 22 | version = '0.0.1-SNAPSHOT' 23 | } 24 | 25 | sourceCompatibility = 1.8 26 | targetCompatibility = 1.8 27 | 28 | repositories { 29 | mavenCentral() 30 | } 31 | 32 | dependencies { 33 | compile('org.springframework.boot:spring-boot-starter-web') { 34 | exclude module: 'spring-boot-starter-tomcat' 35 | } 36 | compile("org.springframework.boot:spring-boot-starter-undertow") 37 | compile("org.springframework.boot:spring-boot-starter-actuator") 38 | compile("org.springframework.cloud:spring-cloud-starter-config") 39 | compile('org.springframework.cloud:spring-cloud-starter-bus-amqp') 40 | compile("org.springframework.cloud:spring-cloud-starter-oauth2") 41 | compile("org.springframework.cloud:spring-cloud-starter-security") 42 | compile('org.springframework.cloud:spring-cloud-starter-sleuth') 43 | compile('org.springframework.cloud:spring-cloud-sleuth-stream') 44 | 45 | testCompile("org.springframework.boot:spring-boot-starter-test") { 46 | // TODO: Is this still required? 47 | exclude(module: 'commons-logging') 48 | } 49 | // TODO: Is this still required? 50 | testCompile('org.apache.httpcomponents:httpclient:4.3.6') { 51 | exclude(module: 'commons-logging') 52 | } 53 | } 54 | 55 | dependencyManagement { 56 | imports { 57 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 58 | } 59 | } 60 | 61 | eclipse { 62 | classpath { 63 | containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 64 | containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' 65 | } 66 | } 67 | 68 | task wrapper(type: Wrapper) { 69 | gradleVersion = '2.9' 70 | } 71 | -------------------------------------------------------------------------------- /microservices/support/edge-server/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '1.3.7.RELEASE' 4 | springCloudVersion = 'Brixton.SR5' 5 | } 6 | repositories { 7 | mavenCentral() 8 | jcenter() 9 | } 10 | dependencies { 11 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 12 | } 13 | } 14 | 15 | apply plugin: 'java' 16 | apply plugin: 'eclipse' 17 | apply plugin: 'idea' 18 | apply plugin: 'spring-boot' 19 | 20 | jar { 21 | baseName = 'edge-server' 22 | version = '0.0.1-SNAPSHOT' 23 | } 24 | 25 | sourceCompatibility = 1.8 26 | targetCompatibility = 1.8 27 | 28 | repositories { 29 | mavenLocal() 30 | mavenCentral() 31 | } 32 | 33 | dependencies { 34 | compile("org.springframework.boot:spring-boot-starter-web") 35 | { 36 | exclude module: 'spring-boot-starter-tomcat' 37 | } 38 | compile("org.springframework.boot:spring-boot-starter-undertow") 39 | compile("org.springframework.boot:spring-boot-starter-actuator") 40 | compile("org.springframework.boot:spring-boot-starter-security") 41 | 42 | compile("org.springframework.cloud:spring-cloud-starter-config") 43 | compile('org.springframework.cloud:spring-cloud-starter-bus-amqp') 44 | compile('org.springframework.cloud:spring-cloud-starter-zuul') 45 | compile('org.springframework.cloud:spring-cloud-starter-eureka') 46 | compile('org.springframework.cloud:spring-cloud-starter-sleuth') 47 | compile('org.springframework.cloud:spring-cloud-sleuth-stream') 48 | 49 | compile("org.springframework.cloud:spring-cloud-starter-oauth2") 50 | compile("org.springframework.cloud:spring-cloud-starter-security") 51 | 52 | compile("se.callista.microservises:util:0.0.1-SNAPSHOT") 53 | 54 | testCompile('org.springframework.boot:spring-boot-starter-test') 55 | } 56 | 57 | dependencyManagement { 58 | imports { 59 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 60 | } 61 | } 62 | 63 | eclipse { 64 | classpath { 65 | containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 66 | containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' 67 | } 68 | } 69 | 70 | task wrapper(type: Wrapper) { 71 | gradleVersion = '2.9' 72 | } 73 | -------------------------------------------------------------------------------- /microservices/support/auth-server/src/test/java/se/callista/microservises/support/oauth/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservises.support.oauth; 2 | 3 | import org.junit.Ignore; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.boot.test.IntegrationTest; 8 | import org.springframework.boot.test.SpringApplicationConfiguration; 9 | import org.springframework.boot.test.TestRestTemplate; 10 | import org.springframework.http.HttpStatus; 11 | import org.springframework.http.ResponseEntity; 12 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 13 | import org.springframework.test.context.web.WebAppConfiguration; 14 | import org.springframework.web.client.RestTemplate; 15 | 16 | import static org.junit.Assert.assertEquals; 17 | import static org.junit.Assert.assertTrue; 18 | 19 | @RunWith(SpringJUnit4ClassRunner.class) 20 | @SpringApplicationConfiguration(classes = AuthserverApplication.class) 21 | @WebAppConfiguration 22 | @IntegrationTest("server.port:0") 23 | public class ApplicationTests { 24 | 25 | @Value("${local.server.port}") 26 | private int port; 27 | 28 | private RestTemplate template = new TestRestTemplate(); 29 | 30 | @Ignore 31 | @Test 32 | public void homePageProtected() { 33 | ResponseEntity response = template.getForEntity("http://localhost:" 34 | + port + "/uaa/", String.class); 35 | assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode()); 36 | String auth = response.getHeaders().getFirst("WWW-Authenticate"); 37 | assertTrue("Wrong header: " + auth, auth.startsWith("Bearer realm=\"")); 38 | } 39 | 40 | @Ignore 41 | @Test 42 | public void userEndpointProtected() { 43 | ResponseEntity response = template.getForEntity("http://localhost:" 44 | + port + "/uaa/user", String.class); 45 | assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode()); 46 | String auth = response.getHeaders().getFirst("WWW-Authenticate"); 47 | assertTrue("Wrong header: " + auth, auth.startsWith("Bearer realm=\"")); 48 | } 49 | 50 | @Ignore 51 | @Test 52 | public void authorizationRedirects() { 53 | ResponseEntity response = template.getForEntity("http://localhost:" 54 | + port + "/uaa/oauth/authorize", String.class); 55 | assertEquals(HttpStatus.UNAUTHORIZED, response.getStatusCode()); 56 | String auth = response.getHeaders().getFirst("WWW-Authenticate"); 57 | assertTrue("Wrong header: " + auth, auth.startsWith("Basic realm=\"")); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /microservices/composite/product-composite-service/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | springBootVersion = '1.3.7.RELEASE' 4 | springCloudVersion = 'Brixton.SR5' 5 | } 6 | repositories { 7 | mavenCentral() 8 | jcenter() 9 | } 10 | dependencies { 11 | classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") 12 | } 13 | } 14 | 15 | plugins { 16 | id "com.jfrog.bintray" version "0.4.1" 17 | } 18 | 19 | apply plugin: 'java' 20 | apply plugin: 'eclipse' 21 | apply plugin: 'idea' 22 | apply plugin: 'spring-boot' 23 | 24 | jar { 25 | baseName = 'product-composite-service' 26 | version = '0.0.1-SNAPSHOT' 27 | } 28 | 29 | sourceCompatibility = 1.8 30 | targetCompatibility = 1.8 31 | 32 | repositories { 33 | mavenLocal() 34 | jcenter() 35 | mavenCentral() 36 | } 37 | 38 | dependencies { 39 | compile("org.springframework.boot:spring-boot-starter-web") 40 | { 41 | exclude module: 'spring-boot-starter-tomcat' 42 | } 43 | compile("org.springframework.boot:spring-boot-starter-undertow") 44 | compile("org.springframework.boot:spring-boot-starter-actuator") 45 | 46 | compile("org.springframework.cloud:spring-cloud-starter-hystrix") 47 | compile("org.springframework.cloud:spring-cloud-starter-eureka") 48 | compile("org.springframework.cloud:spring-cloud-starter-config") 49 | compile("org.springframework.cloud:spring-cloud-starter-bus-amqp") 50 | compile('org.springframework.cloud:spring-cloud-starter-sleuth') 51 | compile('org.springframework.cloud:spring-cloud-sleuth-stream') 52 | 53 | compile("org.springframework.cloud:spring-cloud-starter-oauth2") 54 | compile("org.springframework.cloud:spring-cloud-starter-security") 55 | 56 | compile("org.apache.httpcomponents:httpclient:4.2.1") 57 | compile("org.apache.httpcomponents:fluent-hc:4.2.1") 58 | 59 | compile("se.callista.microservises:util:0.0.1-SNAPSHOT") 60 | 61 | testCompile("org.springframework.boot:spring-boot-starter-test") 62 | } 63 | 64 | dependencyManagement { 65 | imports { 66 | mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" 67 | } 68 | } 69 | 70 | eclipse { 71 | classpath { 72 | containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER') 73 | containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8' 74 | } 75 | } 76 | 77 | task wrapper(type: Wrapper) { 78 | gradleVersion = '2.9' 79 | } 80 | -------------------------------------------------------------------------------- /util/src/main/java/se/callista/microservices/util/CpuCruncherBean.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.util; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.cloud.context.config.annotation.RefreshScope; 8 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 9 | import org.springframework.stereotype.Component; 10 | 11 | @RefreshScope 12 | @Component 13 | public class CpuCruncherBean { 14 | 15 | private static final Logger LOG = LoggerFactory.getLogger(CpuCruncherBean.class); 16 | 17 | private final int minStrength; 18 | private final int maxStrength; 19 | 20 | @Autowired 21 | public CpuCruncherBean( 22 | @Value("${service.minStrength:0}") int minStrength, 23 | @Value("${service.maxStrength:0}") int maxStrength) { 24 | 25 | if (minStrength < 0) { 26 | LOG.info("The min strength was set to a negative number, min strength now set 0, was: {}.", minStrength); 27 | minStrength = 0; 28 | } 29 | 30 | if (maxStrength < 0) { 31 | LOG.info("The max strength was set to a negative number, max strength now set 0, was: {}.", maxStrength); 32 | maxStrength = 0; 33 | } 34 | 35 | if (maxStrength < minStrength) { 36 | maxStrength = minStrength; 37 | LOG.info("The max strength was set lower then the min strength, max strength now set equal to the min strength: {}.", minStrength); 38 | } 39 | 40 | LOG.info("Set min and max strength to {} - {}.", minStrength, maxStrength); 41 | 42 | this.minStrength = minStrength; 43 | this.maxStrength = maxStrength; 44 | } 45 | 46 | public void exec() { 47 | 48 | int strength = calculateStrength(); 49 | 50 | LOG.debug("Will encrypt quote using BCrypt with {} log rounds (i.e. strength)", strength); 51 | BCryptPasswordEncoder encoder = new BCryptPasswordEncoder(strength); 52 | 53 | String quoteText = "This is a very secret message..."; 54 | String encryptedQuote = encoder.encode(quoteText); 55 | 56 | LOG.debug("Encrypted quote: '" + encryptedQuote + "'"); 57 | LOG.debug("Delivered quote: '" + quoteText + "'"); 58 | } 59 | 60 | public int calculateStrength() { 61 | 62 | int strength = minStrength + (int) (Math.random() * (maxStrength - minStrength)); 63 | LOG.debug("Calculated strength: {}", strength); 64 | return strength; 65 | } 66 | } -------------------------------------------------------------------------------- /util/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /microservices/support/turbine/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /microservices/core/product-service/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /microservices/core/review-service/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /microservices/support/auth-server/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /microservices/support/config-server/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /microservices/support/edge-server/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /microservices/support/zipkin-server/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /microservices/core/recommendation-service/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /microservices/support/discovery-server/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /microservices/support/monitor-dashboard/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /microservices/composite/product-composite-service/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /microservices/composite/product-composite-service/src/main/java/se/callista/microservices/composite/product/model/ProductAggregated.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.composite.product.model; 2 | 3 | import se.callista.microservices.model.Product; 4 | import se.callista.microservices.model.Recommendation; 5 | import se.callista.microservices.model.Review; 6 | 7 | import java.util.List; 8 | import java.util.stream.Collectors; 9 | 10 | /** 11 | * Created by magnus on 04/03/15. 12 | */ 13 | public class ProductAggregated { 14 | private int productId; 15 | private String name; 16 | private int weight; 17 | private List recommendations; 18 | private List reviews; 19 | private ServiceAddresses serviceAddresses; 20 | 21 | public ProductAggregated(Product product, List recommendations, List reviews, String serviceAddress) { 22 | 23 | // 1. Setup product info 24 | this.productId = product.getProductId(); 25 | this.name = product.getName(); 26 | this.weight = product.getWeight(); 27 | 28 | // 2. Copy summary recommendation info, if available 29 | if (recommendations != null) 30 | this.recommendations = recommendations.stream() 31 | .map(r -> new RecommendationSummary(r.getRecommendationId(), r.getAuthor(), r.getRate())) 32 | .collect(Collectors.toList()); 33 | 34 | // 3. Copy summary review info, if available 35 | if (reviews != null) 36 | this.reviews = reviews.stream() 37 | .map(r -> new ReviewSummary(r.getReviewId(), r.getAuthor(), r.getSubject())) 38 | .collect(Collectors.toList()); 39 | 40 | // 4. Create info regarding the involved microservices addresses 41 | String productAddress = product.getServiceAddress(); 42 | String reviewAddress = (reviews != null && reviews.size() > 0) ? reviews.get(0).getServiceAddress() : ""; 43 | String recommendationAddress = (recommendations != null && recommendations.size() > 0) ? recommendations.get(0).getServiceAddress() : ""; 44 | serviceAddresses = new ServiceAddresses(serviceAddress, productAddress, reviewAddress, recommendationAddress); 45 | } 46 | 47 | public int getProductId() { 48 | return productId; 49 | } 50 | 51 | public String getName() { 52 | return name; 53 | } 54 | 55 | public int getWeight() { 56 | return weight; 57 | } 58 | 59 | public List getRecommendations() { 60 | return recommendations; 61 | } 62 | 63 | public List getReviews() { 64 | return reviews; 65 | } 66 | 67 | public ServiceAddresses getServiceAddresses() { 68 | return serviceAddresses; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /microservices/core/product-service/src/main/java/se/callista/microservices/core/product/service/ProductService.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.core.product.service; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.web.bind.annotation.PathVariable; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RequestParam; 8 | import org.springframework.web.bind.annotation.RestController; 9 | import se.callista.microservices.model.Product; 10 | import se.callista.microservices.util.CpuCruncherBean; 11 | import se.callista.microservices.util.ServiceUtils; 12 | import se.callista.microservices.util.SetProcTimeBean; 13 | 14 | import javax.inject.Inject; 15 | import javax.ws.rs.Consumes; 16 | import javax.ws.rs.Produces; 17 | 18 | import static javax.ws.rs.core.MediaType.APPLICATION_JSON; 19 | 20 | /** 21 | * Created by magnus on 04/03/15. 22 | */ 23 | @Produces(APPLICATION_JSON) 24 | @Consumes(APPLICATION_JSON) 25 | @RestController 26 | public class ProductService { 27 | 28 | private static final Logger LOG = LoggerFactory.getLogger(ProductService.class); 29 | 30 | private final SetProcTimeBean setProcTimeBean; 31 | private final CpuCruncherBean cpuCruncher; 32 | private final ServiceUtils util; 33 | 34 | @Inject 35 | public ProductService(SetProcTimeBean setProcTimeBean, CpuCruncherBean cpuCruncher, ServiceUtils util) { 36 | this.setProcTimeBean = setProcTimeBean; 37 | this.cpuCruncher = cpuCruncher; 38 | this.util = util; 39 | } 40 | 41 | /** 42 | * Sample usage: curl $HOST:$PORT/product/1 43 | * 44 | * @param productId 45 | * @return 46 | */ 47 | @RequestMapping("/product/{productId}") 48 | public Product getProduct(@PathVariable int productId) { 49 | 50 | int pt = setProcTimeBean.calculateProcessingTime(); 51 | LOG.info("/product called, processing time: {}", pt); 52 | 53 | sleep(pt); 54 | 55 | cpuCruncher.exec(); 56 | 57 | LOG.debug("/product return the found product"); 58 | return new Product(productId, "name", 123, util.getServiceAddress()); 59 | } 60 | 61 | private void sleep(int pt) { 62 | try { 63 | Thread.sleep(pt); 64 | } catch (InterruptedException e) { 65 | e.printStackTrace(); 66 | } 67 | } 68 | 69 | /** 70 | * Sample usage: 71 | * 72 | * curl "http://localhost:10002/set-processing-time?minMs=1000&maxMs=2000" 73 | * 74 | * @param minMs 75 | * @param maxMs 76 | */ 77 | @RequestMapping("/set-processing-time") 78 | public void setProcessingTime( 79 | @RequestParam(value = "minMs", required = true) int minMs, 80 | @RequestParam(value = "maxMs", required = true) int maxMs) { 81 | 82 | LOG.info("/set-processing-time called: {} - {} ms", minMs, maxMs); 83 | 84 | setProcTimeBean.setDefaultProcessingTime(minMs, maxMs); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /microservices/composite/product-composite-service/src/test/java/se/callista/microservices/composite/product/service/AsyncCallTests.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.composite.product.service; 2 | 3 | import org.junit.Before; 4 | import org.junit.Test; 5 | import org.mockito.Mockito; 6 | import org.mockito.invocation.InvocationOnMock; 7 | import org.springframework.http.HttpStatus; 8 | import org.springframework.http.ResponseEntity; 9 | import se.callista.microservices.composite.product.model.ProductAggregated; 10 | import se.callista.microservices.model.Product; 11 | import se.callista.microservices.util.ServiceUtils; 12 | 13 | import java.util.ArrayList; 14 | 15 | import static org.junit.Assert.assertEquals; 16 | import static org.junit.Assert.assertNotNull; 17 | import static org.mockito.Matchers.any; 18 | import static org.mockito.Mockito.when; 19 | import static org.springframework.http.HttpStatus.OK; 20 | 21 | /** 22 | * Created by magnus on 15/07/16. 23 | */ 24 | public class AsyncCallTests { 25 | 26 | private static final int ID = 123; 27 | private static final String NAME = "name"; 28 | private static final int WEIGHT = 456; 29 | 30 | private ProductCompositeService service; 31 | 32 | private ProductCompositeIntegration mock = Mockito.mock(ProductCompositeIntegration.class); 33 | 34 | private ServiceUtils util = new ServiceUtils(null, null); 35 | 36 | @Before 37 | public void beforeTest() { 38 | 39 | when(mock.getProduct(any(Integer.class))). 40 | thenAnswer(invocation -> util.createOkResponse(new Product(getProductId(invocation), NAME, WEIGHT, ""))); 41 | 42 | when(mock.getRecommendations(any(Integer.class))). 43 | thenReturn(util.createOkResponse(new ArrayList<>())); 44 | 45 | when(mock.getReviews(any(Integer.class))). 46 | thenReturn(util.createOkResponse(new ArrayList<>())); 47 | 48 | service = new ProductCompositeService(mock, util); 49 | 50 | } 51 | 52 | @Test 53 | public void testSync() { 54 | ResponseEntity response = service.getProduct(ID); 55 | 56 | assertResponse(response); 57 | } 58 | 59 | @Test 60 | public void testAsync() { 61 | ResponseEntity response = service.getProductAsync(ID); 62 | 63 | assertResponse(response); 64 | } 65 | 66 | private int getProductId(InvocationOnMock invocation) { 67 | return (Integer)invocation.getArguments()[0]; 68 | } 69 | 70 | private void assertResponse(ResponseEntity response) { 71 | assertNotNull(response); 72 | 73 | HttpStatus code = response.getStatusCode(); 74 | ProductAggregated body = response.getBody(); 75 | 76 | assertEquals(OK, code); 77 | assertEquals(ID, body.getProductId()); 78 | assertEquals(NAME, body.getName()); 79 | assertEquals(WEIGHT, body.getWeight()); 80 | assertEquals(0, body.getRecommendations().size()); 81 | assertEquals(0, body.getReviews().size()); 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /microservices/support/discovery-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8761 3 | 4 | security: 5 | user: 6 | password: ${eureka.password} # Don't use a default password in a real app 7 | 8 | info: 9 | component: Discovery Server 10 | 11 | 12 | eureka: 13 | # Configure standalone mode, see http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html#_standalone_mode 14 | client: 15 | registerWithEureka: false 16 | fetchRegistry: false 17 | serviceUrl: 18 | defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/ 19 | instance: 20 | hostname: localhost 21 | server: 22 | # Disable self-preservation during development, see https://github.com/Netflix/eureka/wiki/Understanding-Eureka-Peer-to-Peer-Communication 23 | enableSelfPreservation: false 24 | # renewalPercentThreshold: 0.49 25 | # renewalThresholdUpdateIntervalMs 26 | 27 | # Set this only for this sample service without which starting the instance will by default wait for the default of 5 mins 28 | waitTimeInMsWhenSyncEmpty: 0 29 | 30 | # for the example, set this to zero as we will not have peers to sync up with. 31 | # Do not set in a real environment with multi-node eureka clusters. 32 | numberRegistrySyncRetries: 0 33 | 34 | response-cache-update-interval-ms: 1000 35 | password: ${SECURITY_USER_PASSWORD:password} 36 | 37 | logging: 38 | level: 39 | root: WARN 40 | 41 | # Set INFO to see the allocated port 42 | org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer: INFO 43 | org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainer: INFO 44 | 45 | --- 46 | spring: 47 | profiles: peer # not standalone 48 | eureka: 49 | instance: 50 | hostname: 127.0.1.1 51 | client: 52 | registerWithEureka: true 53 | fetchRegistry: true 54 | serviceUrl: 55 | defaultZone: http://user:${eureka.password}@127.0.0.1:8762/eureka/ 56 | 57 | --- 58 | spring: 59 | profiles: other # not standalone 60 | server: 61 | port: 8762 62 | eureka: 63 | instance: 64 | hostname: 127.0.0.1 65 | nonSecurePort: ${server.port} 66 | client: 67 | serviceUrl: 68 | defaultZone: http://user:${eureka.password}@127.0.1.1:8761/eureka/ 69 | 70 | --- 71 | spring: 72 | profiles: local # connect to remote peer 73 | eureka: 74 | instance: 75 | hostname: ${localhost.hostname:${localhost.ngrok}.ngrok.com} 76 | client: 77 | registerWithEureka: true 78 | fetchRegistry: true 79 | serviceUrl: 80 | defaultZone: http://user:${eureka.password}@${PREFIX:}eureka.cfapps.io/eureka/ 81 | 82 | --- 83 | # Eureka instance 1 when used on Docker 84 | spring: 85 | profiles: docker1 86 | eureka: 87 | instance: 88 | hostname: discovery 89 | client: 90 | registerWithEureka: true 91 | fetchRegistry: true 92 | serviceUrl: 93 | defaultZone: http://user:${eureka.password}@discovery2:8762/eureka/ 94 | 95 | --- 96 | # Eureka instance 2 when used on Docker 97 | spring: 98 | profiles: docker2 99 | server: 100 | port: 8762 101 | eureka: 102 | instance: 103 | hostname: discovery2 104 | nonSecurePort: ${server.port} 105 | client: 106 | serviceUrl: 107 | defaultZone: http://user:${eureka.password}@discovery:8761/eureka/ 108 | -------------------------------------------------------------------------------- /docker-compose-without-elk.yml: -------------------------------------------------------------------------------- 1 | version: '2.1' 2 | 3 | services: 4 | 5 | rabbitmq: 6 | image: rabbitmq:3-management 7 | restart: always 8 | ports: 9 | # - "5672:5672" 10 | - "15672:15672" 11 | 12 | discovery: 13 | build: microservices/support/discovery-server 14 | restart: always 15 | ports: 16 | - "8761:8761" 17 | environment: 18 | - JAVA_TOOL_OPTIONS=${MY_JAVA_TOOL_OPTIONS} 19 | 20 | config: 21 | build: microservices/support/config-server 22 | restart: always 23 | ports: 24 | - "8888:8888" 25 | volumes: 26 | - $PWD/../blog-microservices-config:/config-repo 27 | environment: 28 | - SPRING_PROFILES_ACTIVE=docker,native 29 | - SPRING_CLOUD_CONFIG_SERVER_NATIVE_SEARCH_LOCATIONS=file:/config-repo 30 | - SECURITY_USER_NAME=${MY_CONFIG_USER} 31 | - SECURITY_USER_PASSWORD=${MY_CONFIG_PWD} 32 | - JAVA_TOOL_OPTIONS=${MY_JAVA_TOOL_OPTIONS} 33 | - MY_CONFIG_ENCRYPT_KEY=${MY_CONFIG_ENCRYPT_KEY} 34 | 35 | auth: 36 | build: microservices/support/auth-server 37 | restart: always 38 | ports: 39 | - "9999:9999" 40 | environment: 41 | - MY_CONFIG_USER=${MY_CONFIG_USER} 42 | - MY_CONFIG_PWD=${MY_CONFIG_PWD} 43 | - JAVA_TOOL_OPTIONS=${MY_JAVA_TOOL_OPTIONS} 44 | 45 | #turbine: 46 | # image: magnuslarsson/ms-blog-turbine 47 | ## volumes: 48 | ## - $PWD/logs:/logs 49 | 50 | pro: 51 | build: microservices/core/product-service 52 | restart: always 53 | environment: 54 | - MY_CONFIG_USER=${MY_CONFIG_USER} 55 | - MY_CONFIG_PWD=${MY_CONFIG_PWD} 56 | - JAVA_TOOL_OPTIONS=${MY_JAVA_TOOL_OPTIONS} 57 | 58 | rec: 59 | build: microservices/core/recommendation-service 60 | restart: always 61 | environment: 62 | - MY_CONFIG_USER=${MY_CONFIG_USER} 63 | - MY_CONFIG_PWD=${MY_CONFIG_PWD} 64 | - JAVA_TOOL_OPTIONS=${MY_JAVA_TOOL_OPTIONS} 65 | 66 | rev: 67 | build: microservices/core/review-service 68 | restart: always 69 | environment: 70 | - MY_CONFIG_USER=${MY_CONFIG_USER} 71 | - MY_CONFIG_PWD=${MY_CONFIG_PWD} 72 | - JAVA_TOOL_OPTIONS=${MY_JAVA_TOOL_OPTIONS} 73 | 74 | composite: 75 | build: microservices/composite/product-composite-service 76 | restart: always 77 | environment: 78 | - MY_CONFIG_USER=${MY_CONFIG_USER} 79 | - MY_CONFIG_PWD=${MY_CONFIG_PWD} 80 | - JAVA_TOOL_OPTIONS=${MY_JAVA_TOOL_OPTIONS} 81 | 82 | monitor: 83 | build: microservices/support/monitor-dashboard 84 | restart: always 85 | ports: 86 | - "7979:7979" 87 | environment: 88 | - MY_CONFIG_USER=${MY_CONFIG_USER} 89 | - MY_CONFIG_PWD=${MY_CONFIG_PWD} 90 | - JAVA_TOOL_OPTIONS=${MY_JAVA_TOOL_OPTIONS} 91 | 92 | edge: 93 | build: microservices/support/edge-server 94 | restart: always 95 | ports: 96 | - "443:8765" 97 | environment: 98 | - MY_CONFIG_USER=${MY_CONFIG_USER} 99 | - MY_CONFIG_PWD=${MY_CONFIG_PWD} 100 | - JAVA_TOOL_OPTIONS=${MY_JAVA_TOOL_OPTIONS} 101 | 102 | zipkin: 103 | build: microservices/support/zipkin-server 104 | restart: always 105 | ports: 106 | - "9411:9411" 107 | environment: 108 | - MY_CONFIG_USER=${MY_CONFIG_USER} 109 | - MY_CONFIG_PWD=${MY_CONFIG_PWD} 110 | - JAVA_TOOL_OPTIONS=${MY_JAVA_TOOL_OPTIONS} 111 | -------------------------------------------------------------------------------- /microservices/core/recommendation-service/src/main/java/se/callista/microservices/core/recommendation/service/RecommendationService.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.core.recommendation.service; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RequestParam; 7 | import org.springframework.web.bind.annotation.RestController; 8 | import se.callista.microservices.model.Recommendation; 9 | import se.callista.microservices.util.CpuCruncherBean; 10 | import se.callista.microservices.util.ServiceUtils; 11 | import se.callista.microservices.util.SetProcTimeBean; 12 | 13 | import javax.inject.Inject; 14 | import javax.ws.rs.Consumes; 15 | import javax.ws.rs.Produces; 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | import static javax.ws.rs.core.MediaType.APPLICATION_JSON; 20 | 21 | /** 22 | * Created by magnus on 04/03/15. 23 | */ 24 | @Produces(APPLICATION_JSON) 25 | @Consumes(APPLICATION_JSON) 26 | @RestController 27 | public class RecommendationService { 28 | 29 | private static final Logger LOG = LoggerFactory.getLogger(RecommendationService.class); 30 | 31 | private final SetProcTimeBean setProcTimeBean; 32 | private final CpuCruncherBean cpuCruncher; 33 | private final ServiceUtils util; 34 | 35 | @Inject 36 | public RecommendationService(SetProcTimeBean setProcTimeBean, CpuCruncherBean cpuCruncher, ServiceUtils util) { 37 | this.setProcTimeBean = setProcTimeBean; 38 | this.cpuCruncher = cpuCruncher; 39 | this.util = util; 40 | } 41 | 42 | /* 43 | private int port; 44 | 45 | @Value("local.server.port") 46 | public void setPort (int port) { 47 | LOG.info("getReviews will be called on port: {}", port); 48 | this.port = port; 49 | } 50 | */ 51 | 52 | /** 53 | * Sample usage: curl $HOST:$PORT/recommendation?productId=1 54 | * 55 | * @param productId 56 | * @return 57 | */ 58 | @RequestMapping("/recommendation") 59 | public List getRecommendations( 60 | @RequestParam(value = "productId", required = true) int productId) { 61 | 62 | int pt = setProcTimeBean.calculateProcessingTime(); 63 | LOG.info("/recommendation called, processing time: {}", pt); 64 | 65 | sleep(pt); 66 | 67 | cpuCruncher.exec(); 68 | 69 | List list = new ArrayList<>(); 70 | list.add(new Recommendation(productId, 1, "Author 1", 1, "Content 1", util.getServiceAddress())); 71 | list.add(new Recommendation(productId, 2, "Author 2", 2, "Content 2", util.getServiceAddress())); 72 | list.add(new Recommendation(productId, 3, "Author 3", 3, "Content 3", util.getServiceAddress())); 73 | 74 | LOG.debug("/recommendation response size: {}", list.size()); 75 | 76 | return list; 77 | } 78 | 79 | private void sleep(int pt) { 80 | try { 81 | Thread.sleep(pt); 82 | } catch (InterruptedException e) { 83 | e.printStackTrace(); 84 | } 85 | } 86 | 87 | /** 88 | * Sample usage: 89 | * 90 | * curl "http://localhost:10002/set-processing-time?minMs=1000&maxMs=2000" 91 | * 92 | * @param minMs 93 | * @param maxMs 94 | */ 95 | @RequestMapping("/set-processing-time") 96 | public void setProcessingTime( 97 | @RequestParam(value = "minMs", required = true) int minMs, 98 | @RequestParam(value = "maxMs", required = true) int maxMs) { 99 | 100 | LOG.info("/set-processing-time called: {} - {} ms", minMs, maxMs); 101 | 102 | setProcTimeBean.setDefaultProcessingTime(minMs, maxMs); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /test-all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Sample use of overriding parameters: 4 | # - host, name of the host where all microservices are running 5 | # - port, the port where the API is available 6 | # 7 | # $ host=myhost port=8765 ./test-all.sh 8 | # 9 | : ${host=localhost} 10 | : ${port=443} 11 | 12 | # set -e 13 | 14 | function testUrl() { 15 | url=$@ 16 | if curl $url -ks -f -o /dev/null 17 | then 18 | echo "Ok" 19 | return 0 20 | else 21 | echo -n "not yet" 22 | return 1 23 | fi; 24 | } 25 | 26 | function waitForService() { 27 | 28 | url=$@ 29 | echo -n "Wait for: $url... " 30 | n=0 31 | until testUrl $url 32 | do 33 | ((n++)) 34 | if [[ $n == 20 ]] 35 | then 36 | echo " Give up" 37 | exit 1 38 | else 39 | sleep 6 40 | echo -n ", retry #$n " 41 | fi 42 | done 43 | 44 | } 45 | 46 | function waitForServices() { 47 | waitForService $host:8761 48 | waitForService $host:8761/eureka/apps/config-server 49 | waitForService $host:8761/eureka/apps/edge-server 50 | waitForService $host:8761/eureka/apps/product-service 51 | waitForService $host:8761/eureka/apps/review-service 52 | waitForService $host:8761/eureka/apps/recommendation-service 53 | waitForService $host:8761/eureka/apps/composite-service 54 | } 55 | 56 | 57 | function testAPI() { 58 | url=$@ 59 | echo "Is the API awake?" 60 | echo "$ curl -ks https://$host:$port/api/product/123 -H \"Authorization: Bearer \$TOKEN\" | jq ." 61 | if curl -ks https://$host:$port/api/product/123 -H "Authorization: Bearer $TOKEN" -f -o /dev/null 62 | then 63 | echo "Ok" 64 | return 0 65 | else 66 | echo -n "not yet" 67 | return 1 68 | fi; 69 | } 70 | 71 | function waitForAPI() { 72 | 73 | url=$@ 74 | echo -n "Wait for API: $url... " 75 | n=0 76 | until testAPI $url 77 | do 78 | ((n++)) 79 | if [[ $n == 20 ]] 80 | then 81 | echo " Give up" 82 | exit 1 83 | else 84 | sleep 6 85 | echo -n ", retry #$n " 86 | fi 87 | done 88 | 89 | } 90 | 91 | echo "Start:" `date` 92 | 93 | . ./setup-env.sh 94 | 95 | if [[ $@ == *"start"* ]] 96 | then 97 | echo "Restarting the test environment..." 98 | echo "$ docker-compose down" 99 | docker-compose down 100 | echo "$ docker-compose up -d" 101 | docker-compose up -d 102 | fi 103 | 104 | waitForServices 105 | 106 | #echo '' 107 | #echo "Call /info on each microservice:" 108 | #docker-compose exec composite wget -qO- localhost:8080/info | jq 109 | #docker-compose exec pro wget -qO- localhost:8080/info | jq 110 | #docker-compose exec rev wget -qO- localhost:8080/info | jq 111 | #docker-compose exec rec wget -qO- localhost:8080/info | jq 112 | 113 | 114 | echo '' 115 | echo "Get an OAuth Access Token:" 116 | echo "$ curl -ks https://acme:acmesecret@$host:9999/uaa/oauth/token -d grant_type=password -d client_id=acme -d scope=webshop -d username=user -d password=password | jq ." 117 | OAUTH_RESPOSE=`curl -ks https://acme:acmesecret@$host:9999/uaa/oauth/token -d grant_type=password -d client_id=acme -d scope=webshop -d username=user -d password=password` 118 | echo $OAUTH_RESPOSE | jq . 119 | export TOKEN=`echo $OAUTH_RESPOSE | jq -r .access_token` 120 | echo "ACCESS TOKEN: $TOKEN" 121 | 122 | echo '' 123 | echo "Call API with Access Token... " 124 | waitForAPI 125 | echo "$ curl -ks https://$host:$port/api/product/123 -H \"Authorization: Bearer \$TOKEN\" | jq ." 126 | curl -ks https://$host:$port/api/product/123 -H "Authorization: Bearer $TOKEN" | jq . 127 | 128 | if [[ $@ == *"stop"* ]] 129 | then 130 | echo "We are done, stopping the test environment..." 131 | echo "$ docker-compose down" 132 | docker-compose down 133 | fi 134 | 135 | echo "End:" `date` -------------------------------------------------------------------------------- /microservices/core/review-service/src/main/java/se/callista/microservices/core/review/service/ReviewService.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.core.review.service; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.beans.factory.annotation.Value; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RequestParam; 8 | import org.springframework.web.bind.annotation.RestController; 9 | import se.callista.microservices.model.Review; 10 | import se.callista.microservices.util.CpuCruncherBean; 11 | import se.callista.microservices.util.ServiceUtils; 12 | import se.callista.microservices.util.SetProcTimeBean; 13 | 14 | import javax.inject.Inject; 15 | import javax.ws.rs.Consumes; 16 | import javax.ws.rs.Produces; 17 | import java.util.ArrayList; 18 | import java.util.List; 19 | 20 | import static javax.ws.rs.core.MediaType.APPLICATION_JSON; 21 | 22 | /** 23 | * Created by magnus on 04/03/15. 24 | */ 25 | @Produces(APPLICATION_JSON) 26 | @Consumes(APPLICATION_JSON) 27 | @RestController 28 | public class ReviewService { 29 | 30 | private static final Logger LOG = LoggerFactory.getLogger(ReviewService.class); 31 | 32 | private final SetProcTimeBean setProcTimeBean; 33 | private final CpuCruncherBean cpuCruncher; 34 | private final ServiceUtils util; 35 | private final String mySecretProperty; 36 | 37 | @Inject 38 | public ReviewService( 39 | @Value("${my-secret-property:UNKNOWN}") String mySecretProperty, 40 | SetProcTimeBean setProcTimeBean, CpuCruncherBean cpuCruncher, ServiceUtils util) { 41 | 42 | this.mySecretProperty = mySecretProperty; 43 | this.setProcTimeBean = setProcTimeBean; 44 | this.cpuCruncher = cpuCruncher; 45 | this.util = util; 46 | } 47 | 48 | /* 49 | private int port; 50 | 51 | @Value("local.server.port") 52 | public void setPort (int port) { 53 | LOG.info("getReviews will be called on port: {}", port); 54 | this.port = port; 55 | } 56 | */ 57 | 58 | /** 59 | * Sample usage: curl $HOST:$PORT/review?productId=1 60 | * 61 | * @param productId 62 | * @return 63 | */ 64 | @RequestMapping("/review") 65 | public List getReviews( 66 | @RequestParam(value = "productId", required = true) int productId) { 67 | 68 | int pt = setProcTimeBean.calculateProcessingTime(); 69 | LOG.info("/reviews called, processing time: {}", pt); 70 | 71 | LOG.info("mySecretProperty: {}", mySecretProperty); 72 | 73 | sleep(pt); 74 | 75 | cpuCruncher.exec(); 76 | 77 | List list = new ArrayList<>(); 78 | list.add(new Review(productId, 1, "Author 1", "Subject 1", "Content 1", util.getServiceAddress())); 79 | list.add(new Review(productId, 2, "Author 2", "Subject 2", "Content 2", util.getServiceAddress())); 80 | list.add(new Review(productId, 3, "Author 3", "Subject 3", "Content 3", util.getServiceAddress())); 81 | 82 | LOG.debug("/reviews response size: {}", list.size()); 83 | 84 | return list; 85 | } 86 | 87 | private void sleep(int pt) { 88 | try { 89 | Thread.sleep(pt); 90 | } catch (InterruptedException e) { 91 | e.printStackTrace(); 92 | } 93 | } 94 | 95 | /** 96 | * Sample usage: 97 | * 98 | * curl "http://localhost:10002/set-processing-time?minMs=1000&maxMs=2000" 99 | * 100 | * @param minMs 101 | * @param maxMs 102 | */ 103 | @RequestMapping("/set-processing-time") 104 | public void setProcessingTime( 105 | @RequestParam(value = "minMs", required = true) int minMs, 106 | @RequestParam(value = "maxMs", required = true) int maxMs) { 107 | 108 | LOG.info("/set-processing-time called: {} - {} ms", minMs, maxMs); 109 | 110 | setProcTimeBean.setDefaultProcessingTime(minMs, maxMs); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /util/src/main/java/se/callista/microservices/util/ServiceUtils.java: -------------------------------------------------------------------------------- 1 | package se.callista.microservices.util; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.cloud.client.ServiceInstance; 8 | import org.springframework.cloud.client.loadbalancer.LoadBalancerClient; 9 | import org.springframework.http.HttpStatus; 10 | import org.springframework.http.ResponseEntity; 11 | import org.springframework.stereotype.Component; 12 | 13 | import java.net.InetAddress; 14 | import java.net.URI; 15 | import java.net.UnknownHostException; 16 | 17 | /** 18 | * Created by magnus on 08/03/15. 19 | * 20 | */ 21 | 22 | @Component 23 | public class ServiceUtils { 24 | private static final Logger LOG = LoggerFactory.getLogger(ServiceUtils.class); 25 | 26 | private final LoadBalancerClient loadBalancer; 27 | private final String port; 28 | 29 | private String serviceAddress = null; 30 | 31 | @Autowired 32 | public ServiceUtils( 33 | @Value("${server.port}") String port, 34 | LoadBalancerClient loadBalancer) { 35 | 36 | this.port = port; 37 | this.loadBalancer = loadBalancer; 38 | } 39 | 40 | /** 41 | * 42 | * @param serviceId 43 | * @return 44 | */ 45 | public URI getServiceUrl(String serviceId) { 46 | return getServiceUrl(serviceId, null); 47 | } 48 | 49 | /** 50 | * 51 | * @param serviceId 52 | * @param fallbackUri 53 | * @return 54 | */ 55 | protected URI getServiceUrl(String serviceId, String fallbackUri) { 56 | URI uri = null; 57 | try { 58 | ServiceInstance instance = loadBalancer.choose(serviceId); 59 | 60 | if (instance == null) { 61 | throw new RuntimeException("Can't find a service with serviceId = " + serviceId); 62 | } 63 | 64 | uri = instance.getUri(); 65 | LOG.debug("Resolved serviceId '{}' to URL '{}'.", serviceId, uri); 66 | 67 | } catch (RuntimeException e) { 68 | // Eureka not available, use fallback if specified otherwise rethrow the error 69 | if (fallbackUri == null) { 70 | throw e; 71 | 72 | } else { 73 | uri = URI.create(fallbackUri); 74 | LOG.warn("Failed to resolve serviceId '{}'. Fallback to URL '{}'.", serviceId, uri); 75 | } 76 | } 77 | 78 | return uri; 79 | } 80 | 81 | public ResponseEntity createOkResponse(T body) { 82 | return createResponse(body, HttpStatus.OK); 83 | } 84 | 85 | /** 86 | * Clone an existing result as a new one, filtering out http headers that not should be moved on and so on... 87 | * 88 | * @param result 89 | * @param 90 | * @return 91 | */ 92 | public ResponseEntity createResponse(ResponseEntity result) { 93 | 94 | // TODO: How to relay the transfer encoding??? The code below makes the fallback method to kick in... 95 | ResponseEntity response = createResponse(result.getBody(), result.getStatusCode()); 96 | // LOG.info("NEW HEADERS:"); 97 | // response.getHeaders().entrySet().stream().forEach(e -> LOG.info("{} = {}", e.getKey(), e.getValue())); 98 | // String ct = result.getHeaders().getFirst(HTTP.CONTENT_TYPE); 99 | // if (ct != null) { 100 | // LOG.info("Add without remove {}: {}", HTTP.CONTENT_TYPE, ct); 101 | //// response.getHeaders().remove(HTTP.CONTENT_TYPE); 102 | // response.getHeaders().add(HTTP.CONTENT_TYPE, ct); 103 | // } 104 | return response; 105 | } 106 | 107 | public ResponseEntity createResponse(T body, HttpStatus httpStatus) { 108 | return new ResponseEntity<>(body, httpStatus); 109 | } 110 | 111 | public String getServiceAddress() { 112 | if (serviceAddress == null) { 113 | serviceAddress = findMyHostname() + "/" + findMyIpAddress() + ":" + port; 114 | } 115 | return serviceAddress; 116 | } 117 | 118 | public String findMyHostname() { 119 | try { 120 | return InetAddress.getLocalHost().getHostName(); 121 | } catch (UnknownHostException e) { 122 | return "unknown host name"; 123 | } 124 | } 125 | 126 | public String findMyIpAddress() { 127 | try { 128 | return InetAddress.getLocalHost().getHostAddress(); 129 | } catch (UnknownHostException e) { 130 | return "unknown IP address"; 131 | } 132 | } 133 | 134 | } 135 | 136 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | machine: 2 | pre: 3 | - curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0 4 | java: 5 | version: oraclejdk8 6 | services: 7 | - docker 8 | 9 | dependencies: 10 | pre: 11 | - sudo pip install docker-compose 12 | post: 13 | # gradle clean build + docker-compose build... 14 | - docker-compose -version 15 | - docker version 16 | - docker info 17 | - ./build-all.sh 18 | 19 | # According to https://circleci.com/docs/test-metadata 20 | test: 21 | post: 22 | - mkdir -p $CIRCLE_TEST_REPORTS/junit/ 23 | - find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \; 24 | # - docker build -t magnuslarsson/ms-blog-auth-server microservices/support/auth-server/build 25 | # - docker build -t magnuslarsson/ms-blog-config-server microservices/support/config-server/build 26 | # - docker build -t magnuslarsson/ms-blog-discovery-server microservices/support/discovery-server/build 27 | # - docker build -t magnuslarsson/ms-blog-edge-server microservices/support/edge-server/build 28 | # - docker build -t magnuslarsson/ms-blog-monitor-dashboard microservices/support/monitor-dashboard/build 29 | # - docker build -t magnuslarsson/ms-blog-turbine microservices/support/turbine/build 30 | # - docker build -t magnuslarsson/ms-blog-product-service microservices/core/product-service/build 31 | # - docker build -t magnuslarsson/ms-blog-recommendation-service microservices/core/recommendation-service/build 32 | # - docker build -t magnuslarsson/ms-blog-review-service microservices/core/review-service/build 33 | # - docker build -t magnuslarsson/ms-blog-product-composite-service microservices/composite/product-composite-service/build 34 | - docker images 35 | # - host=localhost ./test-all.sh 36 | 37 | deployment: 38 | hub: 39 | branch: master 40 | commands: 41 | - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PWD 42 | 43 | # Push latest 44 | # - docker push magnuslarsson/ms-blog-auth-server 45 | # - docker push magnuslarsson/ms-blog-config-server 46 | # - docker push magnuslarsson/ms-blog-discovery-server 47 | # - docker push magnuslarsson/ms-blog-edge-server 48 | # - docker push magnuslarsson/ms-blog-monitor-dashboard 49 | # - docker push magnuslarsson/ms-blog-turbine 50 | # 51 | # - docker push magnuslarsson/ms-blog-product-service 52 | # - docker push magnuslarsson/ms-blog-recommendation-service 53 | # - docker push magnuslarsson/ms-blog-review-service 54 | # - docker push magnuslarsson/ms-blog-product-composite-service 55 | 56 | # Create builds tag "master.$CIRCLE_BUILD_NUM" and push it 57 | - docker tag blogmicroservices_auth magnuslarsson/ms-blog-auth-server:master.$CIRCLE_BUILD_NUM 58 | - docker tag blogmicroservices_config magnuslarsson/ms-blog-config-server:master.$CIRCLE_BUILD_NUM 59 | - docker tag blogmicroservices_discovery magnuslarsson/ms-blog-discovery-server:master.$CIRCLE_BUILD_NUM 60 | - docker tag blogmicroservices_edge magnuslarsson/ms-blog-edge-server:master.$CIRCLE_BUILD_NUM 61 | - docker tag blogmicroservices_monitor magnuslarsson/ms-blog-monitor-dashboard:master.$CIRCLE_BUILD_NUM 62 | - docker tag blogmicroservices_zipkin magnuslarsson/ms-blog-zipkin-server:master.$CIRCLE_BUILD_NUM 63 | # - docker tag magnuslarsson/ms-blog-turbine magnuslarsson/ms-blog-turbine:master.$CIRCLE_BUILD_NUM 64 | 65 | - docker tag blogmicroservices_pro magnuslarsson/ms-blog-product-service:master.$CIRCLE_BUILD_NUM 66 | - docker tag blogmicroservices_rec magnuslarsson/ms-blog-recommendation-service:master.$CIRCLE_BUILD_NUM 67 | - docker tag blogmicroservices_rev magnuslarsson/ms-blog-review-service:master.$CIRCLE_BUILD_NUM 68 | - docker tag blogmicroservices_composite magnuslarsson/ms-blog-product-composite-service:master.$CIRCLE_BUILD_NUM 69 | 70 | - docker push magnuslarsson/ms-blog-auth-server:master.$CIRCLE_BUILD_NUM 71 | - docker push magnuslarsson/ms-blog-config-server:master.$CIRCLE_BUILD_NUM 72 | - docker push magnuslarsson/ms-blog-discovery-server:master.$CIRCLE_BUILD_NUM 73 | - docker push magnuslarsson/ms-blog-edge-server:master.$CIRCLE_BUILD_NUM 74 | - docker push magnuslarsson/ms-blog-monitor-dashboard:master.$CIRCLE_BUILD_NUM 75 | - docker push magnuslarsson/ms-blog-zipkin-server:master.$CIRCLE_BUILD_NUM 76 | # - docker push magnuslarsson/ms-blog-turbine:master.$CIRCLE_BUILD_NUM 77 | 78 | - docker push magnuslarsson/ms-blog-product-service:master.$CIRCLE_BUILD_NUM 79 | - docker push magnuslarsson/ms-blog-recommendation-service:master.$CIRCLE_BUILD_NUM 80 | - docker push magnuslarsson/ms-blog-review-service:master.$CIRCLE_BUILD_NUM 81 | - docker push magnuslarsson/ms-blog-product-composite-service:master.$CIRCLE_BUILD_NUM 82 | -------------------------------------------------------------------------------- /util/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /microservices/support/turbine/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /microservices/core/product-service/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /microservices/core/review-service/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /microservices/support/auth-server/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | --------------------------------------------------------------------------------