├── .env ├── common ├── .gitignore ├── dto │ ├── .gitignore │ ├── readme.md │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── ubaid │ │ └── ms │ │ └── common │ │ └── dto │ │ ├── serviceinfo │ │ ├── Git.java │ │ ├── Commit.java │ │ └── ServiceInformation.java │ │ ├── auth │ │ └── LoginCred.java │ │ ├── Rate.java │ │ ├── ValueDTO.java │ │ ├── CurrencyInfoDTO.java │ │ ├── ExceptionDTO.java │ │ ├── CountryCodeDTO.java │ │ ├── ExchangeRateDTO.java │ │ ├── AuditDTO.java │ │ └── ExchangeValueDTO.java ├── util │ ├── .gitignore │ └── pom.xml ├── exception │ ├── .gitignore │ ├── readme.md │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── ubaid │ │ │ └── ms │ │ │ └── common │ │ │ └── util │ │ │ └── exception │ │ │ ├── CCException.java │ │ │ └── ExchangeValueNotFound.java │ └── pom.xml ├── readme.md └── pom.xml ├── audit ├── src │ ├── main │ │ ├── resources │ │ │ ├── config.properties │ │ │ ├── db │ │ │ │ └── migration │ │ │ │ │ ├── V2__gh_360_replace_float_with_double.sql │ │ │ │ │ └── V1__gh_301_create_audit_table.sql │ │ │ ├── application-dev.properties │ │ │ ├── application-prod.properties │ │ │ ├── application.properties │ │ │ └── application-local.properties │ │ └── java │ │ │ └── com │ │ │ └── ubaid │ │ │ └── ms │ │ │ ├── audit │ │ │ ├── service │ │ │ │ ├── InfoService.java │ │ │ │ ├── AuditService.java │ │ │ │ └── InfoServiceImpl.java │ │ │ ├── config │ │ │ │ ├── MessageBrokerConfig.java │ │ │ │ └── Beans.java │ │ │ ├── dao │ │ │ │ └── AuditDAO.java │ │ │ ├── controller │ │ │ │ └── InfoController.java │ │ │ ├── entity │ │ │ │ └── Audit.java │ │ │ └── listener │ │ │ │ └── ListenAuditLogs.java │ │ │ └── AuditApplication.java │ └── test │ │ └── java │ │ └── com │ │ └── ubaid │ │ └── ms │ │ └── auditservice │ │ └── AuditApplicationTests.java ├── .dockerignore ├── Dockerfile.multistage ├── .gitignore └── readme.md ├── math ├── src │ └── main │ │ ├── resources │ │ ├── config.properties │ │ ├── application-dev.properties │ │ ├── application-prod.properties │ │ ├── application.properties │ │ └── application-local.properties │ │ └── java │ │ └── com │ │ └── ubaid │ │ └── ms │ │ └── math │ │ ├── service │ │ ├── ServerInfoService.java │ │ ├── InfoService.java │ │ ├── MathService.java │ │ ├── MathServiceImp.java │ │ └── InfoServiceImpl.java │ │ ├── aop │ │ └── TargetMethods.java │ │ ├── config │ │ ├── Beans.java │ │ └── validator │ │ │ └── AudienceValidator.java │ │ ├── MathApplication.java │ │ └── controller │ │ ├── InfoController.java │ │ └── ExceptionController.java ├── .dockerignore ├── .gitignore ├── Dockerfile.multistage └── readme.md ├── user ├── src │ ├── main │ │ ├── resources │ │ │ ├── config.properties │ │ │ ├── application-dev.properties │ │ │ ├── application-prod.properties │ │ │ ├── application.properties │ │ │ └── application-local.properties │ │ └── java │ │ │ └── com │ │ │ └── ubaid │ │ │ └── ms │ │ │ ├── user │ │ │ ├── service │ │ │ │ ├── InfoService.java │ │ │ │ ├── AccessTokenService.java │ │ │ │ ├── AccessTokenServiceImpl.java │ │ │ │ └── InfoServiceImpl.java │ │ │ ├── aop │ │ │ │ └── TargetMethods.java │ │ │ ├── config │ │ │ │ └── Beans.java │ │ │ ├── controller │ │ │ │ ├── InfoController.java │ │ │ │ └── UserServiceController.java │ │ │ ├── advice │ │ │ │ └── ExceptionHandlerController.java │ │ │ └── feignproxy │ │ │ │ └── AuthTokenServiceProxy.java │ │ │ └── UserApp.java │ └── test │ │ └── java │ │ └── com │ │ └── ubaid │ │ └── ms │ │ └── userservice │ │ └── UserAppTests.java ├── .dockerignore ├── Dockerfile.multistage ├── .gitignore └── readme.md ├── api-gateway ├── src │ └── main │ │ ├── resources │ │ ├── config.properties │ │ ├── application-dev.properties │ │ ├── application-prod.properties │ │ ├── application.properties │ │ └── application-local.properties │ │ └── java │ │ └── com │ │ └── ubaid │ │ └── ms │ │ └── apigateway │ │ ├── services │ │ ├── InfoService.java │ │ └── InfoServiceImpl.java │ │ ├── config │ │ ├── Beans.java │ │ ├── readme.md │ │ └── SwaggerConfig.java │ │ ├── ApiGateway.java │ │ └── controller │ │ ├── IndexController.java │ │ └── InformationController.java ├── .dockerignore ├── .gitignore ├── Dockerfile.multistage └── readme.md ├── country ├── src │ ├── main │ │ ├── resources │ │ │ ├── config.properties │ │ │ ├── db │ │ │ │ └── changelog │ │ │ │ │ ├── db.changelog-master.yaml │ │ │ │ │ └── changes │ │ │ │ │ ├── v0002.sql │ │ │ │ │ ├── v0004-add_column_in_country_code_table.sql │ │ │ │ │ ├── v0005-updating_iso_column_to_integer.sql │ │ │ │ │ ├── v0005a-correcting_iso_column_to10_varchar.sql │ │ │ │ │ └── v0001.sql │ │ │ ├── application-dev.properties │ │ │ ├── application-prod.properties │ │ │ ├── application-local.properties │ │ │ └── application.properties │ │ └── java │ │ │ └── com │ │ │ └── ubaid │ │ │ └── ms │ │ │ ├── country │ │ │ ├── service │ │ │ │ ├── InfoService.java │ │ │ │ ├── CountryCodeService.java │ │ │ │ ├── InfoServiceImpl.java │ │ │ │ └── CountryCodeServiceImp.java │ │ │ ├── dao │ │ │ │ └── CountryCodeDAO.java │ │ │ ├── aop │ │ │ │ └── TargetMethods.java │ │ │ ├── config │ │ │ │ ├── Beans.java │ │ │ │ └── validator │ │ │ │ │ └── AudienceValidator.java │ │ │ ├── entity │ │ │ │ └── CountryCode.java │ │ │ ├── controller │ │ │ │ ├── InfoController.java │ │ │ │ └── CountryController.java │ │ │ └── advice │ │ │ │ └── ExceptionController.java │ │ │ └── CountryApplication.java │ └── test │ │ ├── java │ │ └── com │ │ │ └── ubaid │ │ │ └── ms │ │ │ └── counteryservice │ │ │ └── CountryApplicationTests.java │ │ └── resources │ │ └── application.properties ├── .dockerignore ├── Dockerfile.multistage ├── .gitignore └── readme.md ├── currency-conversion ├── runAllTests.sh ├── src │ ├── main │ │ ├── resources │ │ │ ├── config.properties │ │ │ ├── application-prod.properties │ │ │ ├── application-dev.properties │ │ │ ├── application-local.properties │ │ │ └── application.properties │ │ └── java │ │ │ └── com │ │ │ └── ubaid │ │ │ └── ms │ │ │ ├── currencyconversion │ │ │ ├── service │ │ │ │ ├── RequestService.java │ │ │ │ ├── AuditService.java │ │ │ │ ├── InfoService.java │ │ │ │ ├── AuthService.java │ │ │ │ ├── CurrencyConversionService.java │ │ │ │ ├── AuditServiceImpl.java │ │ │ │ └── InfoServiceImpl.java │ │ │ ├── entity │ │ │ │ └── Limit.java │ │ │ ├── aop │ │ │ │ └── TargetMethods.java │ │ │ ├── util │ │ │ │ └── BearerToken.java │ │ │ ├── config │ │ │ │ ├── MessageBrokerConfig.java │ │ │ │ ├── Beans.java │ │ │ │ └── Config.java │ │ │ ├── controller │ │ │ │ └── InfoController.java │ │ │ ├── feignProxy │ │ │ │ ├── CurrencyExchangeServiceProxy.java │ │ │ │ └── CurrencyConversionServiceProxy.java │ │ │ └── exceptionController │ │ │ │ └── ExceptionController.java │ │ │ └── CurrencyConversionApp.java │ └── test │ │ └── resources │ │ ├── config.properties │ │ └── application.properties ├── .dockerignore ├── .gitignore └── Dockerfile.multistage ├── clients ├── 3cn-react-client │ ├── .env.dev │ ├── .env.prod │ ├── src │ │ ├── App.css │ │ ├── store │ │ │ ├── actions │ │ │ │ ├── AuthAction.js │ │ │ │ ├── SelectCountryAction.js │ │ │ │ ├── ConvertCurrencyAction.js │ │ │ │ └── PopulateCountryAction.js │ │ │ ├── reducers │ │ │ │ ├── AuthReducer.js │ │ │ │ ├── SelectCountryReducer.js │ │ │ │ ├── ConvertCurrencyReducer.js │ │ │ │ └── PopulateCountryReducer.js │ │ │ └── ActionTypes.js │ │ ├── component │ │ │ ├── down │ │ │ │ └── ServiceDown.js │ │ │ ├── userinfo │ │ │ │ └── UserInfo.js │ │ │ ├── convertionPaper │ │ │ │ └── ConversionPaper.js │ │ │ ├── footer │ │ │ │ └── Footer.js │ │ │ └── auth │ │ │ │ └── Authenticate.js │ │ ├── setupTests.js │ │ ├── index.css │ │ ├── reportWebVitals.js │ │ ├── http │ │ │ └── RequestHandler.js │ │ ├── hoc │ │ │ └── Layout │ │ │ │ └── Layout.js │ │ ├── keycloak.js │ │ ├── App.js │ │ ├── util │ │ │ └── ProtectedRoute.js │ │ └── index.js │ ├── .dockerignore │ ├── public │ │ ├── robots.txt │ │ ├── favicon.ico │ │ ├── logo192.png │ │ ├── logo512.png │ │ ├── keycloak-dev.json │ │ ├── keycloak-local.json │ │ ├── keycloak-prod.json │ │ └── manifest.json │ ├── jsconfig.json │ ├── build-push-prod-ui-image.sh │ ├── README.md │ ├── nginx │ │ └── nginx.conf │ ├── .gitignore │ ├── Dockerfile │ └── .eslintrc.json └── CurrencyConversionReactNativeClient │ ├── .watchmanconfig │ ├── .gitattributes │ ├── .eslintrc.js │ ├── babel.config.js │ ├── app.json │ ├── .buckconfig │ ├── .prettierrc.js │ ├── index.js │ ├── metro.config.js │ ├── App.js │ ├── package.json │ └── .gitignore ├── currency-exchange ├── src │ ├── main │ │ ├── resources │ │ │ ├── config.properties │ │ │ ├── db │ │ │ │ └── changelog │ │ │ │ │ ├── db.changelog-master.yaml │ │ │ │ │ └── changes │ │ │ │ │ └── v00001.sql │ │ │ ├── application-dev.properties │ │ │ ├── application-prod.properties │ │ │ ├── application-local.properties │ │ │ └── application.properties │ │ └── java │ │ │ └── com │ │ │ └── ubaid │ │ │ └── ms │ │ │ ├── currencyexchangeservice │ │ │ ├── service │ │ │ │ ├── ServerInfoService.java │ │ │ │ ├── InfoService.java │ │ │ │ ├── ExchangeRateService.java │ │ │ │ └── InfoServiceImpl.java │ │ │ ├── dao │ │ │ │ └── ExchangeRateDAO.java │ │ │ ├── config │ │ │ │ ├── Config.java │ │ │ │ ├── Beans.java │ │ │ │ └── validator │ │ │ │ │ └── AudienceValidator.java │ │ │ ├── aop │ │ │ │ └── TargetMethods.java │ │ │ ├── controller │ │ │ │ ├── InfoController.java │ │ │ │ └── ExceptionController.java │ │ │ ├── entity │ │ │ │ └── ExchangeRate.java │ │ │ └── utility │ │ │ │ └── ExchangeRateDTOConverter.java │ │ │ └── CurrencyExchangeServiceApplication.java │ └── test │ │ ├── java │ │ └── com │ │ │ └── ubaid │ │ │ └── ms │ │ │ ├── currency_conversion_service │ │ │ └── ContextTest.java │ │ │ └── currencyexchangeservice │ │ │ └── utility │ │ │ └── ExchangeRateDTOConverterTest.java │ │ └── resources │ │ └── application.properties ├── .dockerignore ├── .gitignore ├── Dockerfile.multistage └── readme.md ├── envcn ├── db │ ├── init.sql │ └── Dockerfile ├── kc │ └── Dockerfile ├── rabbitmq │ └── Dockerfile ├── zipkin │ └── Dockerfile ├── auth-db │ ├── Dockerfile │ └── buid-push-prod-image.sh ├── .env ├── kibana │ ├── Dockerfile │ └── config │ │ └── kibana.yml ├── logstash │ ├── Dockerfile │ ├── pipeline │ │ └── logstash.conf │ └── config │ │ └── logstash.yml ├── elasticsearch │ ├── Dockerfile │ └── config │ │ └── elasticsearch.yml └── run-multi-stage.sh ├── config ├── .dockerignore ├── src │ └── main │ │ └── resources │ │ ├── application-local.yml │ │ ├── application-dev.yml │ │ ├── application-prod.yml │ │ └── application.yml ├── .gitignore ├── Dockerfile.multistage ├── pom.xml └── readme.md ├── discovery ├── .dockerignore ├── readme.md ├── .gitignore ├── Dockerfile.multistage ├── src │ └── main │ │ └── resources │ │ └── application.properties └── pom.xml ├── resource ├── auth │ ├── img.png │ ├── img_1.png │ ├── auth-flow-v1.png │ ├── 3cn-react-client.png │ ├── 3cn-react-client-access-type.png │ └── auth-flow.md ├── java-home.png ├── create-index.PNG ├── mvn-version.png ├── copy-access-token.png ├── kibana-dashboard.png ├── pase-acces-token.png ├── see-the-response.png ├── definition-drop-down.png ├── how-to-user-swagger.png ├── execute-login-reqeust.png ├── api-composer-swagger-ui-2.png ├── api-composer-swagger-ui.png ├── execute-exchnage-request.png ├── swagger-authorize-request.png ├── country-service-swagger-ui.png ├── country-service-swagger-ui-2.png ├── lucid-diagrams │ └── 3cnArchitecture.png ├── create-index-for-logging.md ├── 3cn-parent-image │ └── readme.md ├── checkstyle │ └── readme.md └── install-require-softwares.md ├── update-3cn-parent-image.sh ├── run-multi-stage.sh ├── .gitignore ├── k8s ├── housekeeping │ ├── delete-all-ingress.sh │ ├── delete-all-configMaps.sh │ ├── delete-all-pv-and-pvc.sh │ ├── delete-all-services.sh │ └── delete-all-deployments.sh ├── k8s-up.sh ├── k8s-down.sh ├── pvcs.yml ├── pvs.yml ├── minikube │ └── install_minikube_kubectl.sh ├── ingress.yml └── docx │ └── readme.md ├── pull-all-microservice-images.sh ├── push-all-microservice-images.sh ├── Dockerfile.3cn-parent-init ├── Dockerfile.update-3cn-parent ├── .github └── workflows │ └── build-checks.yml ├── misc └── docker-compose-postgres.yml ├── LICENSE └── install-maven-jdk17.sh /.env: -------------------------------------------------------------------------------- 1 | APP_VERSION=0.0.3-SNAPSHOT -------------------------------------------------------------------------------- /common/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | /*/*.iml -------------------------------------------------------------------------------- /common/dto/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | /target -------------------------------------------------------------------------------- /audit/src/main/resources/config.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /common/util/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | /target -------------------------------------------------------------------------------- /math/src/main/resources/config.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /user/src/main/resources/config.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /api-gateway/src/main/resources/config.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /country/src/main/resources/config.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /currency-conversion/runAllTests.sh: -------------------------------------------------------------------------------- 1 | mvn clean test -------------------------------------------------------------------------------- /clients/3cn-react-client/.env.dev: -------------------------------------------------------------------------------- 1 | REACT_APP_ENV=dev -------------------------------------------------------------------------------- /clients/3cn-react-client/.env.prod: -------------------------------------------------------------------------------- 1 | REACT_APP_ENV=prod -------------------------------------------------------------------------------- /common/exception/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | *.iml 3 | -------------------------------------------------------------------------------- /currency-conversion/src/main/resources/config.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /currency-conversion/src/test/resources/config.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /currency-exchange/src/main/resources/config.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /envcn/db/init.sql: -------------------------------------------------------------------------------- 1 | create database if not exists audit_db; -------------------------------------------------------------------------------- /clients/CurrencyConversionReactNativeClient/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /envcn/kc/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG KEY_CLOAK 2 | FROM jboss/keycloak:${KEY_CLOAK} -------------------------------------------------------------------------------- /envcn/rabbitmq/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG RABBIT_MQ 2 | FROM rabbitmq:${RABBIT_MQ} -------------------------------------------------------------------------------- /envcn/zipkin/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG ZIPKIN 2 | FROM openzipkin/zipkin:${ZIPKIN} -------------------------------------------------------------------------------- /clients/CurrencyConversionReactNativeClient/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /clients/3cn-react-client/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | -------------------------------------------------------------------------------- /clients/3cn-react-client/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .idea 3 | *.drawio 4 | .gitignore -------------------------------------------------------------------------------- /user/.dockerignore: -------------------------------------------------------------------------------- 1 | /target 2 | .gitignore 3 | user-service.iml 4 | Dockerfile 5 | readme.md -------------------------------------------------------------------------------- /audit/.dockerignore: -------------------------------------------------------------------------------- 1 | .gitignore 2 | audit.iml 3 | Dockerfile 4 | Dockerfile.multistage 5 | /target -------------------------------------------------------------------------------- /envcn/db/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG MY_SQL 2 | FROM mysql:${MY_SQL} 3 | COPY init.sql /docker-entrypoint-initdb.d/ -------------------------------------------------------------------------------- /config/.dockerignore: -------------------------------------------------------------------------------- 1 | /target 2 | .gitignore 3 | *.iml 4 | Dockerfile 5 | Dockerfile.multistage 6 | readme.md -------------------------------------------------------------------------------- /math/.dockerignore: -------------------------------------------------------------------------------- 1 | /target 2 | .gitignore 3 | *.iml 4 | Dockerfile 5 | Dockerfile.multistage 6 | readme.md -------------------------------------------------------------------------------- /discovery/.dockerignore: -------------------------------------------------------------------------------- 1 | /target 2 | .gitignore 3 | *.iml 4 | Dockerfile 5 | Dockerfile.multistage 6 | readme.md -------------------------------------------------------------------------------- /country/.dockerignore: -------------------------------------------------------------------------------- 1 | /target 2 | .gitignore 3 | country.iml 4 | Dockerfile 5 | Dockerfile.multistage 6 | readme.md -------------------------------------------------------------------------------- /resource/auth/img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/auth/img.png -------------------------------------------------------------------------------- /resource/auth/img_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/auth/img_1.png -------------------------------------------------------------------------------- /resource/java-home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/java-home.png -------------------------------------------------------------------------------- /clients/3cn-react-client/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /common/dto/readme.md: -------------------------------------------------------------------------------- 1 | About 2 | ===== 3 | 1. Module which contains the DTOs classes which are shared across the project. -------------------------------------------------------------------------------- /envcn/auth-db/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG MY_SQL 2 | FROM mysql:${MY_SQL} 3 | COPY ./sql/dump.sql /docker-entrypoint-initdb.d/dump.sql -------------------------------------------------------------------------------- /resource/create-index.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/create-index.PNG -------------------------------------------------------------------------------- /resource/mvn-version.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/mvn-version.png -------------------------------------------------------------------------------- /update-3cn-parent-image.sh: -------------------------------------------------------------------------------- 1 | docker build -t ubaidurehman/3cn-parent:0.0.3-SNAPSHOT -f Dockerfile.update-3cn-parent . 2 | -------------------------------------------------------------------------------- /api-gateway/.dockerignore: -------------------------------------------------------------------------------- 1 | /target 2 | .gitignore 3 | *.iml 4 | Dockerfile 5 | Dockerfile.debug 6 | Dockerfile.multistage 7 | readme.md -------------------------------------------------------------------------------- /resource/auth/auth-flow-v1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/auth/auth-flow-v1.png -------------------------------------------------------------------------------- /resource/copy-access-token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/copy-access-token.png -------------------------------------------------------------------------------- /resource/kibana-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/kibana-dashboard.png -------------------------------------------------------------------------------- /resource/pase-acces-token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/pase-acces-token.png -------------------------------------------------------------------------------- /resource/see-the-response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/see-the-response.png -------------------------------------------------------------------------------- /resource/definition-drop-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/definition-drop-down.png -------------------------------------------------------------------------------- /resource/how-to-user-swagger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/how-to-user-swagger.png -------------------------------------------------------------------------------- /currency-conversion/.dockerignore: -------------------------------------------------------------------------------- 1 | /target 2 | .gitignore 3 | *.iml 4 | Dockerfile 5 | Dockerfile.multistage 6 | readme.md 7 | runAllTests.sh -------------------------------------------------------------------------------- /currency-exchange/.dockerignore: -------------------------------------------------------------------------------- 1 | /target 2 | .gitignore 3 | *.iml 4 | Dockerfile 5 | Dockerfile.multistage 6 | Dockerfile.debug 7 | readme.md -------------------------------------------------------------------------------- /resource/auth/3cn-react-client.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/auth/3cn-react-client.png -------------------------------------------------------------------------------- /resource/execute-login-reqeust.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/execute-login-reqeust.png -------------------------------------------------------------------------------- /run-multi-stage.sh: -------------------------------------------------------------------------------- 1 | docker pull ubaidurehman/3cn-parent:0.0.3-SNAPSHOT; 2 | docker-compose -f docker-compose-multi-stage-build.yml up --build; -------------------------------------------------------------------------------- /clients/CurrencyConversionReactNativeClient/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '@react-native-community', 4 | }; 5 | -------------------------------------------------------------------------------- /clients/CurrencyConversionReactNativeClient/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /country/src/main/resources/db/changelog/db.changelog-master.yaml: -------------------------------------------------------------------------------- 1 | databaseChangeLog: 2 | - includeAll: 3 | path: db/changelog/changes -------------------------------------------------------------------------------- /resource/api-composer-swagger-ui-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/api-composer-swagger-ui-2.png -------------------------------------------------------------------------------- /resource/api-composer-swagger-ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/api-composer-swagger-ui.png -------------------------------------------------------------------------------- /resource/execute-exchnage-request.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/execute-exchnage-request.png -------------------------------------------------------------------------------- /resource/swagger-authorize-request.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/swagger-authorize-request.png -------------------------------------------------------------------------------- /clients/3cn-react-client/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "src" 4 | }, 5 | "include": [ 6 | "src" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /common/exception/readme.md: -------------------------------------------------------------------------------- 1 | About 2 | ===== 3 | 1. This is a pure Java module which contains the exception classes which are shared across the application. -------------------------------------------------------------------------------- /envcn/.env: -------------------------------------------------------------------------------- 1 | APP_VERSION=0.0.3-SNAPSHOT 2 | ELK_VERSION=7.17.1 3 | RABBIT_MQ=3.9.13-management 4 | ZIPKIN=2.23.16 5 | MY_SQL=8.0.28 6 | KEY_CLOAK=16.1.1 -------------------------------------------------------------------------------- /resource/country-service-swagger-ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/country-service-swagger-ui.png -------------------------------------------------------------------------------- /clients/3cn-react-client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/clients/3cn-react-client/public/favicon.ico -------------------------------------------------------------------------------- /clients/3cn-react-client/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/clients/3cn-react-client/public/logo192.png -------------------------------------------------------------------------------- /clients/3cn-react-client/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/clients/3cn-react-client/public/logo512.png -------------------------------------------------------------------------------- /currency-exchange/src/main/resources/db/changelog/db.changelog-master.yaml: -------------------------------------------------------------------------------- 1 | databaseChangeLog: 2 | - includeAll: 3 | path: db/changelog/changes -------------------------------------------------------------------------------- /resource/country-service-swagger-ui-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/country-service-swagger-ui-2.png -------------------------------------------------------------------------------- /resource/lucid-diagrams/3cnArchitecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/lucid-diagrams/3cnArchitecture.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.metadata/ 2 | .idea 3 | .vscode 4 | /currency-conversion-client 5 | /currency-conversion-api 6 | /CC-DTO 7 | /CC-Exception 8 | *.iml 9 | /localtunnel -------------------------------------------------------------------------------- /envcn/auth-db/buid-push-prod-image.sh: -------------------------------------------------------------------------------- 1 | docker build -t ubaidurehman/auth-db:0.0.3-SNAPSHOT --build-arg MY_SQL=8.0.25 . 2 | docker push ubaidurehman/auth-db:0.0.3-SNAPSHOT -------------------------------------------------------------------------------- /resource/auth/3cn-react-client-access-type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ubaid4j/Cloud-Native-App-Spring-Boot/HEAD/resource/auth/3cn-react-client-access-type.png -------------------------------------------------------------------------------- /clients/CurrencyConversionReactNativeClient/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CurrencyConversionReactNativeClient", 3 | "displayName": "CurrencyConversionReactNativeClient" 4 | } -------------------------------------------------------------------------------- /clients/3cn-react-client/build-push-prod-ui-image.sh: -------------------------------------------------------------------------------- 1 | docker build -t ubaidurehman/3cn-fe:0.0.3-SNAPSHOT --build-arg ENV=prod . 2 | docker push ubaidurehman/3cn-fe:0.0.3-SNAPSHOT -------------------------------------------------------------------------------- /common/readme.md: -------------------------------------------------------------------------------- 1 | About 2 | ===== 3 | 1. This directory contains the different modules which are shared across the services 4 | 5 | Dependencies 6 | ============ 7 | - ### Lombok -------------------------------------------------------------------------------- /k8s/housekeeping/delete-all-ingress.sh: -------------------------------------------------------------------------------- 1 | kubectl delete -n default ingress auth-server 2 | kubectl delete -n default ingress fe 3 | kubectl delete -n default ingress api-gateway -------------------------------------------------------------------------------- /common/dto/src/main/java/com/ubaid/ms/common/dto/serviceinfo/Git.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.common.dto.serviceinfo; 2 | 3 | public record Git(String branch, Commit commit) { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /clients/CurrencyConversionReactNativeClient/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /clients/CurrencyConversionReactNativeClient/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | bracketSpacing: false, 3 | jsxBracketSameLine: true, 4 | singleQuote: true, 5 | trailingComma: 'all', 6 | }; 7 | -------------------------------------------------------------------------------- /k8s/k8s-up.sh: -------------------------------------------------------------------------------- 1 | kubectl apply -f configs.yml 2 | kubectl apply -f pvs.yml 3 | kubectl apply -f pvcs.yml 4 | kubectl apply -f services.yml 5 | kubectl apply -f ingress.yml 6 | kubectl apply -f deployments.yml -------------------------------------------------------------------------------- /math/src/main/java/com/ubaid/ms/math/service/ServerInfoService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.math.service; 2 | 3 | public interface ServerInfoService { 4 | int getPort(); 5 | String getIPAddress(); 6 | } 7 | -------------------------------------------------------------------------------- /clients/3cn-react-client/README.md: -------------------------------------------------------------------------------- 1 | Stay Tuned 2 | ========== 3 | 4 | 5 | # Notes: 6 | - ### ES LINT 7 | - To add Linting: ```eslint --init``` 8 | - To lint through all .js files: ```eslint . --ext .js``` 9 | -------------------------------------------------------------------------------- /common/dto/src/main/java/com/ubaid/ms/common/dto/serviceinfo/Commit.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.common.dto.serviceinfo; 2 | 3 | import java.time.Instant; 4 | 5 | public record Commit(String id, Instant time) { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /currency-conversion/src/main/java/com/ubaid/ms/currencyconversion/service/RequestService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyconversion.service; 2 | 3 | public interface RequestService { 4 | String getClientIP(); 5 | } 6 | -------------------------------------------------------------------------------- /k8s/k8s-down.sh: -------------------------------------------------------------------------------- 1 | ./housekeeping/delete-all-deployments.sh 2 | ./housekeeping/delete-all-configMaps.sh 3 | ./housekeeping/delete-all-pv-and-pvc.sh 4 | ./housekeeping/delete-all-services.sh 5 | ./housekeeping/delete-all-ingress.sh -------------------------------------------------------------------------------- /envcn/kibana/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG ELK_VERSION 2 | 3 | # https://www.docker.elastic.co/ 4 | FROM docker.elastic.co/kibana/kibana:${ELK_VERSION} 5 | 6 | # Add your kibana plugins setup here 7 | # Example: RUN kibana-plugin install 8 | -------------------------------------------------------------------------------- /country/src/main/resources/db/changelog/changes/v0002.sql: -------------------------------------------------------------------------------- 1 | -- liquibase formatted sql 2 | -- changeset ubaid:18Oct2020_2005 3 | -- comment changing name of column 4 | alter table country_code 5 | rename column country_code to currency_code; 6 | -------------------------------------------------------------------------------- /math/src/main/java/com/ubaid/ms/math/service/InfoService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.math.service; 2 | 3 | import com.ubaid.ms.common.dto.serviceinfo.ServiceInformation; 4 | 5 | public interface InfoService { 6 | ServiceInformation get(); 7 | } 8 | -------------------------------------------------------------------------------- /user/src/main/java/com/ubaid/ms/user/service/InfoService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.user.service; 2 | 3 | import com.ubaid.ms.common.dto.serviceinfo.ServiceInformation; 4 | 5 | public interface InfoService { 6 | ServiceInformation get(); 7 | } 8 | -------------------------------------------------------------------------------- /audit/src/main/java/com/ubaid/ms/audit/service/InfoService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.audit.service; 2 | 3 | import com.ubaid.ms.common.dto.serviceinfo.ServiceInformation; 4 | 5 | public interface InfoService { 6 | ServiceInformation get(); 7 | } 8 | -------------------------------------------------------------------------------- /config/src/main/resources/application-local.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | config: 4 | server: 5 | git: 6 | uri: file://${user.home}/dev/test/public-repo 7 | skip-ssl-validation: true -------------------------------------------------------------------------------- /country/src/main/java/com/ubaid/ms/country/service/InfoService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.country.service; 2 | 3 | import com.ubaid.ms.common.dto.serviceinfo.ServiceInformation; 4 | 5 | public interface InfoService { 6 | ServiceInformation get(); 7 | } 8 | -------------------------------------------------------------------------------- /country/src/main/resources/db/changelog/changes/v0004-add_column_in_country_code_table.sql: -------------------------------------------------------------------------------- 1 | -- liquibase formatted sql 2 | -- changeset ubaid:12Nov2020_1847 3 | -- comment add column iso code in country code table 4 | alter table country_code 5 | add iso_code int; -------------------------------------------------------------------------------- /currency-exchange/src/main/java/com/ubaid/ms/currencyexchangeservice/service/ServerInfoService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyexchangeservice.service; 2 | 3 | public interface ServerInfoService { 4 | int getPort(); 5 | String getIPAddress(); 6 | } 7 | -------------------------------------------------------------------------------- /envcn/logstash/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG ELK_VERSION 2 | 3 | # https://www.docker.elastic.co/ 4 | FROM docker.elastic.co/logstash/logstash:${ELK_VERSION} 5 | 6 | # Add your logstash plugins setup here 7 | # Example: RUN logstash-plugin install logstash-filter-json 8 | -------------------------------------------------------------------------------- /common/dto/src/main/java/com/ubaid/ms/common/dto/auth/LoginCred.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.common.dto.auth; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class LoginCred { 7 | private String username; 8 | private String password; 9 | } 10 | -------------------------------------------------------------------------------- /math/src/main/java/com/ubaid/ms/math/service/MathService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.math.service; 2 | 3 | 4 | import com.ubaid.ms.common.dto.ValueDTO; 5 | 6 | public interface MathService { 7 | ValueDTO multiply(Double currency, Double conversionRate); 8 | } 9 | -------------------------------------------------------------------------------- /api-gateway/src/main/java/com/ubaid/ms/apigateway/services/InfoService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.apigateway.services; 2 | 3 | import com.ubaid.ms.common.dto.serviceinfo.ServiceInformation; 4 | 5 | public interface InfoService { 6 | ServiceInformation get(); 7 | } 8 | -------------------------------------------------------------------------------- /clients/3cn-react-client/public/keycloak-dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "realm": "3cn", 3 | "auth-server-url": "http://auth-server:9999/auth/", 4 | "ssl-required": "external", 5 | "resource": "3cn-react-client", 6 | "public-client": true, 7 | "confidential-port": 0 8 | } 9 | -------------------------------------------------------------------------------- /clients/3cn-react-client/public/keycloak-local.json: -------------------------------------------------------------------------------- 1 | { 2 | "realm": "3cn", 3 | "auth-server-url": "http://localhost:9999/auth/", 4 | "ssl-required": "external", 5 | "resource": "3cn-react-client", 6 | "public-client": true, 7 | "confidential-port": 0 8 | } 9 | -------------------------------------------------------------------------------- /clients/3cn-react-client/public/keycloak-prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "realm": "3cn", 3 | "auth-server-url": "http://auth-server-io/auth", 4 | "ssl-required": "external", 5 | "resource": "3cn-react-client", 6 | "public-client": true, 7 | "confidential-port": 0 8 | } 9 | -------------------------------------------------------------------------------- /clients/3cn-react-client/src/store/actions/AuthAction.js: -------------------------------------------------------------------------------- 1 | import {ADD_ACCESS_TOKEN} from 'store/ActionTypes'; 2 | 3 | export const AddAccessToken = (accessToken) => { 4 | return { 5 | type: ADD_ACCESS_TOKEN, 6 | accessToken: accessToken 7 | }; 8 | }; 9 | -------------------------------------------------------------------------------- /country/src/main/resources/db/changelog/changes/v0005-updating_iso_column_to_integer.sql: -------------------------------------------------------------------------------- 1 | -- liquibase formatted sql 2 | -- changeset ubaid:12Nov2020_1958 3 | -- comment add column iso code in country code table 4 | alter table country_code 5 | modify iso_code varchar(2); -------------------------------------------------------------------------------- /envcn/elasticsearch/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG ELK_VERSION 2 | 3 | # https://www.docker.elastic.co/ 4 | FROM docker.elastic.co/elasticsearch/elasticsearch:${ELK_VERSION} 5 | 6 | # Add your elasticsearch plugins setup here 7 | # Example: RUN elasticsearch-plugin install analysis-icu 8 | -------------------------------------------------------------------------------- /clients/CurrencyConversionReactNativeClient/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /country/src/main/resources/db/changelog/changes/v0005a-correcting_iso_column_to10_varchar.sql: -------------------------------------------------------------------------------- 1 | -- liquibase formatted sql 2 | -- changeset ubaid:12Nov2020_2001 3 | -- comment add column iso code in country code table 4 | alter table country_code 5 | modify iso_code varchar(10); -------------------------------------------------------------------------------- /audit/src/main/resources/db/migration/V2__gh_360_replace_float_with_double.sql: -------------------------------------------------------------------------------- 1 | alter table audit 2 | modify column exchange_rate double; 3 | 4 | alter table audit 5 | modify column from_currency_value double; 6 | 7 | alter table audit 8 | modify column to_currency_value double; 9 | -------------------------------------------------------------------------------- /currency-conversion/src/main/java/com/ubaid/ms/currencyconversion/service/AuditService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyconversion.service; 2 | 3 | import com.ubaid.ms.common.dto.AuditDTO; 4 | 5 | public interface AuditService { 6 | void sendAuditLogToMQ(AuditDTO auditDTO); 7 | } 8 | -------------------------------------------------------------------------------- /clients/3cn-react-client/src/component/down/ServiceDown.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | const ServiceDown = () => { 3 | return ( 4 | <> 5 |

Service is Down. Sorry for inconvenience

6 | 7 | ); 8 | }; 9 | export default ServiceDown; 10 | -------------------------------------------------------------------------------- /currency-conversion/src/main/java/com/ubaid/ms/currencyconversion/service/InfoService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyconversion.service; 2 | 3 | import com.ubaid.ms.common.dto.serviceinfo.ServiceInformation; 4 | 5 | public interface InfoService { 6 | ServiceInformation get(); 7 | } 8 | -------------------------------------------------------------------------------- /clients/3cn-react-client/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /config/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | config: 4 | server: 5 | git: 6 | uri: https://github.com/UbaidurRehman1/public-repo.git 7 | skip-ssl-validation: true 8 | timeout: 60 -------------------------------------------------------------------------------- /config/src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | config: 4 | server: 5 | git: 6 | uri: https://github.com/UbaidurRehman1/public-repo.git 7 | skip-ssl-validation: true 8 | timeout: 60 -------------------------------------------------------------------------------- /currency-exchange/src/main/java/com/ubaid/ms/currencyexchangeservice/service/InfoService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyexchangeservice.service; 2 | 3 | import com.ubaid.ms.common.dto.serviceinfo.ServiceInformation; 4 | 5 | public interface InfoService { 6 | ServiceInformation get(); 7 | } 8 | -------------------------------------------------------------------------------- /common/dto/src/main/java/com/ubaid/ms/common/dto/Rate.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.common.dto; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | 7 | @Data 8 | @NoArgsConstructor 9 | public class Rate { 10 | private String code; 11 | private Double value; 12 | } 13 | -------------------------------------------------------------------------------- /country/src/main/java/com/ubaid/ms/country/service/CountryCodeService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.country.service; 2 | 3 | 4 | import com.ubaid.ms.common.dto.CountryCodeDTO; 5 | 6 | import java.util.List; 7 | 8 | public interface CountryCodeService { 9 | List getAll(); 10 | } 11 | -------------------------------------------------------------------------------- /envcn/logstash/pipeline/logstash.conf: -------------------------------------------------------------------------------- 1 | input { 2 | tcp { 3 | port => 5000 4 | } 5 | } 6 | 7 | ## Add your filters / logstash plugins configuration here 8 | 9 | output { 10 | elasticsearch { 11 | hosts => "elasticsearch:9200" 12 | user => "elastic" 13 | password => "changeme" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /user/src/main/java/com/ubaid/ms/user/service/AccessTokenService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.user.service; 2 | 3 | /** 4 | * get the access token from the keycloak 5 | * @author ubaid 6 | */ 7 | public interface AccessTokenService { 8 | String getAccessToken(String username, String password); 9 | } 10 | -------------------------------------------------------------------------------- /country/src/main/java/com/ubaid/ms/country/dao/CountryCodeDAO.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.country.dao; 2 | 3 | import com.ubaid.ms.country.entity.CountryCode; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | public interface CountryCodeDAO extends JpaRepository { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /k8s/housekeeping/delete-all-configMaps.sh: -------------------------------------------------------------------------------- 1 | kubectl delete -n default configmap kibana-config 2 | kubectl delete -n default configmap logstash-pipeline 3 | kubectl delete -n default configmap logstash-config 4 | kubectl delete -n default configmap elastic-search-config 5 | kubectl delete -n default configmap audit-db-init-config -------------------------------------------------------------------------------- /user/src/test/java/com/ubaid/ms/userservice/UserAppTests.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.userservice; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class UserAppTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /country/src/main/resources/db/changelog/changes/v0001.sql: -------------------------------------------------------------------------------- 1 | -- liquibase formatted sql 2 | -- changeset ubaid:18Oct2020_2144 3 | 4 | create table country_code ( 5 | id bigint primary key auto_increment, 6 | country varchar(255), 7 | country_code varchar(255), 8 | currency_name varchar(255), 9 | number int 10 | ); 11 | -------------------------------------------------------------------------------- /common/dto/src/main/java/com/ubaid/ms/common/dto/ValueDTO.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.common.dto; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | 7 | @Data 8 | @NoArgsConstructor 9 | public class ValueDTO { 10 | private Integer port; 11 | private String ipAddress; 12 | private Double value; 13 | } 14 | -------------------------------------------------------------------------------- /country/src/main/java/com/ubaid/ms/country/aop/TargetMethods.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.country.aop; 2 | 3 | import org.aspectj.lang.annotation.Pointcut; 4 | 5 | public abstract class TargetMethods { 6 | 7 | @Pointcut("execution(* com.ubaid.ms.country.service.CountryCodeService.getAll())") 8 | public void getAll() { 9 | } 10 | } -------------------------------------------------------------------------------- /currency-conversion/src/main/java/com/ubaid/ms/currencyconversion/entity/Limit.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyconversion.entity; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | @Data 7 | @NoArgsConstructor 8 | public class Limit { 9 | private int max; 10 | private int min; 11 | private int port; 12 | } 13 | -------------------------------------------------------------------------------- /math/src/main/java/com/ubaid/ms/math/aop/TargetMethods.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.math.aop; 2 | 3 | import org.aspectj.lang.annotation.Pointcut; 4 | 5 | public abstract class TargetMethods { 6 | 7 | @Pointcut("execution(* com.ubaid.ms.math.service.MathServiceImp.multiply(Double, Double))") 8 | public void convert() { 9 | } 10 | } -------------------------------------------------------------------------------- /audit/src/test/java/com/ubaid/ms/auditservice/AuditApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.auditservice; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class AuditApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /audit/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | #------------------------Config Client--------------------------# 2 | spring.config.import=optional:configserver:http://config:8888 3 | spring.cloud.config.profile=dev 4 | spring.cloud.config.fail-fast=true 5 | spring.cloud.config.request-connect-timeout=30000 6 | spring.cloud.config.request-read-timeout=360000 -------------------------------------------------------------------------------- /math/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | #------------------------Config Client--------------------------# 2 | spring.config.import=optional:configserver:http://config:8888 3 | spring.cloud.config.profile=dev 4 | spring.cloud.config.fail-fast=true 5 | spring.cloud.config.request-connect-timeout=30000 6 | spring.cloud.config.request-read-timeout=360000 -------------------------------------------------------------------------------- /user/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | #------------------------Config Client--------------------------# 2 | spring.config.import=optional:configserver:http://config:8888 3 | spring.cloud.config.profile=dev 4 | spring.cloud.config.fail-fast=true 5 | spring.cloud.config.request-connect-timeout=30000 6 | spring.cloud.config.request-read-timeout=360000 -------------------------------------------------------------------------------- /audit/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | #------------------------Config Client--------------------------# 2 | spring.config.import=optional:configserver:http://config:8888 3 | spring.cloud.config.profile=prod 4 | spring.cloud.config.fail-fast=true 5 | spring.cloud.config.request-connect-timeout=30000 6 | spring.cloud.config.request-read-timeout=360000 -------------------------------------------------------------------------------- /common/dto/src/main/java/com/ubaid/ms/common/dto/CurrencyInfoDTO.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.common.dto; 2 | 3 | import io.soabase.recordbuilder.core.RecordBuilder; 4 | import java.io.Serializable; 5 | 6 | @RecordBuilder 7 | public record CurrencyInfoDTO(String fromCurrency, String toCurrency, Double quantity) 8 | implements Serializable { 9 | } 10 | -------------------------------------------------------------------------------- /country/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | #------------------------Config Client--------------------------# 2 | spring.config.import=optional:configserver:http://config:8888 3 | spring.cloud.config.profile=dev 4 | spring.cloud.config.fail-fast=true 5 | spring.cloud.config.request-connect-timeout=30000 6 | spring.cloud.config.request-read-timeout=360000 -------------------------------------------------------------------------------- /country/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | #------------------------Config Client--------------------------# 2 | spring.config.import=optional:configserver:http://config:8888 3 | spring.cloud.config.profile=prod 4 | spring.cloud.config.fail-fast=true 5 | spring.cloud.config.request-connect-timeout=30000 6 | spring.cloud.config.request-read-timeout=360000 -------------------------------------------------------------------------------- /country/src/test/java/com/ubaid/ms/counteryservice/CountryApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.counteryservice; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class CountryApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /math/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | #------------------------Config Client--------------------------# 2 | spring.config.import=optional:configserver:http://config:8888 3 | spring.cloud.config.profile=prod 4 | spring.cloud.config.fail-fast=true 5 | spring.cloud.config.request-connect-timeout=30000 6 | spring.cloud.config.request-read-timeout=360000 -------------------------------------------------------------------------------- /user/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | #------------------------Config Client--------------------------# 2 | spring.config.import=optional:configserver:http://config:8888 3 | spring.cloud.config.profile=prod 4 | spring.cloud.config.fail-fast=true 5 | spring.cloud.config.request-connect-timeout=30000 6 | spring.cloud.config.request-read-timeout=360000 -------------------------------------------------------------------------------- /api-gateway/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | #------------------------Config Client--------------------------# 2 | spring.config.import=optional:configserver:http://config:8888 3 | spring.cloud.config.profile=dev 4 | spring.cloud.config.fail-fast=true 5 | spring.cloud.config.request-connect-timeout=30000 6 | spring.cloud.config.request-read-timeout=360000 -------------------------------------------------------------------------------- /api-gateway/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | #------------------------Config Client--------------------------# 2 | spring.config.import=optional:configserver:http://config:8888 3 | spring.cloud.config.profile=prod 4 | spring.cloud.config.fail-fast=true 5 | spring.cloud.config.request-connect-timeout=30000 6 | spring.cloud.config.request-read-timeout=360000 -------------------------------------------------------------------------------- /config/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: spring-cloud-config-server 4 | profiles: 5 | active: @activatedProperties@ 6 | mvc: 7 | pathmatch: 8 | matching-strategy: ant_path_matcher 9 | main: 10 | allow-bean-definition-overriding: true 11 | server: 12 | port: 8888 -------------------------------------------------------------------------------- /user/src/main/java/com/ubaid/ms/user/aop/TargetMethods.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.user.aop; 2 | 3 | import org.aspectj.lang.annotation.Pointcut; 4 | 5 | public abstract class TargetMethods { 6 | 7 | @Pointcut("execution(* com.ubaid.ms.user.service.AccessTokenService.getAccessToken(String, String))") 8 | public void getAccessToken() {} 9 | 10 | } 11 | -------------------------------------------------------------------------------- /currency-exchange/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | #------------------------Config Client--------------------------# 2 | spring.config.import=optional:configserver:http://config:8888 3 | spring.cloud.config.profile=dev 4 | spring.cloud.config.fail-fast=true 5 | spring.cloud.config.request-connect-timeout=30000 6 | spring.cloud.config.request-read-timeout=360000 -------------------------------------------------------------------------------- /currency-exchange/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | #------------------------Config Client--------------------------# 2 | spring.config.import=optional:configserver:http://config:8888 3 | spring.cloud.config.profile=prod 4 | spring.cloud.config.fail-fast=true 5 | spring.cloud.config.request-connect-timeout=30000 6 | spring.cloud.config.request-read-timeout=360000 -------------------------------------------------------------------------------- /clients/3cn-react-client/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | 3 | listen 80; 4 | 5 | location / { 6 | root /usr/share/nginx/html; 7 | index index.html index.htm; 8 | try_files $uri $uri/ /index.html; 9 | } 10 | 11 | error_page 500 502 503 504 /50x.html; 12 | 13 | location = /50x.html { 14 | root /usr/share/nginx/html; 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /currency-conversion/src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | #------------------------Config Client--------------------------# 2 | spring.config.import=optional:configserver:http://config:8888 3 | spring.cloud.config.profile=prod 4 | spring.cloud.config.fail-fast=true 5 | spring.cloud.config.request-connect-timeout=30000 6 | spring.cloud.config.request-read-timeout=360000 -------------------------------------------------------------------------------- /common/dto/src/main/java/com/ubaid/ms/common/dto/ExceptionDTO.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.common.dto; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | import java.util.Date; 7 | 8 | @Data 9 | @NoArgsConstructor 10 | public class ExceptionDTO { 11 | private String message; 12 | private String cause; 13 | private Date timeStamp; 14 | } 15 | -------------------------------------------------------------------------------- /currency-conversion/src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | #------------------------Config Client--------------------------# 2 | spring.config.import=optional:configserver:http://config:8888 3 | spring.cloud.config.profile=dev 4 | spring.cloud.config.fail-fast=true 5 | spring.cloud.config.request-connect-timeout=30000 6 | spring.cloud.config.request-read-timeout=360000 7 | 8 | -------------------------------------------------------------------------------- /k8s/housekeeping/delete-all-pv-and-pvc.sh: -------------------------------------------------------------------------------- 1 | kubectl delete -n default persistentvolumeclaim elasticsearch-pvc 2 | kubectl delete persistentvolume elasticsearch-pv 3 | 4 | kubectl delete -n default persistentvolumeclaim mysql-pvc 5 | kubectl delete persistentvolume mysql-pv 6 | 7 | kubectl delete -n default persistentvolumeclaim auth-db-pvc 8 | kubectl delete persistentvolume auth-db-pv -------------------------------------------------------------------------------- /currency-exchange/src/main/resources/db/changelog/changes/v00001.sql: -------------------------------------------------------------------------------- 1 | -- liquibase formatted sql 2 | -- changeset ubaid:20Oct2020_2157 3 | -- comment creating exchange rate table 4 | create table exchange_rate( 5 | id varchar(255) primary key, 6 | timestamp datetime, 7 | from_currency varchar(255), 8 | to_currency varchar(255), 9 | exchange_rate double 10 | ); -------------------------------------------------------------------------------- /currency-exchange/src/test/java/com/ubaid/ms/currency_conversion_service/ContextTest.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currency_conversion_service; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | public class ContextTest { 8 | 9 | @Test 10 | void loadContext() { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /k8s/housekeeping/delete-all-services.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | declare -a deployments=("api-gateway" "audit" "config" "country" "currency-conversion" "currency-exchange" "discovery" "math" "user" "fe" "elasticsearch" "logstash" "kibana" "rabbitmq" "zipkin" "auth-db" "auth-server-io" "db") 3 | for deployment in "${deployments[@]}" 4 | do 5 | kubectl delete -n default service "$deployment" 6 | done -------------------------------------------------------------------------------- /pull-all-microservice-images.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | declare -a microservices=("api-gateway" "audit" "config" "country" "currency-conversion" "currency-exchange" "discovery" "math" "user") 3 | APP_VERSION=0.0.3-SNAPSHOT 4 | for microservice in "${microservices[@]}" 5 | do 6 | echo pulling ubaidurehman/"$microservice":$APP_VERSION 7 | docker pull ubaidurehman/"$microservice":$APP_VERSION 8 | done -------------------------------------------------------------------------------- /push-all-microservice-images.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | declare -a microservices=("api-gateway" "audit" "config" "country" "currency-conversion" "currency-exchange" "discovery" "math" "user") 3 | APP_VERSION=0.0.3-SNAPSHOT 4 | for microservice in "${microservices[@]}" 5 | do 6 | echo pushing ubaidurehman/"$microservice":$APP_VERSION 7 | docker push ubaidurehman/"$microservice":$APP_VERSION 8 | done -------------------------------------------------------------------------------- /k8s/housekeeping/delete-all-deployments.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | declare -a deployments=("api-gateway" "audit" "config" "country" "currency-conversion" "currency-exchange" "discovery" "math" "user" "fe" "elasticsearch" "logstash" "kibana" "rabbit-mq" "zipkin" "auth-db" "auth-server" "app-db") 3 | for deployment in "${deployments[@]}" 4 | do 5 | kubectl delete -n default deployment "$deployment" 6 | done -------------------------------------------------------------------------------- /resource/create-index-for-logging.md: -------------------------------------------------------------------------------- 1 | - credentials (It will ask you credentials first) 2 | - username : `elastic` 3 | - password : `changeme` 4 | - First you have to create index `logstash-*` like below graphic. 5 | ![Create Index](create-index.PNG) 6 | - Select logstash-* index pattern like below graphic and then you will see the logs 7 | ![Kibana Dashboard](kibana-dashboard.png) 8 | -------------------------------------------------------------------------------- /currency-conversion/src/main/java/com/ubaid/ms/currencyconversion/service/AuthService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyconversion.service; 2 | 3 | import org.springframework.security.core.Authentication; 4 | 5 | public interface AuthService { 6 | Authentication getAuthentication(); 7 | String getAccessToken(); 8 | String getBearerToken(); 9 | String getUserUUID(); 10 | } 11 | -------------------------------------------------------------------------------- /common/dto/src/main/java/com/ubaid/ms/common/dto/serviceinfo/ServiceInformation.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.common.dto.serviceinfo; 2 | 3 | import com.ubaid.ms.common.dto.serviceinfo.Git; 4 | import io.soabase.recordbuilder.core.RecordBuilder; 5 | import java.time.Instant; 6 | 7 | @RecordBuilder 8 | public record ServiceInformation(String name, 9 | Git git) { 10 | } 11 | -------------------------------------------------------------------------------- /currency-conversion/src/main/java/com/ubaid/ms/currencyconversion/service/CurrencyConversionService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyconversion.service; 2 | 3 | 4 | import com.ubaid.ms.common.dto.CurrencyInfoDTO; 5 | import com.ubaid.ms.common.dto.ExchangeValueDTO; 6 | 7 | public interface CurrencyConversionService { 8 | ExchangeValueDTO convertCurrency(CurrencyInfoDTO currencyInfo); 9 | } 10 | -------------------------------------------------------------------------------- /discovery/readme.md: -------------------------------------------------------------------------------- 1 | About 2 | ===== 3 | - Discovery (Netflix Eureka) Server 4 | 5 | Dependencies 6 | ------------ 7 | - #### Cloud 8 | - ##### Discovery Server 9 | - spring-cloud-starter-netflix-eureka-server 10 | - #### [Dependencies From Parent](./../moreinfo.md#Dependencies-from-parent) 11 | 12 | Configurations 13 | -------------- 14 | Annotate Application with @EnableEurekaServer 15 | 16 | -------------------------------------------------------------------------------- /currency-conversion/src/main/java/com/ubaid/ms/currencyconversion/aop/TargetMethods.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyconversion.aop; 2 | 3 | import org.aspectj.lang.annotation.Pointcut; 4 | 5 | public abstract class TargetMethods { 6 | 7 | @Pointcut("execution(* com.ubaid.ms.currencyconversion.service.CurrencyConversionService.convertCurrency(com.ubaid.ms.common.dto.CurrencyInfoDTO))") 8 | public void convertCurrency() {} 9 | } -------------------------------------------------------------------------------- /clients/CurrencyConversionReactNativeClient/metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | module.exports = { 9 | transformer: { 10 | getTransformOptions: async () => ({ 11 | transform: { 12 | experimentalImportSupport: false, 13 | inlineRequires: false, 14 | }, 15 | }), 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /clients/3cn-react-client/src/store/reducers/AuthReducer.js: -------------------------------------------------------------------------------- 1 | import {ADD_ACCESS_TOKEN} from 'store/ActionTypes'; 2 | 3 | const initialState = { 4 | accessToken: null 5 | }; 6 | 7 | export const AuthReducer = (state = initialState, action) => { 8 | switch (action.type) { 9 | case ADD_ACCESS_TOKEN: 10 | return {...state, accessToken: action.accessToken}; 11 | default: 12 | return state; 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /common/dto/src/main/java/com/ubaid/ms/common/dto/CountryCodeDTO.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.common.dto; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | @Data 7 | @NoArgsConstructor 8 | public class CountryCodeDTO { 9 | private Long id; 10 | private String country; 11 | private String currencyName; 12 | private String currencyCode; 13 | private Integer number; 14 | private String isoCode; 15 | } 16 | -------------------------------------------------------------------------------- /clients/3cn-react-client/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /currency-conversion/src/main/java/com/ubaid/ms/currencyconversion/util/BearerToken.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyconversion.util; 2 | 3 | import lombok.Data; 4 | 5 | import static com.ubaid.ms.common.util.Constants.*; 6 | 7 | @Data 8 | public class BearerToken { 9 | 10 | private final String bearerToken; 11 | 12 | public BearerToken(String accessToken) { 13 | this.bearerToken = BEARER + SINGLE_SPACE + accessToken; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /clients/CurrencyConversionReactNativeClient/App.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | * @flow strict-local 7 | */ 8 | 9 | import React from 'react'; 10 | import {Text} from 'react-native'; 11 | 12 | const App: () => React$Node = () => { 13 | return ( 14 | <> 15 | Hello World to Currency Conversion Service 16 | 17 | ); 18 | }; 19 | 20 | export default App; 21 | -------------------------------------------------------------------------------- /clients/3cn-react-client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | 25 | package-lock.json 26 | -------------------------------------------------------------------------------- /common/dto/src/main/java/com/ubaid/ms/common/dto/ExchangeRateDTO.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.common.dto; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | import java.util.Date; 7 | import java.util.Map; 8 | 9 | @Data 10 | @NoArgsConstructor 11 | public class ExchangeRateDTO { 12 | private Boolean success; 13 | private String date; 14 | private Long timestamp; 15 | private String base; 16 | private Map rates; 17 | } 18 | -------------------------------------------------------------------------------- /config/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /currency-exchange/src/main/java/com/ubaid/ms/currencyexchangeservice/service/ExchangeRateService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyexchangeservice.service; 2 | 3 | import com.ubaid.ms.common.dto.ExchangeValueDTO; 4 | import com.ubaid.ms.currencyexchangeservice.entity.ExchangeRate; 5 | 6 | import java.util.List; 7 | 8 | public interface ExchangeRateService { 9 | ExchangeValueDTO getExchangeValue(String from, String to); 10 | void saveAll(List exchangeRates); 11 | } 12 | -------------------------------------------------------------------------------- /math/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /api-gateway/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /discovery/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /envcn/logstash/config/logstash.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ## Default Logstash configuration from Logstash base image. 3 | ## https://github.com/elastic/logstash/blob/master/docker/data/logstash/config/logstash-full.yml 4 | # 5 | http.host: "0.0.0.0" 6 | xpack.monitoring.elasticsearch.hosts: [ "http://elasticsearch:9200" ] 7 | 8 | ## X-Pack security credentials 9 | # 10 | xpack.monitoring.enabled: true 11 | xpack.monitoring.elasticsearch.username: elastic 12 | xpack.monitoring.elasticsearch.password: changeme 13 | -------------------------------------------------------------------------------- /clients/3cn-react-client/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({getCLS, getFID, getFCP, getLCP, getTTFB}) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /currency-exchange/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /common/exception/src/main/java/com/ubaid/ms/common/util/exception/CCException.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.common.util.exception; 2 | 3 | public class CCException extends RuntimeException { 4 | public CCException() { 5 | } 6 | 7 | public CCException(Throwable cause) { 8 | super(cause); 9 | } 10 | 11 | public CCException(String message, Throwable cause) { 12 | super(message, cause); 13 | } 14 | 15 | public CCException(String message) { super(message);} 16 | } 17 | -------------------------------------------------------------------------------- /currency-conversion/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /audit/Dockerfile.multistage: -------------------------------------------------------------------------------- 1 | ARG APP_VERSION 2 | FROM ubaidurehman/3cn-parent:${APP_VERSION} as build 3 | LABEL maintainer="urehman.bese16seecs@seecs.edu.pk" 4 | VOLUME /tmp 5 | WORKDIR / 6 | ADD . . 7 | RUN mvn clean install -DskipTests 8 | 9 | FROM openjdk:17-slim 10 | VOLUME /tmp 11 | WORKDIR / 12 | EXPOSE 8950 13 | ARG APP_VERSION 14 | COPY --from=build /target/audit-${APP_VERSION}.jar service.jar 15 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Dspring.profiles.active=dev","-jar","/service.jar"] 16 | -------------------------------------------------------------------------------- /math/Dockerfile.multistage: -------------------------------------------------------------------------------- 1 | ARG APP_VERSION 2 | FROM ubaidurehman/3cn-parent:${APP_VERSION} as build 3 | LABEL maintainer="urehman.bese16seecs@seecs.edu.pk" 4 | VOLUME /tmp 5 | WORKDIR / 6 | ADD . . 7 | RUN mvn clean install -DskipTests 8 | 9 | FROM openjdk:17-slim 10 | VOLUME /tmp 11 | WORKDIR / 12 | EXPOSE 8100 13 | ARG APP_VERSION 14 | COPY --from=build /target/math-${APP_VERSION}.jar service.jar 15 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Dspring.profiles.active=dev","-jar","/service.jar"] 16 | -------------------------------------------------------------------------------- /user/Dockerfile.multistage: -------------------------------------------------------------------------------- 1 | ARG APP_VERSION 2 | FROM ubaidurehman/3cn-parent:${APP_VERSION} as build 3 | LABEL maintainer="urehman.bese16seecs@seecs.edu.pk" 4 | VOLUME /tmp 5 | WORKDIR / 6 | ADD . . 7 | RUN mvn clean install -DskipTests 8 | 9 | FROM openjdk:17-slim 10 | VOLUME /tmp 11 | WORKDIR / 12 | EXPOSE 8900 13 | ARG APP_VERSION 14 | COPY --from=build /target/user-${APP_VERSION}.jar service.jar 15 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Dspring.profiles.active=dev","-jar","/service.jar"] 16 | -------------------------------------------------------------------------------- /config/Dockerfile.multistage: -------------------------------------------------------------------------------- 1 | ARG APP_VERSION 2 | FROM ubaidurehman/3cn-parent:${APP_VERSION} as build 3 | LABEL maintainer="urehman.bese16seecs@seecs.edu.pk" 4 | VOLUME /tmp 5 | WORKDIR / 6 | ADD . . 7 | RUN mvn clean install -DskipTests 8 | 9 | FROM openjdk:17-slim 10 | VOLUME /tmp 11 | WORKDIR / 12 | EXPOSE 8888 13 | ARG APP_VERSION 14 | COPY --from=build /target/config-${APP_VERSION}.jar service.jar 15 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Dspring.profiles.active=dev","-jar","/service.jar"] 16 | -------------------------------------------------------------------------------- /country/Dockerfile.multistage: -------------------------------------------------------------------------------- 1 | ARG APP_VERSION 2 | FROM ubaidurehman/3cn-parent:${APP_VERSION} as build 3 | LABEL maintainer="urehman.bese16seecs@seecs.edu.pk" 4 | VOLUME /tmp 5 | WORKDIR / 6 | ADD . . 7 | RUN mvn clean install -DskipTests 8 | 9 | FROM openjdk:17-slim 10 | VOLUME /tmp 11 | WORKDIR / 12 | EXPOSE 8300 13 | ARG APP_VERSION 14 | COPY --from=build /target/country-${APP_VERSION}.jar service.jar 15 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Dspring.profiles.active=dev","-jar","/service.jar"] 16 | -------------------------------------------------------------------------------- /discovery/Dockerfile.multistage: -------------------------------------------------------------------------------- 1 | ARG APP_VERSION 2 | FROM ubaidurehman/3cn-parent:${APP_VERSION} as build 3 | LABEL maintainer="urehman.bese16seecs@seecs.edu.pk" 4 | VOLUME /tmp 5 | WORKDIR / 6 | ADD . . 7 | RUN mvn clean install -DskipTests 8 | 9 | FROM openjdk:17-slim 10 | VOLUME /tmp 11 | WORKDIR / 12 | EXPOSE 8761 13 | ARG APP_VERSION 14 | COPY --from=build /target/discovery-${APP_VERSION}.jar service.jar 15 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Dspring.profiles.active=dev","-jar","/service.jar"] 16 | -------------------------------------------------------------------------------- /api-gateway/Dockerfile.multistage: -------------------------------------------------------------------------------- 1 | ARG APP_VERSION 2 | FROM ubaidurehman/3cn-parent:${APP_VERSION} as build 3 | LABEL maintainer="urehman.bese16seecs@seecs.edu.pk" 4 | VOLUME /tmp 5 | WORKDIR / 6 | ADD . . 7 | RUN mvn clean install -DskipTests 8 | 9 | FROM openjdk:17-slim 10 | VOLUME /tmp 11 | WORKDIR / 12 | EXPOSE 8755 13 | ARG APP_VERSION 14 | COPY --from=build /target/api-gateway-${APP_VERSION}.jar service.jar 15 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Dspring.profiles.active=dev","-jar","/service.jar"] 16 | -------------------------------------------------------------------------------- /audit/src/main/java/com/ubaid/ms/audit/config/MessageBrokerConfig.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.audit.config; 2 | 3 | import org.springframework.amqp.core.Queue; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import static com.ubaid.ms.common.util.Constants.AUDIT_QUEUE; 8 | 9 | @Configuration 10 | public class MessageBrokerConfig { 11 | 12 | @Bean 13 | public Queue auditQueue() { 14 | return new Queue(AUDIT_QUEUE, false); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /clients/3cn-react-client/Dockerfile: -------------------------------------------------------------------------------- 1 | #To build image: docker run -t 3cn-fe:{version} --build-arg ENV={env} . 2 | FROM node:14.17.3-alpine as build 3 | WORKDIR /app 4 | ENV PATH /app/node_modules/.bin:$PATH 5 | COPY package.json ./ 6 | RUN npm install 7 | COPY . ./ 8 | ARG ENV 9 | RUN npm run build:${ENV} 10 | 11 | # production environment 12 | FROM nginx:stable-alpine 13 | COPY --from=build /app/build /usr/share/nginx/html 14 | # new 15 | COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf 16 | EXPOSE 80 17 | CMD ["nginx", "-g", "daemon off;"] -------------------------------------------------------------------------------- /clients/3cn-react-client/src/http/RequestHandler.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | 4 | const env = process.env.REACT_APP_ENV; 5 | let baseURL; 6 | if (env === 'prod') { 7 | baseURL = 'http://currency-converter.api-gateway.io'; 8 | } else { 9 | baseURL = 'http://localhost:8755'; 10 | } 11 | 12 | const RequestHandler = axios.create({ 13 | baseURL: baseURL, 14 | headers: { 15 | 'Access-Control-Allow-Origin': '*', 16 | 'Content-Type': 'application/json', 17 | } 18 | }); 19 | export default RequestHandler; 20 | -------------------------------------------------------------------------------- /currency-exchange/Dockerfile.multistage: -------------------------------------------------------------------------------- 1 | ARG APP_VERSION 2 | FROM ubaidurehman/3cn-parent:${APP_VERSION} as build 3 | LABEL maintainer="urehman.bese16seecs@seecs.edu.pk" 4 | VOLUME /tmp 5 | WORKDIR / 6 | ADD . . 7 | RUN mvn clean install -DskipTests 8 | 9 | FROM openjdk:17-slim 10 | VOLUME /tmp 11 | WORKDIR / 12 | EXPOSE 8000 13 | ARG APP_VERSION 14 | COPY --from=build /target/currency-exchange-${APP_VERSION}.jar service.jar 15 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Dspring.profiles.active=dev","-jar","/service.jar"] 16 | -------------------------------------------------------------------------------- /envcn/kibana/config/kibana.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ## Default Kibana configuration from Kibana base image. 3 | ## https://github.com/elastic/kibana/blob/master/src/dev/build/tasks/os_packages/docker_generator/templates/kibana_yml.template.js 4 | # 5 | server.name: kibana 6 | server.host: 0.0.0.0 7 | elasticsearch.hosts: [ "http://elasticsearch:9200" ] 8 | monitoring.ui.container.elasticsearch.enabled: true 9 | ## X-Pack security credentials 10 | # 11 | xpack.security.enabled: false 12 | elasticsearch.username: elastic 13 | elasticsearch.password: changeme 14 | -------------------------------------------------------------------------------- /audit/src/main/java/com/ubaid/ms/audit/config/Beans.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.audit.config; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import org.springframework.beans.factory.config.ConfigurableBeanFactory; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Scope; 7 | 8 | public class Beans { 9 | 10 | @Bean 11 | @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) 12 | public ObjectMapper objectMapper() { 13 | return new ObjectMapper(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /currency-conversion/Dockerfile.multistage: -------------------------------------------------------------------------------- 1 | ARG APP_VERSION 2 | FROM ubaidurehman/3cn-parent:${APP_VERSION} as build 3 | LABEL maintainer="urehman.bese16seecs@seecs.edu.pk" 4 | VOLUME /tmp 5 | WORKDIR / 6 | ADD . . 7 | RUN mvn clean install -DskipTests 8 | 9 | FROM openjdk:17-slim 10 | VOLUME /tmp 11 | WORKDIR / 12 | EXPOSE 5200 13 | ARG APP_VERSION 14 | COPY --from=build /target/currency-conversion-${APP_VERSION}.jar service.jar 15 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Dspring.profiles.active=dev","-jar","/service.jar"] 16 | -------------------------------------------------------------------------------- /math/src/main/java/com/ubaid/ms/math/config/Beans.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.math.config; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import org.springframework.beans.factory.config.ConfigurableBeanFactory; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Scope; 7 | 8 | public class Beans { 9 | 10 | @Bean 11 | @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) 12 | public ObjectMapper objectMapper() { 13 | return new ObjectMapper(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /user/src/main/java/com/ubaid/ms/user/config/Beans.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.user.config; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import org.springframework.beans.factory.config.ConfigurableBeanFactory; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Scope; 7 | 8 | public class Beans { 9 | 10 | @Bean 11 | @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) 12 | public ObjectMapper objectMapper() { 13 | return new ObjectMapper(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /country/src/main/java/com/ubaid/ms/country/config/Beans.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.country.config; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import org.springframework.beans.factory.config.ConfigurableBeanFactory; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Scope; 7 | 8 | public class Beans { 9 | 10 | @Bean 11 | @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) 12 | public ObjectMapper objectMapper() { 13 | return new ObjectMapper(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /audit/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /envcn/elasticsearch/config/elasticsearch.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ## Default Elasticsearch configuration from Elasticsearch base image. 3 | ## https://github.com/elastic/elasticsearch/blob/master/distribution/docker/src/docker/config/elasticsearch.yml 4 | # 5 | cluster.name: "docker-cluster" 6 | network.host: 0.0.0.0 7 | 8 | ## X-Pack settings 9 | ## see https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-xpack.html 10 | # 11 | xpack.license.self_generated.type: trial 12 | xpack.security.enabled: false 13 | xpack.monitoring.collection.enabled: true 14 | -------------------------------------------------------------------------------- /user/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /api-gateway/src/main/java/com/ubaid/ms/apigateway/config/Beans.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.apigateway.config; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import org.springframework.beans.factory.config.ConfigurableBeanFactory; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Scope; 7 | 8 | public class Beans { 9 | 10 | @Bean 11 | @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) 12 | public ObjectMapper objectMapper() { 13 | return new ObjectMapper(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /country/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /currency-exchange/src/main/java/com/ubaid/ms/currencyexchangeservice/dao/ExchangeRateDAO.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyexchangeservice.dao; 2 | 3 | import com.ubaid.ms.currencyexchangeservice.entity.ExchangeRate; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.Optional; 8 | 9 | @Repository 10 | public interface ExchangeRateDAO extends JpaRepository { 11 | Optional findByFromCurrencyAndToCurrency(String from, String to); 12 | } 13 | -------------------------------------------------------------------------------- /currency-conversion/src/main/java/com/ubaid/ms/currencyconversion/config/MessageBrokerConfig.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyconversion.config; 2 | 3 | import org.springframework.amqp.core.Queue; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import static com.ubaid.ms.common.util.Constants.AUDIT_QUEUE; 7 | 8 | @Configuration 9 | public class MessageBrokerConfig { 10 | 11 | @Bean 12 | public Queue auditQueue() { 13 | return new Queue(AUDIT_QUEUE, false); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /currency-exchange/src/main/java/com/ubaid/ms/currencyexchangeservice/config/Config.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyexchangeservice.config; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | import org.springframework.stereotype.Component; 7 | 8 | @ConfigurationProperties(prefix = "fixer.io") 9 | @Component 10 | @Data 11 | @NoArgsConstructor 12 | public class Config { 13 | private String baseURL; 14 | private String apiKey; 15 | private String localStoragePath; 16 | } 17 | -------------------------------------------------------------------------------- /common/exception/src/main/java/com/ubaid/ms/common/util/exception/ExchangeValueNotFound.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.common.util.exception; 2 | 3 | public class ExchangeValueNotFound extends CCException{ 4 | 5 | public ExchangeValueNotFound(Throwable cause) { 6 | super(cause); 7 | } 8 | 9 | public ExchangeValueNotFound(String message, Throwable cause) { 10 | super(message, cause); 11 | } 12 | 13 | public ExchangeValueNotFound(String message) { 14 | super(message); 15 | } 16 | 17 | public ExchangeValueNotFound() { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /currency-conversion/src/main/java/com/ubaid/ms/currencyconversion/config/Beans.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyconversion.config; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import org.springframework.beans.factory.config.ConfigurableBeanFactory; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Scope; 7 | 8 | public class Beans { 9 | 10 | @Bean 11 | @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) 12 | public ObjectMapper objectMapper() { 13 | return new ObjectMapper(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /clients/3cn-react-client/src/store/actions/SelectCountryAction.js: -------------------------------------------------------------------------------- 1 | import {SELECT_TO_COUNTRY, SELECT_FROM_COUNTRY} from 'store/ActionTypes'; 2 | 3 | export const SelectFromCountry = (country) => { 4 | console.log('SelectFromCountry: country ----> ', country); 5 | return { 6 | type: SELECT_FROM_COUNTRY, 7 | country: country 8 | }; 9 | }; 10 | 11 | export const SelectToCountry = (country) => { 12 | console.log('SelectToCountry: country ----> ', country); 13 | return { 14 | type: SELECT_TO_COUNTRY, 15 | country: country 16 | }; 17 | }; 18 | -------------------------------------------------------------------------------- /clients/3cn-react-client/src/store/reducers/SelectCountryReducer.js: -------------------------------------------------------------------------------- 1 | import {SELECT_FROM_COUNTRY, SELECT_TO_COUNTRY} from 'store/ActionTypes'; 2 | 3 | const initialState = { 4 | fromCountry: null, 5 | toCountry: null 6 | }; 7 | 8 | export const SelectCountryReducer = (state = initialState, action) => { 9 | switch (action.type) { 10 | case SELECT_FROM_COUNTRY: 11 | return {...state, fromCountry: action.country}; 12 | case SELECT_TO_COUNTRY: 13 | return {...state, toCountry: action.country}; 14 | default: 15 | return state; 16 | } 17 | }; 18 | -------------------------------------------------------------------------------- /audit/src/main/java/com/ubaid/ms/AuditApplication.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms; 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.web.reactive.config.EnableWebFlux; 7 | 8 | @SpringBootApplication 9 | @EnableDiscoveryClient 10 | @EnableWebFlux 11 | public class AuditApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(AuditApplication.class, args); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /audit/src/main/java/com/ubaid/ms/audit/dao/AuditDAO.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.audit.dao; 2 | 3 | import com.ubaid.ms.audit.entity.Audit; 4 | import org.springframework.data.r2dbc.repository.Query; 5 | import org.springframework.data.r2dbc.repository.R2dbcRepository; 6 | import reactor.core.publisher.Flux; 7 | import reactor.core.publisher.Mono; 8 | 9 | public interface AuditDAO extends R2dbcRepository { 10 | Flux findAllByUserUuid(String userUUID); 11 | 12 | @Query(value = "UPDATE audit SET is_deleted=true WHERE id = :id") 13 | Mono delete(Long id); 14 | } 15 | -------------------------------------------------------------------------------- /currency-exchange/src/main/java/com/ubaid/ms/currencyexchangeservice/config/Beans.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyexchangeservice.config; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import org.springframework.beans.factory.config.ConfigurableBeanFactory; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Scope; 7 | 8 | public class Beans { 9 | 10 | @Bean 11 | @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) 12 | public ObjectMapper objectMapper() { 13 | return new ObjectMapper(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /audit/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #----------------------------SApplication config-----------------------------------# 2 | spring.application.name=audit 3 | server.port=8950 4 | 5 | #----------------------------Active Profile----------------------------------------# 6 | spring.profiles.active=@activatedProperties@ 7 | 8 | #----------------------------Static IP---------------------------------------------# 9 | eureka.instance.prefer-ip-address=true 10 | eureka.instance.instance-id=${spring.cloud.client.ip-address}:${server.port} 11 | eureka.instance.hostname=${spring.cloud.client.ip-address} 12 | -------------------------------------------------------------------------------- /user/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #----------------------------SApplication config-----------------------------------# 2 | spring.application.name=user 3 | server.port=8900 4 | 5 | #----------------------------Active Profile----------------------------------------# 6 | spring.profiles.active=@activatedProperties@ 7 | 8 | #----------------------------Static IP---------------------------------------------# 9 | eureka.instance.prefer-ip-address=true 10 | eureka.instance.instance-id=${spring.cloud.client.ip-address}:${server.port} 11 | eureka.instance.hostname=${spring.cloud.client.ip-address} 12 | -------------------------------------------------------------------------------- /common/util/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | com.ubaid.ms.common 5 | common 6 | 0.0.3-SNAPSHOT 7 | 8 | 4.0.0 9 | 10 | util 11 | 0.0.3-SNAPSHOT 12 | Util 13 | 14 | -------------------------------------------------------------------------------- /currency-exchange/src/main/java/com/ubaid/ms/currencyexchangeservice/aop/TargetMethods.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyexchangeservice.aop; 2 | 3 | import org.aspectj.lang.annotation.Pointcut; 4 | 5 | public abstract class TargetMethods { 6 | 7 | @Pointcut("execution(* com.ubaid.ms.currencyexchangeservice.service.ExchangeRateService.getExchangeValue(String, String))") 8 | public void getExchangeValue() {} 9 | 10 | @Pointcut("execution(* com.ubaid.ms.currencyexchangeservice.task.PopulateDBWithExchangeRates.populateDbWithExchangeRates())") 11 | public void fetchExchangeRatesFromFixerDotIO() {} 12 | } -------------------------------------------------------------------------------- /country/src/main/java/com/ubaid/ms/country/entity/CountryCode.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.country.entity; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | 6 | import javax.persistence.*; 7 | 8 | @Entity 9 | @Table 10 | @Data 11 | @NoArgsConstructor 12 | public class CountryCode { 13 | 14 | @Id 15 | @GeneratedValue(strategy = GenerationType.IDENTITY) 16 | private Long id; 17 | 18 | private String country; 19 | 20 | private String currencyName; 21 | 22 | private String currencyCode; 23 | 24 | private Integer number; 25 | 26 | private String isoCode; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /audit/src/main/resources/db/migration/V1__gh_301_create_audit_table.sql: -------------------------------------------------------------------------------- 1 | create table audit ( 2 | id bigint primary key auto_increment, 3 | created_at timestamp, 4 | currency_conversion_port int, 5 | currency_conversion_url varchar(255), 6 | currency_exchange_port int, 7 | currency_exchange_url varchar(255), 8 | exchange_rate float, 9 | from_currency varchar(255), 10 | from_currency_value float, 11 | to_currency varchar(255), 12 | to_currency_value float, 13 | is_deleted boolean, 14 | last_updated timestamp, 15 | user_ip_address varchar(255), 16 | user_uuid varchar(255) 17 | ) -------------------------------------------------------------------------------- /clients/3cn-react-client/src/component/userinfo/UserInfo.js: -------------------------------------------------------------------------------- 1 | import {useKeycloak} from '@react-keycloak/web'; 2 | import React from 'react'; 3 | 4 | const UserInfo = () => { 5 | const { keycloak, initialized } = useKeycloak(); 6 | 7 | if (keycloak && initialized && keycloak.authenticated) { 8 | return ( 9 |
10 | Hello {keycloak.tokenParsed.preferred_username} 11 | 14 |
15 | ); 16 | } 17 | }; 18 | export default UserInfo; 19 | -------------------------------------------------------------------------------- /common/exception/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4.0.0 5 | 6 | 7 | com.ubaid.ms.common 8 | common 9 | 0.0.3-SNAPSHOT 10 | 11 | 12 | exception 13 | 0.0.3-SNAPSHOT 14 | Exception 15 | 16 | -------------------------------------------------------------------------------- /audit/src/main/java/com/ubaid/ms/audit/service/AuditService.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.audit.service; 2 | 3 | import com.ubaid.ms.audit.entity.Audit; 4 | import reactor.core.publisher.Flux; 5 | import reactor.core.publisher.Mono; 6 | 7 | import java.security.Principal; 8 | 9 | public interface AuditService { 10 | Mono findById(Long id); 11 | Flux findAllByUserUUID(Principal principal); 12 | Flux findAll(); 13 | Mono save(Principal principal, Audit audit); 14 | Mono update(Principal principal, Audit audit); 15 | void save(Audit audit); 16 | Mono delete(Long id); 17 | } 18 | -------------------------------------------------------------------------------- /clients/3cn-react-client/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /currency-conversion/src/main/java/com/ubaid/ms/currencyconversion/config/Config.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.currencyconversion.config; 2 | 3 | import lombok.Data; 4 | import lombok.NoArgsConstructor; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * and define the prefix 10 | * same as in the application.properties file 11 | * 12 | * @author UbaidurRehman 13 | */ 14 | 15 | @ConfigurationProperties(prefix = "ls") 16 | @Component 17 | @Data 18 | @NoArgsConstructor 19 | public class Config { 20 | private int min; 21 | private int max; 22 | } 23 | -------------------------------------------------------------------------------- /api-gateway/src/main/java/com/ubaid/ms/apigateway/ApiGateway.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.apigateway; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | /** 8 | * Re-routes the incoming request to down-stream services according to the URL match pattern. 9 | * 10 | * @author ubaid 11 | */ 12 | @EnableDiscoveryClient 13 | @SpringBootApplication 14 | public class ApiGateway { 15 | public static void main(String[] args) { 16 | SpringApplication.run(ApiGateway.class, args); 17 | } 18 | } -------------------------------------------------------------------------------- /clients/3cn-react-client/src/store/ActionTypes.js: -------------------------------------------------------------------------------- 1 | export const POPULATE_COUNTRIES_START = 'POPULATE_COUNTRIES_START'; 2 | export const POPULATE_COUNTRIES_FINISHED = 'POPULATE_COUNTRIES_FINISHED'; 3 | export const POPULATE_COUNTRIES_ERROR = 'POPULATE_COUNTRIES_ERROR'; 4 | 5 | export const SELECT_TO_COUNTRY = 'SELECT_TO_COUNTRY'; 6 | export const SELECT_FROM_COUNTRY = 'SELECT_FROM_COUNTRY'; 7 | 8 | export const CONVERT_CURRENCY_START = 'CONVERT_CURRENCY_START'; 9 | export const CONVERT_CURRENCY_COMPLETE = 'CONVERT_CURRENCY_COMPLETE'; 10 | export const CONVERT_CURRENCY_ERROR = 'CONVERT_CURRENCY_ERROR'; 11 | 12 | export const ADD_ACCESS_TOKEN = 'ADD_ACCESS_TOKEN'; 13 | -------------------------------------------------------------------------------- /envcn/run-multi-stage.sh: -------------------------------------------------------------------------------- 1 | docker pull ubaidurehman/3cn-parent:0.0.3-SNAPSHOT; 2 | #Cleaing Database so, that, we can run /docker-entrypoint-initdb.d/init.sql (gh-370) 3 | #If there is data inside the database then /docker-entrypoint-initdb.d/init.sql not running 4 | docker container stop cn-db; 5 | docker container rm cn-db; 6 | docker volume rm envcn_cloud-native-volume; 7 | 8 | #There is a random error (gh-282) when starting auth-server. 9 | #To remove the possibility of gh-282, we are removing auth-db data. 10 | docker container stop auth-db; 11 | docker container rm auth-db; 12 | docker volume rm envcn_auth-db-volume; 13 | 14 | docker-compose -f docker-compose-multi-stage-build.yml up --build -------------------------------------------------------------------------------- /resource/3cn-parent-image/readme.md: -------------------------------------------------------------------------------- 1 | ## Building 3cn-parent image 2 | We can build 3cn-parent image from scratch by running `build-3cn-parent-image.sh` 3 | The above script simply install the whole on maven instance. This building requires some time as this project need to download all libraries. 4 | After downloading, it simply creates an image `3cn-parent:0.0.1-SNAPSHOT` 5 | 6 | ## Updating 3cn-parent image 7 | We can update the 3cn-parent image by executing `update-3cn-parent-image`. The above script run the `Dockerfile.update-3cn-parent` which simply reinstall the whole project on `3cn-parent:0.0.1-SNAPSHOT` 8 | 9 | ## Pushing to Dockerhub Registry 10 | `docker push 3cn-parent:0.0.1-SNAPSHOT` -------------------------------------------------------------------------------- /country/src/main/java/com/ubaid/ms/CountryApplication.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms; 2 | 3 | import brave.sampler.Sampler; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | import org.springframework.context.annotation.Bean; 8 | 9 | @SpringBootApplication 10 | @EnableDiscoveryClient 11 | public class CountryApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(CountryApplication.class, args); 15 | } 16 | 17 | @Bean 18 | public Sampler defaultSampler() { 19 | return Sampler.ALWAYS_SAMPLE; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /math/src/main/java/com/ubaid/ms/math/MathApplication.java: -------------------------------------------------------------------------------- 1 | package com.ubaid.ms.math; 2 | 3 | import brave.sampler.Sampler; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | import org.springframework.context.annotation.Bean; 8 | 9 | 10 | @SpringBootApplication 11 | @EnableDiscoveryClient 12 | public class MathApplication { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(MathApplication.class, args); 16 | } 17 | 18 | @Bean 19 | public Sampler defaultSampler() { 20 | return Sampler.ALWAYS_SAMPLE; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /clients/3cn-react-client/src/hoc/Layout/Layout.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import CssBaseline from '@material-ui/core/CssBaseline'; 3 | import Container from '@material-ui/core/Container'; 4 | import PropTypes from 'prop-types'; 5 | import Header from 'component/header/Header'; 6 | import Footer from 'component/footer/Footer'; 7 | 8 | const Layout = props => { 9 | return ( 10 | <> 11 | 12 |
13 | 14 | {props.children} 15 | 16 |