diff --git a/02-todo-web-application-h2/target/classes/application.properties b/02-todo-web-application-h2/target/classes/application.properties new file mode 100644 index 0000000..bff8631 --- /dev/null +++ b/02-todo-web-application-h2/target/classes/application.properties @@ -0,0 +1,7 @@ +spring.mvc.view.prefix=/WEB-INF/jsp/ +spring.mvc.view.suffix=.jsp +logging.level.org.springframework.web=INFO + +spring.jpa.show-sql=true +spring.h2.console.enabled=true +spring.h2.console.settings.web-allow-others=true \ No newline at end of file diff --git a/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/EnvironmentConfigurationLogger.class b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/EnvironmentConfigurationLogger.class new file mode 100644 index 0000000..1d23e62 Binary files /dev/null and b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/EnvironmentConfigurationLogger.class differ diff --git a/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/SpringBootFirstWebApplication.class b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/SpringBootFirstWebApplication.class new file mode 100644 index 0000000..09ec1e1 Binary files /dev/null and b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/SpringBootFirstWebApplication.class differ diff --git a/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/controller/ErrorController.class b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/controller/ErrorController.class new file mode 100644 index 0000000..1071f5c Binary files /dev/null and b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/controller/ErrorController.class differ diff --git a/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/controller/LogoutController.class b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/controller/LogoutController.class new file mode 100644 index 0000000..0e443fc Binary files /dev/null and b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/controller/LogoutController.class differ diff --git a/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/controller/TodoController.class b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/controller/TodoController.class new file mode 100644 index 0000000..2c0bd7d Binary files /dev/null and b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/controller/TodoController.class differ diff --git a/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/controller/WelcomeController.class b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/controller/WelcomeController.class new file mode 100644 index 0000000..236f1e7 Binary files /dev/null and b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/controller/WelcomeController.class differ diff --git a/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/model/Todo.class b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/model/Todo.class new file mode 100644 index 0000000..ea05df5 Binary files /dev/null and b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/model/Todo.class differ diff --git a/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/security/SecurityConfiguration.class b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/security/SecurityConfiguration.class new file mode 100644 index 0000000..abff7b5 Binary files /dev/null and b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/security/SecurityConfiguration.class differ diff --git a/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/service/TodoRepository.class b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/service/TodoRepository.class new file mode 100644 index 0000000..2ec3721 Binary files /dev/null and b/02-todo-web-application-h2/target/classes/com/in28minutes/springboot/web/service/TodoRepository.class differ diff --git a/02-todo-web-application-h2/target/classes/data.sql b/02-todo-web-application-h2/target/classes/data.sql new file mode 100644 index 0000000..2f16341 --- /dev/null +++ b/02-todo-web-application-h2/target/classes/data.sql @@ -0,0 +1,6 @@ +insert into TODO +values(10001, 'Learn Spring Boot', false, sysdate(), 'in28minutes'); +insert into TODO +values(10002, 'Learn Angular JS', false, sysdate(), 'in28minutes'); +insert into TODO +values(10003, 'Learn to Dance', false, sysdate(), 'in28minutes'); diff --git a/02-todo-web-application-h2/target/test-classes/com/in28minutes/springboot/web/SpringBootFirstWebApplicationTests.class b/02-todo-web-application-h2/target/test-classes/com/in28minutes/springboot/web/SpringBootFirstWebApplicationTests.class new file mode 100644 index 0000000..450afd4 Binary files /dev/null and b/02-todo-web-application-h2/target/test-classes/com/in28minutes/springboot/web/SpringBootFirstWebApplicationTests.class differ diff --git a/03-todo-web-application-mysql/target/classes/application.properties b/03-todo-web-application-mysql/target/classes/application.properties new file mode 100644 index 0000000..3f2789a --- /dev/null +++ b/03-todo-web-application-mysql/target/classes/application.properties @@ -0,0 +1,20 @@ +spring.mvc.view.prefix=/WEB-INF/jsp/ +spring.mvc.view.suffix=.jsp +logging.level.org.springframework.web=INFO + +management.endpoints.web.base-path=/manage +management.endpoints.web.exposure.include=* + +spring.jpa.show-sql=true +#spring.h2.console.enabled=true +#spring.h2.console.settings.web-allow-others=true + +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +spring.jpa.hibernate.ddl-auto=update +spring.datasource.url=jdbc:mysql://${RDS_HOSTNAME:localhost}:${RDS_PORT:3306}/${RDS_DB_NAME:todos} +spring.datasource.username=${RDS_USERNAME:todos-user} +spring.datasource.password=${RDS_PASSWORD:dummytodos} +#spring.datasource.url=jdbc:mysql://localhost:3306/todos +#spring.datasource.username=todos-user +#spring.datasource.password=dummytodos +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL57Dialect \ No newline at end of file diff --git a/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/EnvironmentConfigurationLogger.class b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/EnvironmentConfigurationLogger.class new file mode 100644 index 0000000..1d23e62 Binary files /dev/null and b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/EnvironmentConfigurationLogger.class differ diff --git a/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/SpringBootFirstWebApplication.class b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/SpringBootFirstWebApplication.class new file mode 100644 index 0000000..09ec1e1 Binary files /dev/null and b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/SpringBootFirstWebApplication.class differ diff --git a/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/controller/ErrorController.class b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/controller/ErrorController.class new file mode 100644 index 0000000..1071f5c Binary files /dev/null and b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/controller/ErrorController.class differ diff --git a/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/controller/LogoutController.class b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/controller/LogoutController.class new file mode 100644 index 0000000..0e443fc Binary files /dev/null and b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/controller/LogoutController.class differ diff --git a/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/controller/TodoController.class b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/controller/TodoController.class new file mode 100644 index 0000000..2c0bd7d Binary files /dev/null and b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/controller/TodoController.class differ diff --git a/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/controller/WelcomeController.class b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/controller/WelcomeController.class new file mode 100644 index 0000000..236f1e7 Binary files /dev/null and b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/controller/WelcomeController.class differ diff --git a/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/model/Todo.class b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/model/Todo.class new file mode 100644 index 0000000..bc9153b Binary files /dev/null and b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/model/Todo.class differ diff --git a/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/security/SecurityConfiguration.class b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/security/SecurityConfiguration.class new file mode 100644 index 0000000..abff7b5 Binary files /dev/null and b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/security/SecurityConfiguration.class differ diff --git a/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/service/TodoRepository.class b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/service/TodoRepository.class new file mode 100644 index 0000000..2ec3721 Binary files /dev/null and b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/service/TodoRepository.class differ diff --git a/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/service/TodoService.class b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/service/TodoService.class new file mode 100644 index 0000000..c89012d Binary files /dev/null and b/03-todo-web-application-mysql/target/classes/com/in28minutes/springboot/web/service/TodoService.class differ diff --git a/03-todo-web-application-mysql/target/test-classes/application.properties b/03-todo-web-application-mysql/target/test-classes/application.properties new file mode 100644 index 0000000..e9c1ca3 --- /dev/null +++ b/03-todo-web-application-mysql/target/test-classes/application.properties @@ -0,0 +1,5 @@ +spring.jpa.hibernate.ddl-auto=create-drop +spring.datasource.driver-class-name=org.h2.Driver +spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1 +spring.datasource.username=sa +spring.datasource.password=sa diff --git a/03-todo-web-application-mysql/target/test-classes/com/in28minutes/springboot/web/SpringBootFirstWebApplicationTests.class b/03-todo-web-application-mysql/target/test-classes/com/in28minutes/springboot/web/SpringBootFirstWebApplicationTests.class new file mode 100644 index 0000000..450afd4 Binary files /dev/null and b/03-todo-web-application-mysql/target/test-classes/com/in28minutes/springboot/web/SpringBootFirstWebApplicationTests.class differ diff --git a/hello-world-java/target/classes/application.properties b/hello-world-java/target/classes/application.properties new file mode 100644 index 0000000..975d0b0 --- /dev/null +++ b/hello-world-java/target/classes/application.properties @@ -0,0 +1,2 @@ +logging.level.org.springframework = debug +server.port = 5000 \ No newline at end of file diff --git a/hello-world-java/target/classes/com/in28minutes/rest/webservices/restfulwebservices/HelloWorldController.class b/hello-world-java/target/classes/com/in28minutes/rest/webservices/restfulwebservices/HelloWorldController.class new file mode 100644 index 0000000..45372d2 Binary files /dev/null and b/hello-world-java/target/classes/com/in28minutes/rest/webservices/restfulwebservices/HelloWorldController.class differ diff --git a/hello-world-java/target/classes/com/in28minutes/rest/webservices/restfulwebservices/RestfulWebServicesApplication.class b/hello-world-java/target/classes/com/in28minutes/rest/webservices/restfulwebservices/RestfulWebServicesApplication.class new file mode 100644 index 0000000..c9b9069 Binary files /dev/null and b/hello-world-java/target/classes/com/in28minutes/rest/webservices/restfulwebservices/RestfulWebServicesApplication.class differ diff --git a/hello-world-java/target/test-classes/com/in28minutes/rest/webservices/restfulwebservices/RestfulWebServicesApplicationTests.class b/hello-world-java/target/test-classes/com/in28minutes/rest/webservices/restfulwebservices/RestfulWebServicesApplicationTests.class new file mode 100644 index 0000000..d115fb1 Binary files /dev/null and b/hello-world-java/target/test-classes/com/in28minutes/rest/webservices/restfulwebservices/RestfulWebServicesApplicationTests.class differ diff --git a/pay-app-spring-microservices/app-config/gradle/wrapper/gradle-wrapper.jar b/pay-app-spring-microservices/app-config/gradle/wrapper/gradle-wrapper.jar index e708b1c..41d9927 100644 Binary files a/pay-app-spring-microservices/app-config/gradle/wrapper/gradle-wrapper.jar and b/pay-app-spring-microservices/app-config/gradle/wrapper/gradle-wrapper.jar differ diff --git a/pay-app-spring-microservices/app-config/gradle/wrapper/gradle-wrapper.properties b/pay-app-spring-microservices/app-config/gradle/wrapper/gradle-wrapper.properties index 549d844..aa991fc 100644 --- a/pay-app-spring-microservices/app-config/gradle/wrapper/gradle-wrapper.properties +++ b/pay-app-spring-microservices/app-config/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/pay-app-spring-microservices/app-config/gradlew b/pay-app-spring-microservices/app-config/gradlew index 8f89047..1b6c787 100644 --- a/pay-app-spring-microservices/app-config/gradlew +++ b/pay-app-spring-microservices/app-config/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,168 +17,218 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ]; do - ls=$(ls -ld "$PRG") - link=$(expr "$ls" : '.*-> \(.*\)$') - if expr "$link" : '/.*' >/dev/null; then - PRG="$link" - else - PRG=$(dirname "$PRG")"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="$(pwd)" -cd "$(dirname \"$PRG\")/" >/dev/null -APP_HOME="$(pwd -P)" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=$(basename "$0") +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum -warn() { - echo "$*" -} +warn () { + echo "$*" +} >&2 -die() { - echo - echo "$*" - echo - exit 1 -} +die () { + echo + echo "$*" + echo + exit 1 +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "$(uname)" in -CYGWIN*) - cygwin=true - ;; -Darwin*) - darwin=true - ;; -MINGW*) - msys=true - ;; -NONSTOP*) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ]; then - if [ -x "$JAVA_HOME/jre/sh/java" ]; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ]; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." - fi + fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ]; then - MAX_FD_LIMIT=$(ulimit -H -n) - if [ $? -eq 0 ]; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ]; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ]; then - APP_HOME=$(cygpath --path --mixed "$APP_HOME") - CLASSPATH=$(cygpath --path --mixed "$CLASSPATH") - - JAVACMD=$(cygpath --unix "$JAVACMD") - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=$(find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null) - SEP="" - for dir in $ROOTDIRSRAW; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ]; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@"; do - CHECK=$(echo "$arg" | egrep -c "$OURCYGPATTERN" -) - CHECK2=$(echo "$arg" | egrep -c "^-") ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ]; then ### Added a condition - eval $(echo args$i)=$(cygpath --path --ignore --mixed "$arg") - else - eval $(echo args$i)="\"$arg\"" - fi - i=$(expr $i + 1) - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done fi -# Escape application args -save() { - for i; do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/"; done - echo " " -} -APP_ARGS=$(save "$@") +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/pay-app-spring-microservices/app-config/src/main/resources/application.properties b/pay-app-spring-microservices/app-config/src/main/resources/application.properties index 7fd2213..d37fe82 100644 --- a/pay-app-spring-microservices/app-config/src/main/resources/application.properties +++ b/pay-app-spring-microservices/app-config/src/main/resources/application.properties @@ -3,13 +3,13 @@ spring.application.name=app-config server.port=8888 # Config -spring.cloud.config.server.git.uri=https://github.com/icesi-ops/training_microservices.git +spring.cloud.config.server.git.uri=https://github.com/Xoten/training_microservices spring.cloud.config.server.default-label=master spring.cloud.config.server.git.search-paths=pay-app-spring-microservices/config spring.cloud.config.server.git.skip-ssl-validation=true -# Consul -spring.cloud.consul.host=consul -spring.cloud.consul.port=8500 -spring.cloud.consul.discovery.health-check-interval=5s -spring.cloud.consul.discovery.prefer-ip-address=true \ No newline at end of file + # Consul + spring.cloud.consul.host=consul + spring.cloud.consul.port=8500 + spring.cloud.consul.discovery.health-check-interval=5s + spring.cloud.consul.discovery.prefer-ip-address=true \ No newline at end of file diff --git a/pay-app-spring-microservices/app-invoice/build.gradle b/pay-app-spring-microservices/app-invoice/build.gradle index 76d0556..dfdc9e8 100644 --- a/pay-app-spring-microservices/app-invoice/build.gradle +++ b/pay-app-spring-microservices/app-invoice/build.gradle @@ -28,6 +28,8 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.kafka:spring-kafka' implementation 'org.springframework.cloud:spring-cloud-starter-config' + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springframework.cloud:spring-cloud-starter-consul-discovery' compileOnly 'org.projectlombok:lombok' runtimeOnly 'org.postgresql:postgresql' diff --git a/pay-app-spring-microservices/app-invoice/gradle/wrapper/gradle-wrapper.jar b/pay-app-spring-microservices/app-invoice/gradle/wrapper/gradle-wrapper.jar index e708b1c..41d9927 100644 Binary files a/pay-app-spring-microservices/app-invoice/gradle/wrapper/gradle-wrapper.jar and b/pay-app-spring-microservices/app-invoice/gradle/wrapper/gradle-wrapper.jar differ diff --git a/pay-app-spring-microservices/app-invoice/gradle/wrapper/gradle-wrapper.properties b/pay-app-spring-microservices/app-invoice/gradle/wrapper/gradle-wrapper.properties index 549d844..aa991fc 100644 --- a/pay-app-spring-microservices/app-invoice/gradle/wrapper/gradle-wrapper.properties +++ b/pay-app-spring-microservices/app-invoice/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/pay-app-spring-microservices/app-invoice/gradlew b/pay-app-spring-microservices/app-invoice/gradlew index 8f89047..1b6c787 100644 --- a/pay-app-spring-microservices/app-invoice/gradlew +++ b/pay-app-spring-microservices/app-invoice/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,168 +17,218 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ]; do - ls=$(ls -ld "$PRG") - link=$(expr "$ls" : '.*-> \(.*\)$') - if expr "$link" : '/.*' >/dev/null; then - PRG="$link" - else - PRG=$(dirname "$PRG")"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="$(pwd)" -cd "$(dirname \"$PRG\")/" >/dev/null -APP_HOME="$(pwd -P)" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=$(basename "$0") +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum -warn() { - echo "$*" -} +warn () { + echo "$*" +} >&2 -die() { - echo - echo "$*" - echo - exit 1 -} +die () { + echo + echo "$*" + echo + exit 1 +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "$(uname)" in -CYGWIN*) - cygwin=true - ;; -Darwin*) - darwin=true - ;; -MINGW*) - msys=true - ;; -NONSTOP*) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ]; then - if [ -x "$JAVA_HOME/jre/sh/java" ]; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ]; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." - fi + fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ]; then - MAX_FD_LIMIT=$(ulimit -H -n) - if [ $? -eq 0 ]; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ]; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ]; then - APP_HOME=$(cygpath --path --mixed "$APP_HOME") - CLASSPATH=$(cygpath --path --mixed "$CLASSPATH") - - JAVACMD=$(cygpath --unix "$JAVACMD") - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=$(find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null) - SEP="" - for dir in $ROOTDIRSRAW; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ]; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@"; do - CHECK=$(echo "$arg" | egrep -c "$OURCYGPATTERN" -) - CHECK2=$(echo "$arg" | egrep -c "^-") ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ]; then ### Added a condition - eval $(echo args$i)=$(cygpath --path --ignore --mixed "$arg") - else - eval $(echo args$i)="\"$arg\"" - fi - i=$(expr $i + 1) - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done fi -# Escape application args -save() { - for i; do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/"; done - echo " " -} -APP_ARGS=$(save "$@") +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/pay-app-spring-microservices/app-invoice/src/main/resources/application.properties b/pay-app-spring-microservices/app-invoice/src/main/resources/application.properties index 8b13789..cc4f2ac 100644 --- a/pay-app-spring-microservices/app-invoice/src/main/resources/application.properties +++ b/pay-app-spring-microservices/app-invoice/src/main/resources/application.properties @@ -1 +1,8 @@ + # Consul + #spring.cloud.consul.host=consul + #spring.cloud.consul.port=8500 + #spring.cloud.consul.discovery.health-check-interval=5s + #spring.cloud.consul.discovery.prefer-ip-address=true + #management.endpoints.web.exposure.include=health + diff --git a/pay-app-spring-microservices/app-invoice/src/main/resources/bootstrap.properties b/pay-app-spring-microservices/app-invoice/src/main/resources/bootstrap.properties index b254c68..2270419 100644 --- a/pay-app-spring-microservices/app-invoice/src/main/resources/bootstrap.properties +++ b/pay-app-spring-microservices/app-invoice/src/main/resources/bootstrap.properties @@ -1,3 +1,4 @@ spring.application.name=app-invoice spring.profiles.active=dev spring.cloud.config.uri=http://app-config:8888 + diff --git a/pay-app-spring-microservices/app-pay/build.gradle b/pay-app-spring-microservices/app-pay/build.gradle index fdaf2e0..ae3921e 100644 --- a/pay-app-spring-microservices/app-pay/build.gradle +++ b/pay-app-spring-microservices/app-pay/build.gradle @@ -28,6 +28,8 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.kafka:spring-kafka' implementation 'org.springframework.cloud:spring-cloud-starter-config' + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springframework.cloud:spring-cloud-starter-consul-discovery' compileOnly 'org.projectlombok:lombok' runtimeOnly 'mysql:mysql-connector-java' annotationProcessor 'org.projectlombok:lombok' diff --git a/pay-app-spring-microservices/app-pay/gradle/wrapper/gradle-wrapper.jar b/pay-app-spring-microservices/app-pay/gradle/wrapper/gradle-wrapper.jar index e708b1c..41d9927 100644 Binary files a/pay-app-spring-microservices/app-pay/gradle/wrapper/gradle-wrapper.jar and b/pay-app-spring-microservices/app-pay/gradle/wrapper/gradle-wrapper.jar differ diff --git a/pay-app-spring-microservices/app-pay/gradle/wrapper/gradle-wrapper.properties b/pay-app-spring-microservices/app-pay/gradle/wrapper/gradle-wrapper.properties index 549d844..aa991fc 100644 --- a/pay-app-spring-microservices/app-pay/gradle/wrapper/gradle-wrapper.properties +++ b/pay-app-spring-microservices/app-pay/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/pay-app-spring-microservices/app-pay/gradlew b/pay-app-spring-microservices/app-pay/gradlew index 8f89047..1b6c787 100644 --- a/pay-app-spring-microservices/app-pay/gradlew +++ b/pay-app-spring-microservices/app-pay/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,168 +17,218 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ]; do - ls=$(ls -ld "$PRG") - link=$(expr "$ls" : '.*-> \(.*\)$') - if expr "$link" : '/.*' >/dev/null; then - PRG="$link" - else - PRG=$(dirname "$PRG")"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="$(pwd)" -cd "$(dirname \"$PRG\")/" >/dev/null -APP_HOME="$(pwd -P)" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=$(basename "$0") +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum -warn() { - echo "$*" -} +warn () { + echo "$*" +} >&2 -die() { - echo - echo "$*" - echo - exit 1 -} +die () { + echo + echo "$*" + echo + exit 1 +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "$(uname)" in -CYGWIN*) - cygwin=true - ;; -Darwin*) - darwin=true - ;; -MINGW*) - msys=true - ;; -NONSTOP*) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ]; then - if [ -x "$JAVA_HOME/jre/sh/java" ]; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ]; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." - fi + fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ]; then - MAX_FD_LIMIT=$(ulimit -H -n) - if [ $? -eq 0 ]; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ]; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ]; then - APP_HOME=$(cygpath --path --mixed "$APP_HOME") - CLASSPATH=$(cygpath --path --mixed "$CLASSPATH") - - JAVACMD=$(cygpath --unix "$JAVACMD") - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=$(find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null) - SEP="" - for dir in $ROOTDIRSRAW; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ]; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@"; do - CHECK=$(echo "$arg" | egrep -c "$OURCYGPATTERN" -) - CHECK2=$(echo "$arg" | egrep -c "^-") ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ]; then ### Added a condition - eval $(echo args$i)=$(cygpath --path --ignore --mixed "$arg") - else - eval $(echo args$i)="\"$arg\"" - fi - i=$(expr $i + 1) - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done fi -# Escape application args -save() { - for i; do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/"; done - echo " " -} -APP_ARGS=$(save "$@") +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/pay-app-spring-microservices/app-pay/src/main/resources/application.properties b/pay-app-spring-microservices/app-pay/src/main/resources/application.properties index 8b13789..13e2212 100644 --- a/pay-app-spring-microservices/app-pay/src/main/resources/application.properties +++ b/pay-app-spring-microservices/app-pay/src/main/resources/application.properties @@ -1 +1,7 @@ + # Consul + #spring.cloud.consul.host=consul + #spring.cloud.consul.port=8500 + #spring.cloud.consul.discovery.health-check-interval=5s + #spring.cloud.consul.discovery.prefer-ip-address=true + #management.endpoints.web.exposure.include=health \ No newline at end of file diff --git a/pay-app-spring-microservices/app-transaction/build.gradle b/pay-app-spring-microservices/app-transaction/build.gradle index 1ca3403..ac8f151 100644 --- a/pay-app-spring-microservices/app-transaction/build.gradle +++ b/pay-app-spring-microservices/app-transaction/build.gradle @@ -27,6 +27,8 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.kafka:spring-kafka' implementation 'org.springframework.cloud:spring-cloud-starter-config' + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springframework.cloud:spring-cloud-starter-consul-discovery' compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' diff --git a/pay-app-spring-microservices/app-transaction/gradle/wrapper/gradle-wrapper.jar b/pay-app-spring-microservices/app-transaction/gradle/wrapper/gradle-wrapper.jar index e708b1c..41d9927 100644 Binary files a/pay-app-spring-microservices/app-transaction/gradle/wrapper/gradle-wrapper.jar and b/pay-app-spring-microservices/app-transaction/gradle/wrapper/gradle-wrapper.jar differ diff --git a/pay-app-spring-microservices/app-transaction/gradle/wrapper/gradle-wrapper.properties b/pay-app-spring-microservices/app-transaction/gradle/wrapper/gradle-wrapper.properties index 549d844..aa991fc 100644 --- a/pay-app-spring-microservices/app-transaction/gradle/wrapper/gradle-wrapper.properties +++ b/pay-app-spring-microservices/app-transaction/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/pay-app-spring-microservices/app-transaction/gradlew b/pay-app-spring-microservices/app-transaction/gradlew index 8f89047..1b6c787 100644 --- a/pay-app-spring-microservices/app-transaction/gradlew +++ b/pay-app-spring-microservices/app-transaction/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,168 +17,218 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ]; do - ls=$(ls -ld "$PRG") - link=$(expr "$ls" : '.*-> \(.*\)$') - if expr "$link" : '/.*' >/dev/null; then - PRG="$link" - else - PRG=$(dirname "$PRG")"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="$(pwd)" -cd "$(dirname \"$PRG\")/" >/dev/null -APP_HOME="$(pwd -P)" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=$(basename "$0") +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum -warn() { - echo "$*" -} +warn () { + echo "$*" +} >&2 -die() { - echo - echo "$*" - echo - exit 1 -} +die () { + echo + echo "$*" + echo + exit 1 +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "$(uname)" in -CYGWIN*) - cygwin=true - ;; -Darwin*) - darwin=true - ;; -MINGW*) - msys=true - ;; -NONSTOP*) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ]; then - if [ -x "$JAVA_HOME/jre/sh/java" ]; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ]; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." - fi + fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ]; then - MAX_FD_LIMIT=$(ulimit -H -n) - if [ $? -eq 0 ]; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ]; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ]; then - APP_HOME=$(cygpath --path --mixed "$APP_HOME") - CLASSPATH=$(cygpath --path --mixed "$CLASSPATH") - - JAVACMD=$(cygpath --unix "$JAVACMD") - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=$(find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null) - SEP="" - for dir in $ROOTDIRSRAW; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ]; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@"; do - CHECK=$(echo "$arg" | egrep -c "$OURCYGPATTERN" -) - CHECK2=$(echo "$arg" | egrep -c "^-") ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ]; then ### Added a condition - eval $(echo args$i)=$(cygpath --path --ignore --mixed "$arg") - else - eval $(echo args$i)="\"$arg\"" - fi - i=$(expr $i + 1) - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done fi -# Escape application args -save() { - for i; do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/"; done - echo " " -} -APP_ARGS=$(save "$@") +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/pay-app-spring-microservices/app-transaction/src/main/resources/application.properties b/pay-app-spring-microservices/app-transaction/src/main/resources/application.properties index 8b13789..3395c53 100644 --- a/pay-app-spring-microservices/app-transaction/src/main/resources/application.properties +++ b/pay-app-spring-microservices/app-transaction/src/main/resources/application.properties @@ -1 +1,7 @@ + # Consul + #spring.cloud.consul.host=consul + #spring.cloud.consul.port=8500 + #spring.cloud.consul.discovery.health-check-interval=5s + #spring.cloud.consul.discovery.prefer-ip-address=true + #management.endpoints.web.exposure.include=health \ No newline at end of file diff --git a/pay-app-spring-microservices/appgw/gateway.config.yml b/pay-app-spring-microservices/appgw/gateway.config.yml index 1a7f68b..e50a175 100644 --- a/pay-app-spring-microservices/appgw/gateway.config.yml +++ b/pay-app-spring-microservices/appgw/gateway.config.yml @@ -3,13 +3,31 @@ http: admin: port: 9876 host: localhost + apiEndpoints: appconfig: host: localhost paths: ['/config','/config/*'] + appinvoice: + host: localhost + paths: ['/invoice','/invoice/*'] + apppay: + host: localhost + paths: ['/pay','/pay/*'] + apptransaction: + host: localhost + paths: ['/transaction','/transaction/*'] + serviceEndpoints: appconfig: - url: 'http://loadbalancer/config/' + url: 'http://loadbalancer/config/' + apppay: + url: 'http://loadbalancer/pay/' + appinvoice: + url: 'http://loadbalancer/invoice/all/' + apptransaction: + url: 'http://loadbalancer/transaction/all/' + policies: - basic-auth - cors @@ -19,17 +37,53 @@ policies: - oauth2 - proxy - rate-limit + pipelines: - default: + pipeline1: apiEndpoints: - appconfig policies: - # Uncomment `key-auth:` when instructed to in the Getting Started guide. - - key-auth: + - key-auth: # Agrega las opciones según tus necesidades para autenticación por clave + - proxy: + - action: + serviceEndpoint: appconfig + changeOrigin: true + prependPath: false + ignorePath: false + stripPath: false + pipeline2: + apiEndpoints: + - appinvoice + policies: + #- key-auth: # Agrega las opciones según tus necesidades para autenticación por clave + - proxy: + - action: + serviceEndpoint: appinvoice + changeOrigin: true + prependPath: false + ignorePath: false + stripPath: false + pipeline3: + apiEndpoints: + - apppay + policies: + #- key-auth: # Agrega las opciones según tus necesidades para autenticación por clave - proxy: - action: - serviceEndpoint: appconfig + serviceEndpoint: apppay changeOrigin: true prependPath: false ignorePath: false stripPath: false + pipeline4: + apiEndpoints: + - apptransaction + policies: + #- key-auth: # Agrega las opciones según tus necesidades para autenticación por clave + - proxy: + - action: + serviceEndpoint: apptransaction + changeOrigin: true + prependPath: false + ignorePath: false + stripPath: false \ No newline at end of file diff --git a/pay-app-spring-microservices/config/app-invoice-dev.properties b/pay-app-spring-microservices/config/app-invoice-dev.properties index 23d5f14..ec3ed2b 100644 --- a/pay-app-spring-microservices/config/app-invoice-dev.properties +++ b/pay-app-spring-microservices/config/app-invoice-dev.properties @@ -1,12 +1,18 @@ # Server spring.application.name=app-invoice server.port=8006 - +#Consul +spring.cloud.consul.host=consul +spring.cloud.consul.port=8500 +spring.cloud.consul.discovery.health-check-interval=5s +spring.cloud.consul.discovery.prefer-ip-address=true +management.endpoints.web.exposure.include=health + # Kafka spring.kafka.consumer.bootstrap-servers=servicekafka:9092 -spring.kafka.consumer.bootstrap-servers=servicekafka:9092 -spring.kafka.admin.properties.bootstrap.servers=servicekafka:9092 +#spring.kafka.consumer.bootstrap-servers=servicekafka:9092 spring.kafka.admin.properties.bootstrap.servers=servicekafka:9092 +#spring.kafka.admin.properties.bootstrap.servers=servicekafka:9092 spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.IntegerDeserializer spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer spring.kafka.consumer.group-id=invoice-events-listener-group @@ -22,10 +28,4 @@ spring.datasource.url=jdbc:postgresql://postgres:5432/db_invoice spring.datasource.username=postgres spring.datasource.password=postgres spring.datasource.driver-class-name=org.postgresql.Driver -spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL95Dialect - -# Consul -spring.cloud.consul.host=consul -spring.cloud.consul.port=8500 -spring.cloud.consul.discovery.health-check-interval=5s -spring.cloud.consul.discovery.prefer-ip-address=true +spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL95Dialect \ No newline at end of file diff --git a/pay-app-spring-microservices/config/app-pay-dev.properties b/pay-app-spring-microservices/config/app-pay-dev.properties index b7959d8..8bbef76 100644 --- a/pay-app-spring-microservices/config/app-pay-dev.properties +++ b/pay-app-spring-microservices/config/app-pay-dev.properties @@ -1,7 +1,12 @@ # Server spring.application.name=app-pay server.port=8010 - +#Consul + spring.cloud.consul.host=consul + spring.cloud.consul.port=8500 + spring.cloud.consul.discovery.health-check-interval=5s + spring.cloud.consul.discovery.prefer-ip-address=true + management.endpoints.web.exposure.include=health # Kafka spring.kafka.template.default-topic=transaction-events spring.kafka.producer.bootstrap-servers=servicekafka:9092 diff --git a/pay-app-spring-microservices/config/app-transaction-dev.properties b/pay-app-spring-microservices/config/app-transaction-dev.properties index 17d29f4..e56edc8 100644 --- a/pay-app-spring-microservices/config/app-transaction-dev.properties +++ b/pay-app-spring-microservices/config/app-transaction-dev.properties @@ -2,6 +2,12 @@ spring.application.name=app-transaction server.port=8082 +#Consul +spring.cloud.consul.host=consul +spring.cloud.consul.port=8500 +spring.cloud.consul.discovery.health-check-interval=5s +spring.cloud.consul.discovery.prefer-ip-address=true +management.endpoints.web.exposure.include=health # Kafka spring.kafka.consumer.bootstrap-servers=servicekafka:9092 #spring.kafka.consumer.bootstrap-servers=servicekafka:9092 diff --git a/pay-app-spring-microservices/haproxy/haproxy.cfg b/pay-app-spring-microservices/haproxy/haproxy.cfg index 3b54b0c..4b4c497 100644 --- a/pay-app-spring-microservices/haproxy/haproxy.cfg +++ b/pay-app-spring-microservices/haproxy/haproxy.cfg @@ -14,7 +14,13 @@ frontend http_front bind *:80 mode http acl url_config path_beg /config + acl url_invoice path_beg /invoice + acl url_pay path_beg /pay + acl url_transaction path_beg /transaction use_backend config_back if url_config + use_backend invoice_back if url_invoice + use_backend pay_back if url_pay + use_backend transaction_back if url_transaction default_backend http_back @@ -23,6 +29,25 @@ backend config_back balance roundrobin http-request set-path "%[path,regsub(^/config/,/)]" server appconfig app-config.service.consul:8888 resolvers consul resolve-prefer ipv4 check + +backend invoice_back + mode http + balance roundrobin + http-request set-path "%[path,regsub(^/invoice/,/)]" + server appinvoice app-invoice.service.consul:8006 resolvers consul resolve-prefer ipv4 check + +backend pay_back + mode http + balance roundrobin + http-request set-path "%[path,regsub(^/pay/,/)]" + server apppay app-pay.service.consul:8010 resolvers consul resolve-prefer ipv4 check + +backend transaction_back + mode http + balance roundrobin + http-request set-path "%[path,regsub(^/transaction/,/)]" + server apptransaction app-transaction.service.consul:8082 resolvers consul resolve-prefer ipv4 check + backend http_back mode http balance roundrobin diff --git a/pay-app-spring-microservices/resources/INFO.md b/pay-app-spring-microservices/resources/INFO.md index 7bfc0c1..4d0c56a 100644 --- a/pay-app-spring-microservices/resources/INFO.md +++ b/pay-app-spring-microservices/resources/INFO.md @@ -48,7 +48,7 @@ Microservicio que se encarga de obtener los mensajes de kafka y actualizar el es * Curl del servicio para obtener el detalle de todos los invoices ``` -curl --location --request GET 'http://localhost:8006/all' +curl --location --request GET 'dig' ``` #### app-transaction