├── chapter13 ├── scripts │ ├── keycloak-operator │ │ ├── deploy │ │ │ ├── empty-init.yaml │ │ │ ├── namespace.yaml │ │ │ ├── service_account.yaml │ │ │ ├── role_binding.yaml │ │ │ ├── cluster_roles │ │ │ │ └── cluster_role_binding.yaml │ │ │ ├── kustomization.yaml │ │ │ └── operator.yaml │ │ ├── hack │ │ │ ├── boilerplate.go.txt │ │ │ ├── keycloak-postgresql-pvc.yaml │ │ │ └── modify_etc_hosts.sh │ │ └── Dockerfile │ ├── getcert.sh │ ├── keycloak_ingress.yml │ ├── keycloak_install.yml │ ├── createpem.sh │ ├── bank_realm.yml │ └── gettoken.sh ├── bank-service │ ├── application.yaml │ ├── .dockerignore │ ├── .mvn │ │ └── wrapper │ │ │ ├── maven-wrapper.jar │ │ │ └── maven-wrapper.properties │ ├── .gitignore │ └── src │ │ └── main │ │ ├── java │ │ └── quarkus │ │ │ └── bank │ │ │ ├── BankSupportConfig.java │ │ │ ├── BankSupportConfigMapping.java │ │ │ └── TokenResource.java │ │ ├── docker │ │ ├── Dockerfile.native-distroless │ │ └── Dockerfile.native │ │ └── resources │ │ └── application.properties ├── account-service │ ├── src │ │ └── main │ │ │ ├── java │ │ │ └── quarkus │ │ │ │ └── accounts │ │ │ │ ├── AccountStatus.java │ │ │ │ ├── AlwaysHealthyLivenessCheck.java │ │ │ │ └── Account.java │ │ │ ├── docker │ │ │ ├── Dockerfile.native-distroless │ │ │ └── Dockerfile.native │ │ │ └── resources │ │ │ ├── import.sql │ │ │ └── application.properties │ └── README.md ├── transaction-service │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── quarkus │ │ │ └── transactions │ │ │ ├── AccountNotFoundException.java │ │ │ ├── CustomGroupLivenessCheck.java │ │ │ ├── AccountRequestFilter.java │ │ │ ├── AccountExceptionMapper.java │ │ │ └── AccountServiceProgrammatic.java │ │ └── test │ │ └── java │ │ └── io │ │ └── quarkus │ │ └── transactions │ │ ├── TransactionServiceTest.java │ │ └── SecurityTest.java └── postgresql_kubernetes.yml ├── chapter2 ├── generated │ └── src │ │ ├── main │ │ ├── resources │ │ │ └── application.properties │ │ ├── java │ │ │ └── quarkus │ │ │ │ └── GreetingResource.java │ │ └── docker │ │ │ ├── Dockerfile.native-distroless │ │ │ └── Dockerfile.native │ │ └── test │ │ └── java │ │ └── quarkus │ │ ├── NativeGreetingResourceIT.java │ │ └── GreetingResourceTest.java ├── account-service │ └── src │ │ ├── main │ │ ├── java │ │ │ └── quarkus │ │ │ │ └── accounts │ │ │ │ └── AccountStatus.java │ │ ├── resources │ │ │ └── application.properties │ │ └── docker │ │ │ ├── Dockerfile.native-distroless │ │ │ └── Dockerfile.native │ │ └── test │ │ └── java │ │ └── quarkus │ │ └── accounts │ │ └── NativeAccountResourceIT.java └── pom.xml ├── .gitignore ├── chapter9 ├── bank-service │ ├── application.yaml │ ├── .dockerignore │ ├── .gitignore │ └── src │ │ └── main │ │ ├── java │ │ └── quarkus │ │ │ └── bank │ │ │ └── BankSupportConfig.java │ │ ├── resources │ │ └── application.properties │ │ └── docker │ │ ├── Dockerfile.native-distroless │ │ └── Dockerfile.native ├── spring-config-server │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── application.properties │ │ │ └── java │ │ │ └── org │ │ │ └── acme │ │ │ └── configserver │ │ │ └── ConfigServerApplication.java │ ├── .gitignore │ ├── banking-config-repository │ │ └── banking-client.properties │ └── minikube.yml ├── account-service │ ├── src │ │ └── main │ │ │ ├── java │ │ │ └── quarkus │ │ │ │ └── accounts │ │ │ │ ├── AccountStatus.java │ │ │ │ ├── AccountRepository.java │ │ │ │ └── AlwaysHealthyLivenessCheck.java │ │ │ ├── docker │ │ │ ├── Dockerfile.native-distroless │ │ │ └── Dockerfile.native │ │ │ └── resources │ │ │ ├── application.properties │ │ │ └── import.sql │ └── README.md ├── transaction-service │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── quarkus │ │ │ │ └── transactions │ │ │ │ ├── AccountNotFoundException.java │ │ │ │ ├── CustomGroupLivenessCheck.java │ │ │ │ ├── AccountRequestFilter.java │ │ │ │ ├── AccountExceptionMapper.java │ │ │ │ └── AccountServiceProgrammatic.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── io │ │ └── quarkus │ │ └── transactions │ │ └── TransactionServiceTest.java └── postgresql_kubernetes.yml ├── chapter3 └── bank-service │ ├── application.yaml │ ├── .dockerignore │ ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties │ ├── .gitignore │ └── src │ └── main │ ├── java │ └── quarkus │ │ └── bank │ │ ├── BankSupportConfig.java │ │ └── BankSupportConfigMapping.java │ ├── docker │ ├── Dockerfile.native-distroless │ └── Dockerfile.native │ └── resources │ └── application.properties ├── README.md ├── chapter10 ├── metrics │ ├── manifests-prometheus-grafana │ │ ├── setup │ │ │ ├── 0namespace-namespace.yaml │ │ │ ├── prometheus-operator-serviceAccount.yaml │ │ │ ├── prometheus-operator-service.yaml │ │ │ └── prometheus-operator-clusterRoleBinding.yaml │ │ ├── grafana-serviceAccount.yaml │ │ ├── node-exporter-serviceAccount.yaml │ │ ├── prometheus-serviceAccount.yaml │ │ ├── alertmanager-serviceAccount.yaml │ │ ├── prometheus-adapter-serviceAccount.yaml │ │ ├── kube-state-metrics-serviceAccount.yaml │ │ ├── prometheus-roleConfig.yaml │ │ ├── grafana-service.yaml │ │ ├── grafana-serviceMonitor.yaml │ │ ├── prometheus-adapter-clusterRoleServerResources.yaml │ │ ├── prometheus-clusterRole.yaml │ │ ├── prometheus-adapter-clusterRole.yaml │ │ ├── prometheus-adapter-service.yaml │ │ ├── prometheus-serviceMonitor.yaml │ │ ├── alertmanager-serviceMonitor.yaml │ │ ├── node-exporter-clusterRoleBinding.yaml │ │ ├── prometheus-clusterRoleBinding.yaml │ │ ├── prometheus-service.yaml │ │ ├── alertmanager-service.yaml │ │ ├── prometheus-adapter-clusterRoleBinding.yaml │ │ ├── prometheus-adapter-apiService.yaml │ │ ├── prometheus-roleBindingConfig.yaml │ │ ├── node-exporter-clusterRole.yaml │ │ ├── prometheus-adapter-clusterRoleBindingDelegator.yaml │ │ ├── node-exporter-service.yaml │ │ ├── prometheus-adapter-roleBindingAuthReader.yaml │ │ ├── kube-state-metrics-clusterRoleBinding.yaml │ │ ├── alertmanager-alertmanager.yaml │ │ ├── kube-state-metrics-service.yaml │ │ ├── prometheus-serviceMonitorCoreDNS.yaml │ │ ├── prometheus-adapter-serviceMonitor.yaml │ │ ├── prometheus-adapter-clusterRoleAggregatedMetricsReader.yaml │ │ ├── grafana-dashboardSources.yaml │ │ ├── grafana-dashboardDatasources.yaml │ │ ├── prometheus-serviceMonitorKubeScheduler.yaml │ │ ├── prometheus-operator-serviceMonitor.yaml │ │ ├── node-exporter-serviceMonitor.yaml │ │ ├── prometheus-prometheus.yaml │ │ ├── kube-state-metrics-serviceMonitor.yaml │ │ ├── alertmanager-secret.yaml │ │ └── prometheus-roleBindingSpecificNamespaces.yaml │ ├── scripts │ │ ├── run_all.sh │ │ ├── invoke_deposit_endpoints.sh │ │ └── overload_bulkhead.sh │ └── servicemonitor.yml ├── account-service │ ├── src │ │ └── main │ │ │ ├── java │ │ │ └── quarkus │ │ │ │ └── accounts │ │ │ │ ├── AccountStatus.java │ │ │ │ ├── AlwaysHealthyLivenessCheck.java │ │ │ │ └── Account.java │ │ │ ├── docker │ │ │ ├── Dockerfile.native-distroless │ │ │ └── Dockerfile.native │ │ │ └── resources │ │ │ ├── application.properties │ │ │ └── import.sql │ └── README.md ├── micrometer-account-service │ ├── src │ │ ├── main │ │ │ ├── java │ │ │ │ └── quarkus │ │ │ │ │ └── accounts │ │ │ │ │ └── micrometer │ │ │ │ │ └── AccountStatus.java │ │ │ ├── docker │ │ │ │ ├── Dockerfile.native-distroless │ │ │ │ └── Dockerfile.native │ │ │ └── resources │ │ │ │ ├── application.properties │ │ │ │ └── import.sql │ │ └── test │ │ │ └── java │ │ │ └── quarkus │ │ │ └── accounts │ │ │ └── micrometer │ │ │ └── NativeAccountResourceIT.java │ ├── service-monitor.yml │ └── postgresql_kubernetes.yml ├── transaction-service │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── quarkus │ │ │ │ └── transactions │ │ │ │ ├── AccountNotFoundException.java │ │ │ │ ├── CustomGroupLivenessCheck.java │ │ │ │ ├── AccountRequestFilter.java │ │ │ │ ├── AccountExceptionMapper.java │ │ │ │ └── AccountServiceProgrammatic.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── io │ │ └── quarkus │ │ └── transactions │ │ └── TransactionServiceTest.java └── postgresql_kubernetes.yml ├── chapter4 ├── jpa │ └── src │ │ ├── main │ │ ├── java │ │ │ └── quarkus │ │ │ │ └── accounts │ │ │ │ └── jpa │ │ │ │ └── AccountStatus.java │ │ ├── resources │ │ │ ├── application.properties │ │ │ └── import.sql │ │ └── docker │ │ │ ├── Dockerfile.native-distroless │ │ │ └── Dockerfile.native │ │ └── test │ │ └── java │ │ └── quarkus │ │ └── accounts │ │ └── jpa │ │ └── NativeAccountResourceIT.java ├── active-record │ └── src │ │ ├── main │ │ ├── java │ │ │ └── quarkus │ │ │ │ └── accounts │ │ │ │ └── activerecord │ │ │ │ └── AccountStatus.java │ │ ├── docker │ │ │ ├── Dockerfile.native-distroless │ │ │ └── Dockerfile.native │ │ └── resources │ │ │ ├── application.properties │ │ │ └── import.sql │ │ └── test │ │ └── java │ │ └── quarkus │ │ └── accounts │ │ └── activerecord │ │ └── NativeAccountResourceIT.java ├── data-repository │ └── src │ │ ├── main │ │ ├── java │ │ │ └── quarkus │ │ │ │ └── accounts │ │ │ │ └── repository │ │ │ │ ├── AccountStatus.java │ │ │ │ └── AccountRepository.java │ │ ├── resources │ │ │ ├── application.properties │ │ │ └── import.sql │ │ └── docker │ │ │ ├── Dockerfile.native-distroless │ │ │ └── Dockerfile.native │ │ └── test │ │ └── java │ │ └── quarkus │ │ └── accounts │ │ └── repository │ │ └── NativeAccountResourceIT.java ├── README.md └── postgresql_kubernetes.yml ├── chapter11 ├── account-service │ └── src │ │ ├── main │ │ ├── java │ │ │ └── quarkus │ │ │ │ └── accounts │ │ │ │ ├── AccountStatus.java │ │ │ │ ├── events │ │ │ │ ├── OverdraftLimitUpdate.java │ │ │ │ └── Overdrawn.java │ │ │ │ └── OverdraftLimitUpdateDeserializer.java │ │ └── docker │ │ │ ├── Dockerfile.native-distroless │ │ │ └── Dockerfile.native │ │ └── test │ │ └── java │ │ └── quarkus │ │ └── accounts │ │ └── InMemoryLifecycleManager.java ├── transaction-service │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── quarkus │ │ │ └── transactions │ │ │ ├── AccountStatus.java │ │ │ ├── AccountNotFoundException.java │ │ │ ├── Account.java │ │ │ ├── AccountService.java │ │ │ └── TransactionResource.java │ │ └── resources │ │ └── application.properties ├── overdraft-service │ └── src │ │ ├── main │ │ ├── java │ │ │ └── quarkus │ │ │ │ └── overdraft │ │ │ │ ├── events │ │ │ │ ├── AccountFee.java │ │ │ │ ├── OverdraftLimitUpdate.java │ │ │ │ └── Overdrawn.java │ │ │ │ ├── model │ │ │ │ ├── AccountOverdraft.java │ │ │ │ └── CustomerOverdraft.java │ │ │ │ └── OverdrawnDeserializer.java │ │ └── docker │ │ │ ├── Dockerfile.native-distroless │ │ │ └── Dockerfile.native │ │ └── test │ │ └── java │ │ └── quarkus │ │ └── overdraft │ │ └── InMemoryLifecycleManager.java ├── kafka_topics.yml ├── kafka_cluster.yml └── postgresql_kubernetes.yml ├── chapter5 ├── account-service │ └── src │ │ └── main │ │ ├── java │ │ └── quarkus │ │ │ └── accounts │ │ │ ├── AccountStatus.java │ │ │ └── Account.java │ │ ├── resources │ │ ├── application.properties │ │ └── import.sql │ │ └── docker │ │ ├── Dockerfile.native-distroless │ │ └── Dockerfile.native ├── transaction-service │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── quarkus │ │ │ │ └── transactions │ │ │ │ ├── AccountNotFoundException.java │ │ │ │ ├── AccountRequestFilter.java │ │ │ │ ├── AccountExceptionMapper.java │ │ │ │ └── AccountServiceProgrammatic.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── io │ │ └── quarkus │ │ └── transactions │ │ ├── TransactionServiceTest.java │ │ └── WiremockAccountService.java ├── README.md └── postgresql_kubernetes.yml ├── chapter6 ├── account-service │ ├── src │ │ └── main │ │ │ ├── java │ │ │ └── quarkus │ │ │ │ └── accounts │ │ │ │ ├── AccountStatus.java │ │ │ │ ├── AlwaysHealthyLivenessCheck.java │ │ │ │ └── Account.java │ │ │ ├── docker │ │ │ ├── Dockerfile.native-distroless │ │ │ └── Dockerfile.native │ │ │ └── resources │ │ │ ├── application.properties │ │ │ └── import.sql │ └── README.md ├── transaction-service │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── quarkus │ │ │ │ └── transactions │ │ │ │ ├── AccountNotFoundException.java │ │ │ │ ├── CustomGroupLivenessCheck.java │ │ │ │ ├── AccountRequestFilter.java │ │ │ │ ├── AccountExceptionMapper.java │ │ │ │ └── AccountServiceProgrammatic.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── io │ │ └── quarkus │ │ └── transactions │ │ └── TransactionServiceTest.java └── postgresql_kubernetes.yml ├── chapter7 ├── account-service │ ├── src │ │ └── main │ │ │ ├── java │ │ │ └── quarkus │ │ │ │ └── accounts │ │ │ │ ├── AccountStatus.java │ │ │ │ ├── AlwaysHealthyLivenessCheck.java │ │ │ │ └── Account.java │ │ │ ├── docker │ │ │ ├── Dockerfile.native-distroless │ │ │ └── Dockerfile.native │ │ │ └── resources │ │ │ ├── application.properties │ │ │ └── import.sql │ └── README.md ├── transaction-service │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── quarkus │ │ │ │ └── transactions │ │ │ │ ├── AccountNotFoundException.java │ │ │ │ ├── CustomGroupLivenessCheck.java │ │ │ │ ├── AccountRequestFilter.java │ │ │ │ ├── AccountExceptionMapper.java │ │ │ │ └── AccountServiceProgrammatic.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── io │ │ └── quarkus │ │ └── transactions │ │ └── TransactionServiceTest.java └── postgresql_kubernetes.yml ├── chapter8 ├── account-service │ └── src │ │ ├── main │ │ ├── java │ │ │ └── quarkus │ │ │ │ └── accounts │ │ │ │ ├── AccountStatus.java │ │ │ │ ├── events │ │ │ │ ├── OverdraftLimitUpdate.java │ │ │ │ └── Overdrawn.java │ │ │ │ └── OverdraftLimitUpdateDeserializer.java │ │ ├── docker │ │ │ ├── Dockerfile.native-distroless │ │ │ └── Dockerfile.native │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── quarkus │ │ └── accounts │ │ └── InMemoryLifecycleManager.java ├── overdraft-service │ └── src │ │ ├── main │ │ ├── java │ │ │ └── quarkus │ │ │ │ └── overdraft │ │ │ │ ├── events │ │ │ │ ├── AccountFee.java │ │ │ │ ├── OverdraftLimitUpdate.java │ │ │ │ └── Overdrawn.java │ │ │ │ ├── model │ │ │ │ ├── AccountOverdraft.java │ │ │ │ └── CustomerOverdraft.java │ │ │ │ └── OverdrawnDeserializer.java │ │ ├── docker │ │ │ ├── Dockerfile.native-distroless │ │ │ └── Dockerfile.native │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── quarkus │ │ └── overdraft │ │ └── InMemoryLifecycleManager.java ├── kafka_topics.yml ├── kafka_cluster.yml └── postgresql_kubernetes.yml ├── chapter12 ├── account-service-annotations │ └── src │ │ ├── main │ │ ├── java │ │ │ └── quarkus │ │ │ │ └── accounts │ │ │ │ ├── AccountStatus.java │ │ │ │ └── OpenApiFilter.java │ │ ├── docker │ │ │ ├── Dockerfile.native-distroless │ │ │ └── Dockerfile.native │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── quarkus │ │ └── accounts │ │ └── NativeAccountResourceIT.java ├── account-service-external-openapi │ └── src │ │ ├── main │ │ ├── java │ │ │ └── quarkus │ │ │ │ └── accounts │ │ │ │ └── AccountStatus.java │ │ ├── resources │ │ │ └── application.properties │ │ └── docker │ │ │ ├── Dockerfile.native-distroless │ │ │ └── Dockerfile.native │ │ └── test │ │ └── java │ │ └── quarkus │ │ └── accounts │ │ └── NativeAccountResourceIT.java └── pom.xml └── pom.xml /chapter13/scripts/keycloak-operator/deploy/empty-init.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter13/scripts/keycloak-operator/hack/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chapter2/generated/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .git 3 | target 4 | .DS_STORE 5 | .java-version 6 | -------------------------------------------------------------------------------- /chapter9/bank-service/application.yaml: -------------------------------------------------------------------------------- 1 | bank: 2 | name:Bank of ConfigMap -------------------------------------------------------------------------------- /chapter3/bank-service/application.yaml: -------------------------------------------------------------------------------- 1 | bank: 2 | name: Bank of ConfigMap 3 | -------------------------------------------------------------------------------- /chapter13/bank-service/application.yaml: -------------------------------------------------------------------------------- 1 | bank: 2 | name: Bank of ConfigMap 3 | -------------------------------------------------------------------------------- /chapter13/bank-service/.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !target/*-runner 3 | !target/*-runner.jar 4 | !target/lib/* 5 | !target/quarkus-app/* -------------------------------------------------------------------------------- /chapter3/bank-service/.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !target/*-runner 3 | !target/*-runner.jar 4 | !target/lib/* 5 | !target/quarkus-app/* -------------------------------------------------------------------------------- /chapter9/bank-service/.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !target/*-runner 3 | !target/*-runner.jar 4 | !target/lib/* 5 | !target/quarkus-app/* -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # manning-kube-native-microservices 2 | "Kubernetes Native Microservices with Quarkus and MicroProfile" book contents 3 | -------------------------------------------------------------------------------- /chapter13/scripts/keycloak-operator/deploy/namespace.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: keycloak 5 | -------------------------------------------------------------------------------- /chapter13/scripts/keycloak-operator/deploy/service_account.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: keycloak-operator 5 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/setup/0namespace-namespace.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: monitoring 5 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/grafana-serviceAccount.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: grafana 5 | namespace: monitoring 6 | -------------------------------------------------------------------------------- /chapter3/bank-service/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jclingan/manning-kube-native-microservices/HEAD/chapter3/bank-service/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /chapter13/bank-service/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jclingan/manning-kube-native-microservices/HEAD/chapter13/bank-service/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /chapter4/jpa/src/main/java/quarkus/accounts/jpa/AccountStatus.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts.jpa; 2 | 3 | public enum AccountStatus { 4 | OPEN, 5 | CLOSED, 6 | OVERDRAWN 7 | } 8 | -------------------------------------------------------------------------------- /chapter9/spring-config-server/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=18888 2 | spring.cloud.config.server.git.uri=https://github.com/jclingan/banking-config-repository/ 3 | -------------------------------------------------------------------------------- /chapter10/account-service/src/main/java/quarkus/accounts/AccountStatus.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | public enum AccountStatus { 4 | OPEN, 5 | CLOSED, 6 | OVERDRAWN 7 | } 8 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/node-exporter-serviceAccount.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: node-exporter 5 | namespace: monitoring 6 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-serviceAccount.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: prometheus-k8s 5 | namespace: monitoring 6 | -------------------------------------------------------------------------------- /chapter11/account-service/src/main/java/quarkus/accounts/AccountStatus.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | public enum AccountStatus { 4 | OPEN, 5 | CLOSED, 6 | OVERDRAWN 7 | } 8 | -------------------------------------------------------------------------------- /chapter13/account-service/src/main/java/quarkus/accounts/AccountStatus.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | public enum AccountStatus { 4 | OPEN, 5 | CLOSED, 6 | OVERDRAWN 7 | } 8 | -------------------------------------------------------------------------------- /chapter2/account-service/src/main/java/quarkus/accounts/AccountStatus.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | public enum AccountStatus { 4 | OPEN, 5 | CLOSED, 6 | OVERDRAWN 7 | } 8 | -------------------------------------------------------------------------------- /chapter5/account-service/src/main/java/quarkus/accounts/AccountStatus.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | public enum AccountStatus { 4 | OPEN, 5 | CLOSED, 6 | OVERDRAWN 7 | } 8 | -------------------------------------------------------------------------------- /chapter6/account-service/src/main/java/quarkus/accounts/AccountStatus.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | public enum AccountStatus { 4 | OPEN, 5 | CLOSED, 6 | OVERDRAWN 7 | } 8 | -------------------------------------------------------------------------------- /chapter7/account-service/src/main/java/quarkus/accounts/AccountStatus.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | public enum AccountStatus { 4 | OPEN, 5 | CLOSED, 6 | OVERDRAWN 7 | } 8 | -------------------------------------------------------------------------------- /chapter8/account-service/src/main/java/quarkus/accounts/AccountStatus.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | public enum AccountStatus { 4 | OPEN, 5 | CLOSED, 6 | OVERDRAWN 7 | } 8 | -------------------------------------------------------------------------------- /chapter9/account-service/src/main/java/quarkus/accounts/AccountStatus.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | public enum AccountStatus { 4 | OPEN, 5 | CLOSED, 6 | OVERDRAWN 7 | } 8 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/alertmanager-serviceAccount.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: alertmanager-main 5 | namespace: monitoring 6 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-adapter-serviceAccount.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: prometheus-adapter 5 | namespace: monitoring 6 | -------------------------------------------------------------------------------- /chapter12/account-service-annotations/src/main/java/quarkus/accounts/AccountStatus.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | public enum AccountStatus { 4 | OPEN, 5 | CLOSED, 6 | OVERDRAWN 7 | } 8 | -------------------------------------------------------------------------------- /chapter11/transaction-service/src/main/java/io/quarkus/transactions/AccountStatus.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | public enum AccountStatus { 4 | OPEN, 5 | CLOSED, 6 | OVERDRAWN 7 | } 8 | -------------------------------------------------------------------------------- /chapter12/account-service-external-openapi/src/main/java/quarkus/accounts/AccountStatus.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | public enum AccountStatus { 4 | OPEN, 5 | CLOSED, 6 | OVERDRAWN 7 | } 8 | -------------------------------------------------------------------------------- /chapter2/account-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=account-service 3 | quarkus.kubernetes.name=account-service 4 | -------------------------------------------------------------------------------- /chapter4/active-record/src/main/java/quarkus/accounts/activerecord/AccountStatus.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts.activerecord; 2 | 3 | public enum AccountStatus { 4 | OPEN, 5 | CLOSED, 6 | OVERDRAWN 7 | } 8 | -------------------------------------------------------------------------------- /chapter4/data-repository/src/main/java/quarkus/accounts/repository/AccountStatus.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts.repository; 2 | 3 | public enum AccountStatus { 4 | OPEN, 5 | CLOSED, 6 | OVERDRAWN 7 | } 8 | -------------------------------------------------------------------------------- /chapter10/micrometer-account-service/src/main/java/quarkus/accounts/micrometer/AccountStatus.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts.micrometer; 2 | 3 | public enum AccountStatus { 4 | OPEN, 5 | CLOSED, 6 | OVERDRAWN 7 | } 8 | -------------------------------------------------------------------------------- /chapter12/account-service-external-openapi/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=account-service 3 | quarkus.kubernetes.name=account-service 4 | -------------------------------------------------------------------------------- /chapter10/account-service/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | docker run --ulimit memlock=-1:-1 -it --rm=true --memory-swappiness=0 --name quarkus_banking -e POSTGRES_USER=quarkus_banking -e POSTGRES_PASSWORD=quarkus_banking -e POSTGRES_DB=quarkus_banking -p 5432:5432 postgres:10.5 3 | ``` -------------------------------------------------------------------------------- /chapter11/overdraft-service/src/main/java/quarkus/overdraft/events/AccountFee.java: -------------------------------------------------------------------------------- 1 | package quarkus.overdraft.events; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class AccountFee { 6 | public Long accountNumber; 7 | public BigDecimal overdraftFee; 8 | } 9 | -------------------------------------------------------------------------------- /chapter13/account-service/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | docker run --ulimit memlock=-1:-1 -it --rm=true --memory-swappiness=0 --name quarkus_banking -e POSTGRES_USER=quarkus_banking -e POSTGRES_PASSWORD=quarkus_banking -e POSTGRES_DB=quarkus_banking -p 5432:5432 postgres:10.5 3 | ``` -------------------------------------------------------------------------------- /chapter6/account-service/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | docker run --ulimit memlock=-1:-1 -it --rm=true --memory-swappiness=0 --name quarkus_banking -e POSTGRES_USER=quarkus_banking -e POSTGRES_PASSWORD=quarkus_banking -e POSTGRES_DB=quarkus_banking -p 5432:5432 postgres:10.5 3 | ``` -------------------------------------------------------------------------------- /chapter7/account-service/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | docker run --ulimit memlock=-1:-1 -it --rm=true --memory-swappiness=0 --name quarkus_banking -e POSTGRES_USER=quarkus_banking -e POSTGRES_PASSWORD=quarkus_banking -e POSTGRES_DB=quarkus_banking -p 5432:5432 postgres:10.5 3 | ``` -------------------------------------------------------------------------------- /chapter8/overdraft-service/src/main/java/quarkus/overdraft/events/AccountFee.java: -------------------------------------------------------------------------------- 1 | package quarkus.overdraft.events; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class AccountFee { 6 | public Long accountNumber; 7 | public BigDecimal overdraftFee; 8 | } 9 | -------------------------------------------------------------------------------- /chapter9/account-service/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | docker run --ulimit memlock=-1:-1 -it --rm=true --memory-swappiness=0 --name quarkus_banking -e POSTGRES_USER=quarkus_banking -e POSTGRES_PASSWORD=quarkus_banking -e POSTGRES_DB=quarkus_banking -p 5432:5432 postgres:10.5 3 | ``` -------------------------------------------------------------------------------- /chapter13/bank-service/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /chapter3/bank-service/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /chapter11/account-service/src/main/java/quarkus/accounts/events/OverdraftLimitUpdate.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts.events; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class OverdraftLimitUpdate { 6 | public Long accountNumber; 7 | public BigDecimal newOverdraftLimit; 8 | } 9 | -------------------------------------------------------------------------------- /chapter8/account-service/src/main/java/quarkus/accounts/events/OverdraftLimitUpdate.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts.events; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class OverdraftLimitUpdate { 6 | public Long accountNumber; 7 | public BigDecimal newOverdraftLimit; 8 | } 9 | -------------------------------------------------------------------------------- /chapter10/transaction-service/src/main/java/io/quarkus/transactions/AccountNotFoundException.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | public class AccountNotFoundException extends Exception { 4 | public AccountNotFoundException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /chapter11/overdraft-service/src/main/java/quarkus/overdraft/events/OverdraftLimitUpdate.java: -------------------------------------------------------------------------------- 1 | package quarkus.overdraft.events; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class OverdraftLimitUpdate { 6 | public Long accountNumber; 7 | public BigDecimal newOverdraftLimit; 8 | } 9 | -------------------------------------------------------------------------------- /chapter11/transaction-service/src/main/java/io/quarkus/transactions/AccountNotFoundException.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | public class AccountNotFoundException extends Exception { 4 | public AccountNotFoundException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /chapter13/transaction-service/src/main/java/io/quarkus/transactions/AccountNotFoundException.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | public class AccountNotFoundException extends Exception { 4 | public AccountNotFoundException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /chapter5/transaction-service/src/main/java/io/quarkus/transactions/AccountNotFoundException.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | public class AccountNotFoundException extends Exception { 4 | public AccountNotFoundException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /chapter6/transaction-service/src/main/java/io/quarkus/transactions/AccountNotFoundException.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | public class AccountNotFoundException extends Exception { 4 | public AccountNotFoundException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /chapter7/transaction-service/src/main/java/io/quarkus/transactions/AccountNotFoundException.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | public class AccountNotFoundException extends Exception { 4 | public AccountNotFoundException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /chapter8/overdraft-service/src/main/java/quarkus/overdraft/events/OverdraftLimitUpdate.java: -------------------------------------------------------------------------------- 1 | package quarkus.overdraft.events; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class OverdraftLimitUpdate { 6 | public Long accountNumber; 7 | public BigDecimal newOverdraftLimit; 8 | } 9 | -------------------------------------------------------------------------------- /chapter9/transaction-service/src/main/java/io/quarkus/transactions/AccountNotFoundException.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | public class AccountNotFoundException extends Exception { 4 | public AccountNotFoundException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /chapter2/generated/src/test/java/quarkus/NativeGreetingResourceIT.java: -------------------------------------------------------------------------------- 1 | package quarkus; 2 | 3 | import io.quarkus.test.junit.NativeImageTest; 4 | 5 | @NativeImageTest 6 | public class NativeGreetingResourceIT extends GreetingResourceTest { 7 | 8 | // Execute the same tests but in native mode. 9 | } -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/kube-state-metrics-serviceAccount.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: kube-state-metrics 6 | app.kubernetes.io/version: v1.9.7 7 | name: kube-state-metrics 8 | namespace: monitoring 9 | -------------------------------------------------------------------------------- /chapter13/scripts/getcert.sh: -------------------------------------------------------------------------------- 1 | kubectl exec -it keycloak-0 -- \ 2 | keytool \ 3 | -exportcert \ 4 | -rfc \ 5 | -alias server \ 6 | -keystore /opt/jboss/keycloak/standalone/configuration/application.keystore \ 7 | -storepass password \ 8 | -storetype PKCS12 9 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-roleConfig.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: Role 3 | metadata: 4 | name: prometheus-k8s-config 5 | namespace: monitoring 6 | rules: 7 | - apiGroups: 8 | - "" 9 | resources: 10 | - configmaps 11 | verbs: 12 | - get 13 | -------------------------------------------------------------------------------- /chapter4/jpa/src/test/java/quarkus/accounts/jpa/NativeAccountResourceIT.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts.jpa; 2 | 3 | import io.quarkus.test.junit.NativeImageTest; 4 | 5 | @NativeImageTest 6 | public class NativeAccountResourceIT extends AccountResourceTest { 7 | // Execute the same tests but in native mode. 8 | } 9 | -------------------------------------------------------------------------------- /chapter13/scripts/keycloak-operator/hack/keycloak-postgresql-pvc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolumeClaim 3 | metadata: 4 | name: keycloak-postgresql-claim 5 | labels: 6 | app: keycloak 7 | spec: 8 | resources: 9 | requests: 10 | storage: 1Gi 11 | accessModes: 12 | - ReadWriteOnce -------------------------------------------------------------------------------- /chapter2/account-service/src/test/java/quarkus/accounts/NativeAccountResourceIT.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import io.quarkus.test.junit.NativeImageTest; 4 | 5 | @NativeImageTest 6 | public class NativeAccountResourceIT extends AccountResourceTest { 7 | // Execute the same tests but in native mode. 8 | } 9 | -------------------------------------------------------------------------------- /chapter9/account-service/src/main/java/quarkus/accounts/AccountRepository.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | public interface AccountRepository extends JpaRepository { 6 | public Account findByAccountNumber(Long accountNumber); 7 | } 8 | -------------------------------------------------------------------------------- /chapter11/overdraft-service/src/main/java/quarkus/overdraft/model/AccountOverdraft.java: -------------------------------------------------------------------------------- 1 | package quarkus.overdraft.model; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class AccountOverdraft { 6 | public Long accountNumber; 7 | public BigDecimal currentOverdraft; 8 | public int numberOverdrawnEvents = 0; 9 | } 10 | -------------------------------------------------------------------------------- /chapter12/account-service-annotations/src/test/java/quarkus/accounts/NativeAccountResourceIT.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import io.quarkus.test.junit.NativeImageTest; 4 | 5 | @NativeImageTest 6 | public class NativeAccountResourceIT extends AccountResourceTest { 7 | // Execute the same tests but in native mode. 8 | } 9 | -------------------------------------------------------------------------------- /chapter8/overdraft-service/src/main/java/quarkus/overdraft/model/AccountOverdraft.java: -------------------------------------------------------------------------------- 1 | package quarkus.overdraft.model; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class AccountOverdraft { 6 | public Long accountNumber; 7 | public BigDecimal currentOverdraft; 8 | public int numberOverdrawnEvents = 0; 9 | } 10 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/grafana-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | app: grafana 6 | name: grafana 7 | namespace: monitoring 8 | spec: 9 | ports: 10 | - name: http 11 | port: 3000 12 | targetPort: http 13 | selector: 14 | app: grafana 15 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/grafana-serviceMonitor.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: monitoring.coreos.com/v1 2 | kind: ServiceMonitor 3 | metadata: 4 | name: grafana 5 | namespace: monitoring 6 | spec: 7 | endpoints: 8 | - interval: 15s 9 | port: http 10 | selector: 11 | matchLabels: 12 | app: grafana 13 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-adapter-clusterRoleServerResources.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | name: resource-metrics-server-resources 5 | rules: 6 | - apiGroups: 7 | - metrics.k8s.io 8 | resources: 9 | - '*' 10 | verbs: 11 | - '*' 12 | -------------------------------------------------------------------------------- /chapter12/account-service-external-openapi/src/test/java/quarkus/accounts/NativeAccountResourceIT.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import io.quarkus.test.junit.NativeImageTest; 4 | 5 | @NativeImageTest 6 | public class NativeAccountResourceIT extends AccountResourceTest { 7 | // Execute the same tests but in native mode. 8 | } 9 | -------------------------------------------------------------------------------- /chapter4/active-record/src/test/java/quarkus/accounts/activerecord/NativeAccountResourceIT.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts.activerecord; 2 | 3 | import io.quarkus.test.junit.NativeImageTest; 4 | 5 | @NativeImageTest 6 | public class NativeAccountResourceIT extends AccountResourceTest { 7 | // Execute the same tests but in native mode. 8 | } 9 | -------------------------------------------------------------------------------- /chapter4/data-repository/src/test/java/quarkus/accounts/repository/NativeAccountResourceIT.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts.repository; 2 | 3 | import io.quarkus.test.junit.NativeImageTest; 4 | 5 | @NativeImageTest 6 | public class NativeAccountResourceIT extends AccountResourceTest { 7 | // Execute the same tests but in native mode. 8 | } 9 | -------------------------------------------------------------------------------- /chapter10/micrometer-account-service/src/test/java/quarkus/accounts/micrometer/NativeAccountResourceIT.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts.micrometer; 2 | 3 | import io.quarkus.test.junit.NativeImageTest; 4 | 5 | @NativeImageTest 6 | public class NativeAccountResourceIT extends AccountResourceTest { 7 | // Execute the same tests but in native mode. 8 | } 9 | -------------------------------------------------------------------------------- /chapter13/scripts/keycloak-operator/deploy/role_binding.yaml: -------------------------------------------------------------------------------- 1 | kind: RoleBinding 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | metadata: 4 | name: keycloak-operator 5 | subjects: 6 | - kind: ServiceAccount 7 | name: keycloak-operator 8 | roleRef: 9 | kind: Role 10 | name: keycloak-operator 11 | apiGroup: rbac.authorization.k8s.io 12 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-clusterRole.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | name: prometheus-k8s 5 | rules: 6 | - apiGroups: 7 | - "" 8 | resources: 9 | - nodes/metrics 10 | verbs: 11 | - get 12 | - nonResourceURLs: 13 | - /metrics 14 | verbs: 15 | - get 16 | -------------------------------------------------------------------------------- /chapter10/micrometer-account-service/service-monitor.yml: -------------------------------------------------------------------------------- 1 | apiVersion: monitoring.coreos.com/v1 2 | kind: ServiceMonitor 3 | metadata: 4 | name: micrometer-account-service-monitor 5 | spec: 6 | selector: 7 | matchLabels: 8 | app.kubernetes.io/name: account-service-micrometer 9 | endpoints: 10 | - port: http 11 | - path: /q/metrics 12 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/setup/prometheus-operator-serviceAccount.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | labels: 5 | app.kubernetes.io/component: controller 6 | app.kubernetes.io/name: prometheus-operator 7 | app.kubernetes.io/version: v0.44.1 8 | name: prometheus-operator 9 | namespace: monitoring 10 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-adapter-clusterRole.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | name: prometheus-adapter 5 | rules: 6 | - apiGroups: 7 | - "" 8 | resources: 9 | - nodes 10 | - namespaces 11 | - pods 12 | - services 13 | verbs: 14 | - get 15 | - list 16 | - watch 17 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-adapter-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | name: prometheus-adapter 6 | name: prometheus-adapter 7 | namespace: monitoring 8 | spec: 9 | ports: 10 | - name: https 11 | port: 443 12 | targetPort: 6443 13 | selector: 14 | name: prometheus-adapter 15 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-serviceMonitor.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: monitoring.coreos.com/v1 2 | kind: ServiceMonitor 3 | metadata: 4 | labels: 5 | k8s-app: prometheus 6 | name: prometheus 7 | namespace: monitoring 8 | spec: 9 | endpoints: 10 | - interval: 30s 11 | port: web 12 | selector: 13 | matchLabels: 14 | prometheus: k8s 15 | -------------------------------------------------------------------------------- /chapter11/overdraft-service/src/main/java/quarkus/overdraft/model/CustomerOverdraft.java: -------------------------------------------------------------------------------- 1 | package quarkus.overdraft.model; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class CustomerOverdraft { 7 | public Long customerNumber; 8 | public int totalOverdrawnEvents = 0; 9 | public Map accountOverdrafts = new HashMap<>(); 10 | } 11 | -------------------------------------------------------------------------------- /chapter13/scripts/keycloak-operator/deploy/cluster_roles/cluster_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: keycloak-operator 5 | roleRef: 6 | name: keycloak-operator 7 | kind: ClusterRole 8 | apiGroup: "" 9 | subjects: 10 | - kind: ServiceAccount 11 | name: keycloak-operator 12 | namespace: keycloak 13 | -------------------------------------------------------------------------------- /chapter8/overdraft-service/src/main/java/quarkus/overdraft/model/CustomerOverdraft.java: -------------------------------------------------------------------------------- 1 | package quarkus.overdraft.model; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class CustomerOverdraft { 7 | public Long customerNumber; 8 | public int totalOverdrawnEvents = 0; 9 | public Map accountOverdrafts = new HashMap<>(); 10 | } 11 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/alertmanager-serviceMonitor.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: monitoring.coreos.com/v1 2 | kind: ServiceMonitor 3 | metadata: 4 | labels: 5 | k8s-app: alertmanager 6 | name: alertmanager 7 | namespace: monitoring 8 | spec: 9 | endpoints: 10 | - interval: 30s 11 | port: web 12 | selector: 13 | matchLabels: 14 | alertmanager: main 15 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/node-exporter-clusterRoleBinding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: node-exporter 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: node-exporter 9 | subjects: 10 | - kind: ServiceAccount 11 | name: node-exporter 12 | namespace: monitoring 13 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-clusterRoleBinding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: prometheus-k8s 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: prometheus-k8s 9 | subjects: 10 | - kind: ServiceAccount 11 | name: prometheus-k8s 12 | namespace: monitoring 13 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | prometheus: k8s 6 | name: prometheus-k8s 7 | namespace: monitoring 8 | spec: 9 | ports: 10 | - name: web 11 | port: 9090 12 | targetPort: web 13 | selector: 14 | app: prometheus 15 | prometheus: k8s 16 | sessionAffinity: ClientIP 17 | -------------------------------------------------------------------------------- /chapter11/overdraft-service/src/main/java/quarkus/overdraft/OverdrawnDeserializer.java: -------------------------------------------------------------------------------- 1 | package quarkus.overdraft; 2 | 3 | import io.quarkus.kafka.client.serialization.JsonbDeserializer; 4 | import quarkus.overdraft.events.Overdrawn; 5 | 6 | public class OverdrawnDeserializer extends JsonbDeserializer { 7 | public OverdrawnDeserializer() { 8 | super(Overdrawn.class); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /chapter8/overdraft-service/src/main/java/quarkus/overdraft/OverdrawnDeserializer.java: -------------------------------------------------------------------------------- 1 | package quarkus.overdraft; 2 | 3 | import io.quarkus.kafka.client.serialization.JsonbDeserializer; 4 | import quarkus.overdraft.events.Overdrawn; 5 | 6 | public class OverdrawnDeserializer extends JsonbDeserializer { 7 | public OverdrawnDeserializer() { 8 | super(Overdrawn.class); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/alertmanager-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | alertmanager: main 6 | name: alertmanager-main 7 | namespace: monitoring 8 | spec: 9 | ports: 10 | - name: web 11 | port: 9093 12 | targetPort: web 13 | selector: 14 | alertmanager: main 15 | app: alertmanager 16 | sessionAffinity: ClientIP 17 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-adapter-clusterRoleBinding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: prometheus-adapter 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: prometheus-adapter 9 | subjects: 10 | - kind: ServiceAccount 11 | name: prometheus-adapter 12 | namespace: monitoring 13 | -------------------------------------------------------------------------------- /chapter2/generated/src/main/java/quarkus/GreetingResource.java: -------------------------------------------------------------------------------- 1 | package quarkus; 2 | 3 | import javax.ws.rs.GET; 4 | import javax.ws.rs.Path; 5 | import javax.ws.rs.Produces; 6 | import javax.ws.rs.core.MediaType; 7 | 8 | @Path("/hello") 9 | public class GreetingResource { 10 | 11 | @GET 12 | @Produces(MediaType.TEXT_PLAIN) 13 | public String hello() { 14 | return "Hello RESTEasy"; 15 | } 16 | } -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-adapter-apiService.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apiregistration.k8s.io/v1 2 | kind: APIService 3 | metadata: 4 | name: v1beta1.metrics.k8s.io 5 | spec: 6 | group: metrics.k8s.io 7 | groupPriorityMinimum: 100 8 | insecureSkipTLSVerify: true 9 | service: 10 | name: prometheus-adapter 11 | namespace: monitoring 12 | version: v1beta1 13 | versionPriority: 100 14 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-roleBindingConfig.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: RoleBinding 3 | metadata: 4 | name: prometheus-k8s-config 5 | namespace: monitoring 6 | roleRef: 7 | apiGroup: rbac.authorization.k8s.io 8 | kind: Role 9 | name: prometheus-k8s-config 10 | subjects: 11 | - kind: ServiceAccount 12 | name: prometheus-k8s 13 | namespace: monitoring 14 | -------------------------------------------------------------------------------- /chapter11/transaction-service/src/main/java/io/quarkus/transactions/Account.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class Account { 6 | public Long accountNumber; 7 | public Long customerNumber; 8 | public String customerName; 9 | public BigDecimal balance; 10 | public BigDecimal overdraftLimit; 11 | public AccountStatus accountStatus = AccountStatus.OPEN; 12 | } 13 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/node-exporter-clusterRole.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | name: node-exporter 5 | rules: 6 | - apiGroups: 7 | - authentication.k8s.io 8 | resources: 9 | - tokenreviews 10 | verbs: 11 | - create 12 | - apiGroups: 13 | - authorization.k8s.io 14 | resources: 15 | - subjectaccessreviews 16 | verbs: 17 | - create 18 | -------------------------------------------------------------------------------- /chapter5/transaction-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=transaction-service 3 | quarkus.kubernetes.name=transaction-service 4 | 5 | %prod.io.quarkus.transactions.AccountService/mp-rest/url=http://account-service:80 6 | 7 | %prod.account.service=http://account-service:8080 8 | 9 | org.eclipse.microprofile.rest.client.propagateHeaders=Special-Header 10 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-adapter-clusterRoleBindingDelegator.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: resource-metrics:system:auth-delegator 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: system:auth-delegator 9 | subjects: 10 | - kind: ServiceAccount 11 | name: prometheus-adapter 12 | namespace: monitoring 13 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/node-exporter-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: node-exporter 6 | app.kubernetes.io/version: v1.0.1 7 | name: node-exporter 8 | namespace: monitoring 9 | spec: 10 | clusterIP: None 11 | ports: 12 | - name: https 13 | port: 9100 14 | targetPort: https 15 | selector: 16 | app.kubernetes.io/name: node-exporter 17 | -------------------------------------------------------------------------------- /chapter11/account-service/src/main/java/quarkus/accounts/OverdraftLimitUpdateDeserializer.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import io.quarkus.kafka.client.serialization.JsonbDeserializer; 4 | import quarkus.accounts.events.OverdraftLimitUpdate; 5 | 6 | public class OverdraftLimitUpdateDeserializer extends JsonbDeserializer { 7 | public OverdraftLimitUpdateDeserializer() { 8 | super(OverdraftLimitUpdate.class); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /chapter8/account-service/src/main/java/quarkus/accounts/OverdraftLimitUpdateDeserializer.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import io.quarkus.kafka.client.serialization.JsonbDeserializer; 4 | import quarkus.accounts.events.OverdraftLimitUpdate; 5 | 6 | public class OverdraftLimitUpdateDeserializer extends JsonbDeserializer { 7 | public OverdraftLimitUpdateDeserializer() { 8 | super(OverdraftLimitUpdate.class); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-adapter-roleBindingAuthReader.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: RoleBinding 3 | metadata: 4 | name: resource-metrics-auth-reader 5 | namespace: kube-system 6 | roleRef: 7 | apiGroup: rbac.authorization.k8s.io 8 | kind: Role 9 | name: extension-apiserver-authentication-reader 10 | subjects: 11 | - kind: ServiceAccount 12 | name: prometheus-adapter 13 | namespace: monitoring 14 | -------------------------------------------------------------------------------- /chapter13/scripts/keycloak_ingress.yml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.k8s.io/v1 2 | kind: Ingress 3 | metadata: 4 | name: keycloak 5 | annotations: 6 | nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" 7 | spec: 8 | ingressClassName: nginx 9 | rules: 10 | - host: keycloak.local 11 | http: 12 | paths: 13 | - backend: 14 | service: 15 | name: keycloak 16 | port: 17 | number: 8443 18 | pathType: ImplementationSpecific -------------------------------------------------------------------------------- /chapter13/bank-service/.gitignore: -------------------------------------------------------------------------------- 1 | # Eclipse 2 | .project 3 | .classpath 4 | .settings/ 5 | bin/ 6 | 7 | # IntelliJ 8 | .idea 9 | *.ipr 10 | *.iml 11 | *.iws 12 | 13 | # NetBeans 14 | nb-configuration.xml 15 | 16 | # Visual Studio Code 17 | .vscode 18 | .factorypath 19 | 20 | # OSX 21 | .DS_Store 22 | 23 | # Vim 24 | *.swp 25 | *.swo 26 | 27 | # patch 28 | *.orig 29 | *.rej 30 | 31 | # Maven 32 | target/ 33 | pom.xml.tag 34 | pom.xml.releaseBackup 35 | pom.xml.versionsBackup 36 | release.properties -------------------------------------------------------------------------------- /chapter3/bank-service/.gitignore: -------------------------------------------------------------------------------- 1 | # Eclipse 2 | .project 3 | .classpath 4 | .settings/ 5 | bin/ 6 | 7 | # IntelliJ 8 | .idea 9 | *.ipr 10 | *.iml 11 | *.iws 12 | 13 | # NetBeans 14 | nb-configuration.xml 15 | 16 | # Visual Studio Code 17 | .vscode 18 | .factorypath 19 | 20 | # OSX 21 | .DS_Store 22 | 23 | # Vim 24 | *.swp 25 | *.swo 26 | 27 | # patch 28 | *.orig 29 | *.rej 30 | 31 | # Maven 32 | target/ 33 | pom.xml.tag 34 | pom.xml.releaseBackup 35 | pom.xml.versionsBackup 36 | release.properties -------------------------------------------------------------------------------- /chapter9/bank-service/.gitignore: -------------------------------------------------------------------------------- 1 | # Eclipse 2 | .project 3 | .classpath 4 | .settings/ 5 | bin/ 6 | 7 | # IntelliJ 8 | .idea 9 | *.ipr 10 | *.iml 11 | *.iws 12 | 13 | # NetBeans 14 | nb-configuration.xml 15 | 16 | # Visual Studio Code 17 | .vscode 18 | .factorypath 19 | 20 | # OSX 21 | .DS_Store 22 | 23 | # Vim 24 | *.swp 25 | *.swo 26 | 27 | # patch 28 | *.orig 29 | *.rej 30 | 31 | # Maven 32 | target/ 33 | pom.xml.tag 34 | pom.xml.releaseBackup 35 | pom.xml.versionsBackup 36 | release.properties -------------------------------------------------------------------------------- /chapter4/data-repository/src/main/java/quarkus/accounts/repository/AccountRepository.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts.repository; 2 | 3 | import io.quarkus.hibernate.orm.panache.PanacheRepository; 4 | 5 | import javax.enterprise.context.ApplicationScoped; 6 | 7 | @ApplicationScoped 8 | public class AccountRepository implements PanacheRepository { 9 | public Account findByAccountNumber(Long accountNumber) { 10 | return find("accountNumber = ?1", accountNumber).firstResult(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /chapter9/spring-config-server/.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 | -------------------------------------------------------------------------------- /chapter13/scripts/keycloak_install.yml: -------------------------------------------------------------------------------- 1 | kind: PersistentVolume 2 | apiVersion: v1 3 | metadata: 4 | name: keycloak-postgresql-volume 5 | labels: 6 | app: keycloak 7 | spec: 8 | storageClassName: standard 9 | capacity: 10 | storage: 500Mi 11 | accessModes: 12 | - ReadWriteOnce 13 | hostPath: 14 | path: "/data" 15 | --- 16 | apiVersion: keycloak.org/v1alpha1 17 | kind: Keycloak 18 | metadata: 19 | name: bank-keycloak 20 | labels: 21 | app: bank-keycloak 22 | spec: 23 | instances: 1 24 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/kube-state-metrics-clusterRoleBinding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: kube-state-metrics 6 | app.kubernetes.io/version: v1.9.7 7 | name: kube-state-metrics 8 | roleRef: 9 | apiGroup: rbac.authorization.k8s.io 10 | kind: ClusterRole 11 | name: kube-state-metrics 12 | subjects: 13 | - kind: ServiceAccount 14 | name: kube-state-metrics 15 | namespace: monitoring 16 | -------------------------------------------------------------------------------- /chapter11/transaction-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=transaction-service 3 | quarkus.kubernetes.name=transaction-service 4 | 5 | %prod.quarkus.jaeger.endpoint=http://simplest-collector.observability:14268/api/traces 6 | quarkus.jaeger.service-name=transaction-service 7 | quarkus.jaeger.sampler-type=const 8 | quarkus.jaeger.sampler-param=1 9 | 10 | %prod.io.quarkus.transactions.AccountService/mp-rest/url=http://account-service:80 11 | -------------------------------------------------------------------------------- /chapter13/scripts/keycloak-operator/deploy/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | namespace: keycloak 5 | 6 | resources: 7 | - crds/keycloak.org_keycloakbackups_crd.yaml 8 | - crds/keycloak.org_keycloakclients_crd.yaml 9 | - crds/keycloak.org_keycloakrealms_crd.yaml 10 | - crds/keycloak.org_keycloaks_crd.yaml 11 | - crds/keycloak.org_keycloakusers_crd.yaml 12 | - namespace.yaml 13 | - role.yaml 14 | - role_binding.yaml 15 | - service_account.yaml 16 | - operator.yaml 17 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/alertmanager-alertmanager.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: monitoring.coreos.com/v1 2 | kind: Alertmanager 3 | metadata: 4 | labels: 5 | alertmanager: main 6 | name: main 7 | namespace: monitoring 8 | spec: 9 | image: quay.io/prometheus/alertmanager:v0.21.0 10 | nodeSelector: 11 | kubernetes.io/os: linux 12 | replicas: 3 13 | securityContext: 14 | fsGroup: 2000 15 | runAsNonRoot: true 16 | runAsUser: 1000 17 | serviceAccountName: alertmanager-main 18 | version: v0.21.0 19 | -------------------------------------------------------------------------------- /chapter9/bank-service/src/main/java/quarkus/bank/BankSupportConfig.java: -------------------------------------------------------------------------------- 1 | package quarkus.bank; 2 | 3 | import javax.validation.constraints.Size; 4 | 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | 7 | @ConfigurationProperties 8 | public class BankSupportConfig { 9 | private String phone; 10 | 11 | public String email; 12 | 13 | public String getPhone() { 14 | return phone; 15 | } 16 | 17 | public void setPhone(String phone) { 18 | this.phone = phone; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /chapter13/bank-service/src/main/java/quarkus/bank/BankSupportConfig.java: -------------------------------------------------------------------------------- 1 | package quarkus.bank; 2 | 3 | import org.eclipse.microprofile.config.inject.ConfigProperties; 4 | 5 | import javax.validation.constraints.Size; 6 | 7 | @ConfigProperties(prefix = "bank-support") 8 | public class BankSupportConfig { 9 | private String phone; 10 | 11 | public String email; 12 | 13 | public String getPhone() { 14 | return phone; 15 | } 16 | 17 | public void setPhone(String phone) { 18 | this.phone = phone; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/kube-state-metrics-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: kube-state-metrics 6 | app.kubernetes.io/version: v1.9.7 7 | name: kube-state-metrics 8 | namespace: monitoring 9 | spec: 10 | clusterIP: None 11 | ports: 12 | - name: https-main 13 | port: 8443 14 | targetPort: https-main 15 | - name: https-self 16 | port: 9443 17 | targetPort: https-self 18 | selector: 19 | app.kubernetes.io/name: kube-state-metrics 20 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-serviceMonitorCoreDNS.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: monitoring.coreos.com/v1 2 | kind: ServiceMonitor 3 | metadata: 4 | labels: 5 | k8s-app: coredns 6 | name: coredns 7 | namespace: monitoring 8 | spec: 9 | endpoints: 10 | - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token 11 | interval: 15s 12 | port: metrics 13 | jobLabel: k8s-app 14 | namespaceSelector: 15 | matchNames: 16 | - kube-system 17 | selector: 18 | matchLabels: 19 | k8s-app: kube-dns 20 | -------------------------------------------------------------------------------- /chapter3/bank-service/src/main/java/quarkus/bank/BankSupportConfig.java: -------------------------------------------------------------------------------- 1 | package quarkus.bank; 2 | 3 | 4 | import org.eclipse.microprofile.config.inject.ConfigProperties; 5 | 6 | import javax.validation.constraints.Size; 7 | 8 | @ConfigProperties(prefix = "bank-support") 9 | public class BankSupportConfig { 10 | private String phone; 11 | 12 | public String email; 13 | 14 | public String getPhone() { 15 | return phone; 16 | } 17 | 18 | public void setPhone(String phone) { 19 | this.phone = phone; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapter3/bank-service/src/main/java/quarkus/bank/BankSupportConfigMapping.java: -------------------------------------------------------------------------------- 1 | package quarkus.bank; 2 | 3 | import io.smallrye.config.ConfigMapping; 4 | 5 | import javax.validation.constraints.Size; 6 | 7 | @ConfigMapping(prefix = "bank-support-mapping") 8 | public interface BankSupportConfigMapping { 9 | @Size(min=12, max=12) 10 | String phone(); 11 | 12 | String email(); 13 | 14 | Business business(); 15 | 16 | interface Business { 17 | @Size(min=12, max=12) 18 | String phone(); 19 | String email(); 20 | } 21 | } -------------------------------------------------------------------------------- /chapter9/spring-config-server/src/main/java/org/acme/configserver/ConfigServerApplication.java: -------------------------------------------------------------------------------- 1 | package org.acme.configserver; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.config.server.EnableConfigServer; 6 | 7 | @SpringBootApplication 8 | @EnableConfigServer 9 | public class ConfigServerApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(ConfigServerApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-adapter-serviceMonitor.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: monitoring.coreos.com/v1 2 | kind: ServiceMonitor 3 | metadata: 4 | labels: 5 | name: prometheus-adapter 6 | name: prometheus-adapter 7 | namespace: monitoring 8 | spec: 9 | endpoints: 10 | - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token 11 | interval: 30s 12 | port: https 13 | scheme: https 14 | tlsConfig: 15 | insecureSkipVerify: true 16 | selector: 17 | matchLabels: 18 | name: prometheus-adapter 19 | -------------------------------------------------------------------------------- /chapter13/bank-service/src/main/java/quarkus/bank/BankSupportConfigMapping.java: -------------------------------------------------------------------------------- 1 | package quarkus.bank; 2 | 3 | import io.smallrye.config.ConfigMapping; 4 | 5 | import javax.validation.constraints.Size; 6 | 7 | @ConfigMapping(prefix = "bank-support-mapping") 8 | public interface BankSupportConfigMapping { 9 | @Size(min=12, max=12) 10 | String phone(); 11 | 12 | String email(); 13 | 14 | Business business(); 15 | 16 | interface Business { 17 | @Size(min=12, max=12) 18 | String phone(); 19 | String email(); 20 | } 21 | } -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-adapter-clusterRoleAggregatedMetricsReader.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | labels: 5 | rbac.authorization.k8s.io/aggregate-to-admin: "true" 6 | rbac.authorization.k8s.io/aggregate-to-edit: "true" 7 | rbac.authorization.k8s.io/aggregate-to-view: "true" 8 | name: system:aggregated-metrics-reader 9 | rules: 10 | - apiGroups: 11 | - metrics.k8s.io 12 | resources: 13 | - pods 14 | - nodes 15 | verbs: 16 | - get 17 | - list 18 | - watch 19 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/setup/prometheus-operator-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | app.kubernetes.io/component: controller 6 | app.kubernetes.io/name: prometheus-operator 7 | app.kubernetes.io/version: v0.44.1 8 | name: prometheus-operator 9 | namespace: monitoring 10 | spec: 11 | clusterIP: None 12 | ports: 13 | - name: https 14 | port: 8443 15 | targetPort: https 16 | selector: 17 | app.kubernetes.io/component: controller 18 | app.kubernetes.io/name: prometheus-operator 19 | -------------------------------------------------------------------------------- /chapter12/account-service-annotations/src/main/java/quarkus/accounts/OpenApiFilter.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import org.eclipse.microprofile.openapi.OASFilter; 4 | import org.eclipse.microprofile.openapi.models.Operation; 5 | 6 | import java.util.List; 7 | 8 | public class OpenApiFilter implements OASFilter { 9 | @Override 10 | public Operation filterOperation(Operation operation) { 11 | if (operation.getOperationId().equals("closeAccount")) { 12 | operation.setTags(List.of("close-account")); 13 | } 14 | return operation; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /chapter2/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | quarkus 6 | chapter2-parent 7 | 1.0.0-SNAPSHOT 8 | pom 9 | 10 | 11 | generated 12 | account-service 13 | 14 | 15 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/setup/prometheus-operator-clusterRoleBinding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | labels: 5 | app.kubernetes.io/component: controller 6 | app.kubernetes.io/name: prometheus-operator 7 | app.kubernetes.io/version: v0.44.1 8 | name: prometheus-operator 9 | roleRef: 10 | apiGroup: rbac.authorization.k8s.io 11 | kind: ClusterRole 12 | name: prometheus-operator 13 | subjects: 14 | - kind: ServiceAccount 15 | name: prometheus-operator 16 | namespace: monitoring 17 | -------------------------------------------------------------------------------- /chapter2/generated/src/test/java/quarkus/GreetingResourceTest.java: -------------------------------------------------------------------------------- 1 | package quarkus; 2 | 3 | import io.quarkus.test.junit.QuarkusTest; 4 | import org.junit.jupiter.api.Test; 5 | 6 | import static io.restassured.RestAssured.given; 7 | import static org.hamcrest.CoreMatchers.is; 8 | 9 | @QuarkusTest 10 | public class GreetingResourceTest { 11 | 12 | @Test 13 | public void testHelloEndpoint() { 14 | given() 15 | .when().get("/hello") 16 | .then() 17 | .statusCode(200) 18 | .body(is("Hello RESTEasy")); 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /chapter10/metrics/scripts/run_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # A simple script to run all tests in 4 | # an infinite loop to generate a "busy" 5 | # dashboard 6 | # Press CTRL-C to exit script 7 | 8 | ACCOUNT_URL=`minikube service --url account-service` 9 | 10 | while [ 1 ]; 11 | do 12 | metrics/scripts/concurrent.sh 13 | metrics/scripts/force_multiple_fallbacks.sh 14 | metrics/scripts/invoke_deposit_endpoints.sh 15 | metrics/scripts/overload_bulkhead.sh 16 | 17 | count=0 18 | 19 | while (( count++ < 15 )); do 20 | curl -i $ACCOUNT_URL/accounts/234/balance 21 | done 22 | done 23 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/grafana-dashboardSources.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | data: 3 | dashboards.yaml: |- 4 | { 5 | "apiVersion": 1, 6 | "providers": [ 7 | { 8 | "folder": "Default", 9 | "name": "0", 10 | "options": { 11 | "path": "/grafana-dashboard-definitions/0" 12 | }, 13 | "orgId": 1, 14 | "type": "file" 15 | } 16 | ] 17 | } 18 | kind: ConfigMap 19 | metadata: 20 | name: grafana-dashboards 21 | namespace: monitoring 22 | -------------------------------------------------------------------------------- /chapter12/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | quarkus 6 | chapter12-parent 7 | 1.0.0-SNAPSHOT 8 | pom 9 | 10 | 11 | account-service-annotations 12 | account-service-external-openapi 13 | 14 | 15 | -------------------------------------------------------------------------------- /chapter10/transaction-service/src/main/java/io/quarkus/transactions/CustomGroupLivenessCheck.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import io.smallrye.health.api.HealthGroup; 4 | import org.eclipse.microprofile.health.HealthCheck; 5 | import org.eclipse.microprofile.health.HealthCheckResponse; 6 | 7 | import javax.enterprise.context.ApplicationScoped; 8 | 9 | @ApplicationScoped 10 | @HealthGroup("custom") 11 | public class CustomGroupLivenessCheck implements HealthCheck { 12 | 13 | @Override 14 | public HealthCheckResponse call() { 15 | return HealthCheckResponse.up("custom liveness"); 16 | } 17 | } -------------------------------------------------------------------------------- /chapter11/account-service/src/main/java/quarkus/accounts/events/Overdrawn.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts.events; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class Overdrawn { 6 | public Long accountNumber; 7 | public Long customerNumber; 8 | public BigDecimal balance; 9 | public BigDecimal overdraftLimit; 10 | 11 | public Overdrawn(Long accountNumber, Long customerNumber, BigDecimal balance, BigDecimal overdraftLimit) { 12 | this.accountNumber = accountNumber; 13 | this.customerNumber = customerNumber; 14 | this.balance = balance; 15 | this.overdraftLimit = overdraftLimit; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /chapter13/transaction-service/src/main/java/io/quarkus/transactions/CustomGroupLivenessCheck.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import io.smallrye.health.api.HealthGroup; 4 | import org.eclipse.microprofile.health.HealthCheck; 5 | import org.eclipse.microprofile.health.HealthCheckResponse; 6 | 7 | import javax.enterprise.context.ApplicationScoped; 8 | 9 | @ApplicationScoped 10 | @HealthGroup("custom") 11 | public class CustomGroupLivenessCheck implements HealthCheck { 12 | 13 | @Override 14 | public HealthCheckResponse call() { 15 | return HealthCheckResponse.up("custom liveness"); 16 | } 17 | } -------------------------------------------------------------------------------- /chapter6/transaction-service/src/main/java/io/quarkus/transactions/CustomGroupLivenessCheck.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import io.smallrye.health.api.HealthGroup; 4 | import org.eclipse.microprofile.health.HealthCheck; 5 | import org.eclipse.microprofile.health.HealthCheckResponse; 6 | 7 | import javax.enterprise.context.ApplicationScoped; 8 | 9 | @ApplicationScoped 10 | @HealthGroup("custom") 11 | public class CustomGroupLivenessCheck implements HealthCheck { 12 | 13 | @Override 14 | public HealthCheckResponse call() { 15 | return HealthCheckResponse.up("custom liveness"); 16 | } 17 | } -------------------------------------------------------------------------------- /chapter7/transaction-service/src/main/java/io/quarkus/transactions/CustomGroupLivenessCheck.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import io.smallrye.health.api.HealthGroup; 4 | import org.eclipse.microprofile.health.HealthCheck; 5 | import org.eclipse.microprofile.health.HealthCheckResponse; 6 | 7 | import javax.enterprise.context.ApplicationScoped; 8 | 9 | @ApplicationScoped 10 | @HealthGroup("custom") 11 | public class CustomGroupLivenessCheck implements HealthCheck { 12 | 13 | @Override 14 | public HealthCheckResponse call() { 15 | return HealthCheckResponse.up("custom liveness"); 16 | } 17 | } -------------------------------------------------------------------------------- /chapter8/account-service/src/main/java/quarkus/accounts/events/Overdrawn.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts.events; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class Overdrawn { 6 | public Long accountNumber; 7 | public Long customerNumber; 8 | public BigDecimal balance; 9 | public BigDecimal overdraftLimit; 10 | 11 | public Overdrawn(Long accountNumber, Long customerNumber, BigDecimal balance, BigDecimal overdraftLimit) { 12 | this.accountNumber = accountNumber; 13 | this.customerNumber = customerNumber; 14 | this.balance = balance; 15 | this.overdraftLimit = overdraftLimit; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /chapter9/transaction-service/src/main/java/io/quarkus/transactions/CustomGroupLivenessCheck.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import io.smallrye.health.api.HealthGroup; 4 | import org.eclipse.microprofile.health.HealthCheck; 5 | import org.eclipse.microprofile.health.HealthCheckResponse; 6 | 7 | import javax.enterprise.context.ApplicationScoped; 8 | 9 | @ApplicationScoped 10 | @HealthGroup("custom") 11 | public class CustomGroupLivenessCheck implements HealthCheck { 12 | 13 | @Override 14 | public HealthCheckResponse call() { 15 | return HealthCheckResponse.up("custom liveness"); 16 | } 17 | } -------------------------------------------------------------------------------- /chapter5/account-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=account-service 3 | quarkus.kubernetes.name=account-service 4 | 5 | quarkus.datasource.db-kind=postgresql 6 | quarkus.datasource.username=quarkus_banking 7 | quarkus.datasource.password=quarkus_banking 8 | quarkus.datasource.jdbc.url=jdbc:postgresql://localhost/quarkus_banking 9 | %prod.quarkus.datasource.jdbc.url=jdbc:postgresql://postgres.default:5432/quarkus_banking 10 | 11 | quarkus.hibernate-orm.database.generation=drop-and-create 12 | quarkus.hibernate-orm.sql-load-script=import.sql 13 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/grafana-dashboardDatasources.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | data: 3 | datasources.yaml: ewogICAgImFwaVZlcnNpb24iOiAxLAogICAgImRhdGFzb3VyY2VzIjogWwogICAgICAgIHsKICAgICAgICAgICAgImFjY2VzcyI6ICJwcm94eSIsCiAgICAgICAgICAgICJlZGl0YWJsZSI6IGZhbHNlLAogICAgICAgICAgICAibmFtZSI6ICJwcm9tZXRoZXVzIiwKICAgICAgICAgICAgIm9yZ0lkIjogMSwKICAgICAgICAgICAgInR5cGUiOiAicHJvbWV0aGV1cyIsCiAgICAgICAgICAgICJ1cmwiOiAiaHR0cDovL3Byb21ldGhldXMtazhzLm1vbml0b3Jpbmcuc3ZjOjkwOTAiLAogICAgICAgICAgICAidmVyc2lvbiI6IDEKICAgICAgICB9CiAgICBdCn0= 4 | kind: Secret 5 | metadata: 6 | name: grafana-datasources 7 | namespace: monitoring 8 | type: Opaque 9 | -------------------------------------------------------------------------------- /chapter9/bank-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # Enable Kubernetes ConfigMap 2 | #%prod.quarkus.kubernetes-config.enabled=true 3 | #%prod.quarkus.kubernetes-config.config-maps=banking 4 | 5 | # Enable Kubernetes Secrets 6 | #%prod.quarkus.kubernetes-config.secrets.enabled=true 7 | #%prod.quarkus.kubernetes-config.secrets=db-credentials 8 | 9 | # Spring Cloud Config Server Client configuration 10 | 11 | quarkus.application.name=bank-service 12 | quarkus.spring-cloud-config.enabled=true 13 | quarkus.spring-cloud-config.url=http://localhost:18888 14 | %prod.quarkus.spring-cloud-config.url=http://spring-config-server:18888 15 | -------------------------------------------------------------------------------- /chapter11/kafka_topics.yml: -------------------------------------------------------------------------------- 1 | apiVersion: kafka.strimzi.io/v1beta2 2 | kind: KafkaTopic 3 | metadata: 4 | name: overdrawn 5 | labels: 6 | strimzi.io/cluster: my-cluster 7 | spec: 8 | partitions: 3 9 | replicas: 2 10 | --- 11 | apiVersion: kafka.strimzi.io/v1beta2 12 | kind: KafkaTopic 13 | metadata: 14 | name: new-limit 15 | labels: 16 | strimzi.io/cluster: my-cluster 17 | spec: 18 | partitions: 3 19 | replicas: 2 20 | --- 21 | apiVersion: kafka.strimzi.io/v1beta2 22 | kind: KafkaTopic 23 | metadata: 24 | name: account-fee 25 | labels: 26 | strimzi.io/cluster: my-cluster 27 | spec: 28 | partitions: 3 29 | replicas: 2 30 | -------------------------------------------------------------------------------- /chapter8/kafka_topics.yml: -------------------------------------------------------------------------------- 1 | apiVersion: kafka.strimzi.io/v1beta2 2 | kind: KafkaTopic 3 | metadata: 4 | name: overdrawn 5 | labels: 6 | strimzi.io/cluster: my-cluster 7 | spec: 8 | partitions: 3 9 | replicas: 2 10 | --- 11 | apiVersion: kafka.strimzi.io/v1beta2 12 | kind: KafkaTopic 13 | metadata: 14 | name: new-limit 15 | labels: 16 | strimzi.io/cluster: my-cluster 17 | spec: 18 | partitions: 3 19 | replicas: 2 20 | --- 21 | apiVersion: kafka.strimzi.io/v1beta2 22 | kind: KafkaTopic 23 | metadata: 24 | name: account-fee 25 | labels: 26 | strimzi.io/cluster: my-cluster 27 | spec: 28 | partitions: 3 29 | replicas: 2 30 | -------------------------------------------------------------------------------- /chapter13/scripts/createpem.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # "http://keycloak.local/auth/realms/bank" is a publicly available endpoint 4 | # that makes the realm public key publicly available. 5 | 6 | # The "cut" command prints out text between the 8th and ninth quote, 7 | # which is the public key. Using "cut" is convenient way to parse the JSON 8 | # without installing specil tooling. Good enough for this purpose! 9 | 10 | BEGIN_STRING="-----BEGIN PUBLIC KEY-----" 11 | PUBLIC_KEY=`curl -s http://keycloak.local/auth/realms/bank | cut -d\" -f8` 12 | END_STRING="-----END PUBLIC KEY-----" 13 | 14 | echo $BEGIN_STRING 15 | echo $PUBLIC_KEY 16 | echo $END_STRING 17 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-serviceMonitorKubeScheduler.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: monitoring.coreos.com/v1 2 | kind: ServiceMonitor 3 | metadata: 4 | labels: 5 | k8s-app: kube-scheduler 6 | name: kube-scheduler 7 | namespace: monitoring 8 | spec: 9 | endpoints: 10 | - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token 11 | interval: 30s 12 | port: https-metrics 13 | scheme: https 14 | tlsConfig: 15 | insecureSkipVerify: true 16 | jobLabel: k8s-app 17 | namespaceSelector: 18 | matchNames: 19 | - kube-system 20 | selector: 21 | matchLabels: 22 | k8s-app: kube-scheduler 23 | -------------------------------------------------------------------------------- /chapter11/overdraft-service/src/main/java/quarkus/overdraft/events/Overdrawn.java: -------------------------------------------------------------------------------- 1 | package quarkus.overdraft.events; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class Overdrawn { 6 | public Long accountNumber; 7 | public Long customerNumber; 8 | public BigDecimal balance; 9 | public BigDecimal overdraftLimit; 10 | 11 | public Overdrawn() { 12 | } 13 | 14 | public Overdrawn(Long accountNumber, Long customerNumber, BigDecimal balance, BigDecimal overdraftLimit) { 15 | this.accountNumber = accountNumber; 16 | this.customerNumber = customerNumber; 17 | this.balance = balance; 18 | this.overdraftLimit = overdraftLimit; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /chapter13/scripts/bank_realm.yml: -------------------------------------------------------------------------------- 1 | apiVersion: keycloak.org/v1alpha1 2 | kind: KeycloakRealm 3 | metadata: 4 | name: bank 5 | labels: 6 | realm: bank 7 | spec: 8 | realm: 9 | id: "bank" 10 | realm: "bank" 11 | enabled: True 12 | displayName: "Bank Realm" 13 | roles: 14 | realm: 15 | - name: "customer" 16 | composite: false 17 | clientRole: false 18 | - name: "teller" 19 | composite: false 20 | clientRole: false 21 | - name: "bankadmin" 22 | composite: false 23 | clientRole: false 24 | instanceSelector: 25 | matchLabels: 26 | app: bank-keycloak 27 | -------------------------------------------------------------------------------- /chapter8/overdraft-service/src/main/java/quarkus/overdraft/events/Overdrawn.java: -------------------------------------------------------------------------------- 1 | package quarkus.overdraft.events; 2 | 3 | import java.math.BigDecimal; 4 | 5 | public class Overdrawn { 6 | public Long accountNumber; 7 | public Long customerNumber; 8 | public BigDecimal balance; 9 | public BigDecimal overdraftLimit; 10 | 11 | public Overdrawn() { 12 | } 13 | 14 | public Overdrawn(Long accountNumber, Long customerNumber, BigDecimal balance, BigDecimal overdraftLimit) { 15 | this.accountNumber = accountNumber; 16 | this.customerNumber = customerNumber; 17 | this.balance = balance; 18 | this.overdraftLimit = overdraftLimit; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /chapter13/scripts/keycloak-operator/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.ci.openshift.org/openshift/release:golang-1.13 AS build-env 2 | 3 | COPY . /src/ 4 | 5 | RUN cd /src && \ 6 | make code/compile && \ 7 | echo "Build SHA1: $(git rev-parse HEAD)" && \ 8 | echo "$(git rev-parse HEAD)" > /src/BUILD_INFO 9 | 10 | # final stage 11 | FROM registry.access.redhat.com/ubi8/ubi-minimal:latest 12 | 13 | ##LABELS 14 | 15 | RUN microdnf update && microdnf clean all && rm -rf /var/cache/yum/* 16 | 17 | COPY --from=build-env /src/BUILD_INFO /src/BUILD_INFO 18 | COPY --from=build-env /src/tmp/_output/bin/keycloak-operator /usr/local/bin 19 | 20 | ENTRYPOINT ["/usr/local/bin/keycloak-operator"] 21 | -------------------------------------------------------------------------------- /chapter5/transaction-service/src/main/java/io/quarkus/transactions/AccountRequestFilter.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import javax.ws.rs.client.ClientRequestContext; 4 | import javax.ws.rs.client.ClientRequestFilter; 5 | import java.io.IOException; 6 | import java.lang.reflect.Method; 7 | 8 | public class AccountRequestFilter implements ClientRequestFilter { 9 | @Override 10 | public void filter(ClientRequestContext requestContext) throws IOException { 11 | Method invokedMethod = (Method) requestContext.getProperty("org.eclipse.microprofile.rest.client.invokedMethod"); 12 | requestContext.getHeaders().add("Invoked-Client-Method", invokedMethod.getName()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /chapter6/transaction-service/src/main/java/io/quarkus/transactions/AccountRequestFilter.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import javax.ws.rs.client.ClientRequestContext; 4 | import javax.ws.rs.client.ClientRequestFilter; 5 | import java.io.IOException; 6 | import java.lang.reflect.Method; 7 | 8 | public class AccountRequestFilter implements ClientRequestFilter { 9 | @Override 10 | public void filter(ClientRequestContext requestContext) throws IOException { 11 | Method invokedMethod = (Method) requestContext.getProperty("org.eclipse.microprofile.rest.client.invokedMethod"); 12 | requestContext.getHeaders().add("Invoked-Client-Method", invokedMethod.getName()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /chapter7/transaction-service/src/main/java/io/quarkus/transactions/AccountRequestFilter.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import javax.ws.rs.client.ClientRequestContext; 4 | import javax.ws.rs.client.ClientRequestFilter; 5 | import java.io.IOException; 6 | import java.lang.reflect.Method; 7 | 8 | public class AccountRequestFilter implements ClientRequestFilter { 9 | @Override 10 | public void filter(ClientRequestContext requestContext) throws IOException { 11 | Method invokedMethod = (Method) requestContext.getProperty("org.eclipse.microprofile.rest.client.invokedMethod"); 12 | requestContext.getHeaders().add("Invoked-Client-Method", invokedMethod.getName()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /chapter9/transaction-service/src/main/java/io/quarkus/transactions/AccountRequestFilter.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import javax.ws.rs.client.ClientRequestContext; 4 | import javax.ws.rs.client.ClientRequestFilter; 5 | import java.io.IOException; 6 | import java.lang.reflect.Method; 7 | 8 | public class AccountRequestFilter implements ClientRequestFilter { 9 | @Override 10 | public void filter(ClientRequestContext requestContext) throws IOException { 11 | Method invokedMethod = (Method) requestContext.getProperty("org.eclipse.microprofile.rest.client.invokedMethod"); 12 | requestContext.getHeaders().add("Invoked-Client-Method", invokedMethod.getName()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /chapter10/transaction-service/src/main/java/io/quarkus/transactions/AccountRequestFilter.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import javax.ws.rs.client.ClientRequestContext; 4 | import javax.ws.rs.client.ClientRequestFilter; 5 | import java.io.IOException; 6 | import java.lang.reflect.Method; 7 | 8 | public class AccountRequestFilter implements ClientRequestFilter { 9 | @Override 10 | public void filter(ClientRequestContext requestContext) throws IOException { 11 | Method invokedMethod = (Method) requestContext.getProperty("org.eclipse.microprofile.rest.client.invokedMethod"); 12 | requestContext.getHeaders().add("Invoked-Client-Method", invokedMethod.getName()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /chapter13/transaction-service/src/main/java/io/quarkus/transactions/AccountRequestFilter.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import javax.ws.rs.client.ClientRequestContext; 4 | import javax.ws.rs.client.ClientRequestFilter; 5 | import java.io.IOException; 6 | import java.lang.reflect.Method; 7 | 8 | public class AccountRequestFilter implements ClientRequestFilter { 9 | @Override 10 | public void filter(ClientRequestContext requestContext) throws IOException { 11 | Method invokedMethod = (Method) requestContext.getProperty("org.eclipse.microprofile.rest.client.invokedMethod"); 12 | requestContext.getHeaders().add("Invoked-Client-Method", invokedMethod.getName()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /chapter10/transaction-service/src/main/java/io/quarkus/transactions/AccountExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper; 4 | 5 | import javax.ws.rs.core.MultivaluedMap; 6 | import javax.ws.rs.core.Response; 7 | 8 | public class AccountExceptionMapper implements ResponseExceptionMapper { 9 | @Override 10 | public AccountNotFoundException toThrowable(Response response) { 11 | return new AccountNotFoundException("Failed to retrieve account"); 12 | } 13 | 14 | @Override 15 | public boolean handles(int status, MultivaluedMap headers) { 16 | return status == 404; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /chapter13/transaction-service/src/main/java/io/quarkus/transactions/AccountExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper; 4 | 5 | import javax.ws.rs.core.MultivaluedMap; 6 | import javax.ws.rs.core.Response; 7 | 8 | public class AccountExceptionMapper implements ResponseExceptionMapper { 9 | @Override 10 | public AccountNotFoundException toThrowable(Response response) { 11 | return new AccountNotFoundException("Failed to retrieve account"); 12 | } 13 | 14 | @Override 15 | public boolean handles(int status, MultivaluedMap headers) { 16 | return status == 404; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /chapter5/transaction-service/src/main/java/io/quarkus/transactions/AccountExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper; 4 | 5 | import javax.ws.rs.core.MultivaluedMap; 6 | import javax.ws.rs.core.Response; 7 | 8 | public class AccountExceptionMapper implements ResponseExceptionMapper { 9 | @Override 10 | public AccountNotFoundException toThrowable(Response response) { 11 | return new AccountNotFoundException("Failed to retrieve account"); 12 | } 13 | 14 | @Override 15 | public boolean handles(int status, MultivaluedMap headers) { 16 | return status == 404; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /chapter6/transaction-service/src/main/java/io/quarkus/transactions/AccountExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper; 4 | 5 | import javax.ws.rs.core.MultivaluedMap; 6 | import javax.ws.rs.core.Response; 7 | 8 | public class AccountExceptionMapper implements ResponseExceptionMapper { 9 | @Override 10 | public AccountNotFoundException toThrowable(Response response) { 11 | return new AccountNotFoundException("Failed to retrieve account"); 12 | } 13 | 14 | @Override 15 | public boolean handles(int status, MultivaluedMap headers) { 16 | return status == 404; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /chapter7/transaction-service/src/main/java/io/quarkus/transactions/AccountExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper; 4 | 5 | import javax.ws.rs.core.MultivaluedMap; 6 | import javax.ws.rs.core.Response; 7 | 8 | public class AccountExceptionMapper implements ResponseExceptionMapper { 9 | @Override 10 | public AccountNotFoundException toThrowable(Response response) { 11 | return new AccountNotFoundException("Failed to retrieve account"); 12 | } 13 | 14 | @Override 15 | public boolean handles(int status, MultivaluedMap headers) { 16 | return status == 404; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /chapter9/transaction-service/src/main/java/io/quarkus/transactions/AccountExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper; 4 | 5 | import javax.ws.rs.core.MultivaluedMap; 6 | import javax.ws.rs.core.Response; 7 | 8 | public class AccountExceptionMapper implements ResponseExceptionMapper { 9 | @Override 10 | public AccountNotFoundException toThrowable(Response response) { 11 | return new AccountNotFoundException("Failed to retrieve account"); 12 | } 13 | 14 | @Override 15 | public boolean handles(int status, MultivaluedMap headers) { 16 | return status == 404; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /chapter8/kafka_cluster.yml: -------------------------------------------------------------------------------- 1 | apiVersion: kafka.strimzi.io/v1beta2 2 | kind: Kafka 3 | metadata: 4 | name: my-cluster 5 | spec: 6 | kafka: 7 | replicas: 2 8 | listeners: 9 | - name: plain 10 | port: 9092 11 | type: internal 12 | tls: false 13 | - name: tls 14 | port: 9093 15 | type: internal 16 | tls: true 17 | config: 18 | offsets.topic.replication.factor: 2 19 | transaction.state.log.replication.factor: 2 20 | transaction.state.log.min.isr: 2 21 | storage: 22 | type: ephemeral 23 | zookeeper: 24 | replicas: 2 25 | storage: 26 | type: ephemeral 27 | entityOperator: 28 | topicOperator: {} 29 | userOperator: {} 30 | -------------------------------------------------------------------------------- /chapter11/kafka_cluster.yml: -------------------------------------------------------------------------------- 1 | apiVersion: kafka.strimzi.io/v1beta2 2 | kind: Kafka 3 | metadata: 4 | name: my-cluster 5 | spec: 6 | kafka: 7 | replicas: 1 8 | listeners: 9 | - name: plain 10 | port: 9092 11 | type: internal 12 | tls: false 13 | - name: tls 14 | port: 9093 15 | type: internal 16 | tls: true 17 | config: 18 | offsets.topic.replication.factor: 1 19 | transaction.state.log.replication.factor: 1 20 | transaction.state.log.min.isr: 1 21 | storage: 22 | type: ephemeral 23 | zookeeper: 24 | replicas: 2 25 | storage: 26 | type: ephemeral 27 | entityOperator: 28 | topicOperator: {} 29 | userOperator: {} 30 | -------------------------------------------------------------------------------- /chapter4/jpa/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=account-service 3 | quarkus.kubernetes.name=account-service 4 | 5 | quarkus.datasource.db-kind=postgresql 6 | quarkus.datasource.username=quarkus_banking 7 | quarkus.datasource.password=quarkus_banking 8 | quarkus.datasource.jdbc.url=jdbc:postgresql://localhost/quarkus_banking 9 | 10 | %test.quarkus.datasource.db-kind=h2 11 | %test.quarkus.datasource.username=username-default 12 | %test.quarkus.datasource.password= 13 | %test.quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:default 14 | 15 | quarkus.hibernate-orm.database.generation=drop-and-create 16 | quarkus.hibernate-orm.sql-load-script=import.sql 17 | -------------------------------------------------------------------------------- /chapter4/jpa/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter13/bank-service/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/bank-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/bank-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter2/generated/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter3/bank-service/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/bank-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/bank-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter4/data-repository/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=account-service 3 | quarkus.kubernetes.name=account-service 4 | 5 | quarkus.datasource.db-kind=postgresql 6 | quarkus.datasource.username=quarkus_banking 7 | quarkus.datasource.password=quarkus_banking 8 | quarkus.datasource.jdbc.url=jdbc:postgresql://localhost/quarkus_banking 9 | 10 | %test.quarkus.datasource.db-kind=h2 11 | %test.quarkus.datasource.username=username-default 12 | %test.quarkus.datasource.password= 13 | %test.quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:default 14 | 15 | quarkus.hibernate-orm.database.generation=drop-and-create 16 | quarkus.hibernate-orm.sql-load-script=import.sql 17 | -------------------------------------------------------------------------------- /chapter9/bank-service/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/bank-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/bank-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter2/account-service/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter4/active-record/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter4/data-repository/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter5/account-service/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter6/account-service/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter7/account-service/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter8/account-service/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter9/account-service/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter9/spring-config-server/banking-config-repository/banking-client.properties: -------------------------------------------------------------------------------- 1 | # Configuration file 2 | # key = value 3 | 4 | # Bank names 5 | bank.name=Bank of Quarkus 6 | %dev.bank.name=Bank of Development 7 | %prod.bank.name=Bank of Production 8 | 9 | # Using @ConfigProperties 10 | bank-support.email=support@bankofquarkus.com 11 | bank-support.phone=555-555-5555 12 | 13 | # Enable Kubernetes ConfigMap 14 | quarkus.kubernetes-config.enabled=true 15 | quarkus.kubernetes-config.config-maps=banking 16 | 17 | # Enable Kubernetes Secrets 18 | quarkus.kubernetes-config.secrets.enabled=true 19 | quarkus.kubernetes-config.secrets=db-credentials 20 | 21 | # Devmode properties for expansion below 22 | %dev.username=Duke 23 | %dev.password=itsasecret 24 | -------------------------------------------------------------------------------- /chapter10/account-service/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter11/account-service/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter11/transaction-service/src/main/java/io/quarkus/transactions/AccountService.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; 4 | 5 | import javax.ws.rs.*; 6 | import javax.ws.rs.core.MediaType; 7 | 8 | @Path("/accounts") 9 | @RegisterRestClient 10 | @Produces(MediaType.APPLICATION_JSON) 11 | public interface AccountService { 12 | @PUT 13 | @Path("{accountNumber}/withdrawal") 14 | Account withdrawal(@PathParam("accountNumber") Long accountNumber, String amount) throws AccountNotFoundException; 15 | 16 | @PUT 17 | @Path("{accountNumber}/deposit") 18 | Account deposit(@PathParam("accountNumber") Long accountNumber, String amount) throws AccountNotFoundException; 19 | } 20 | -------------------------------------------------------------------------------- /chapter13/account-service/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter11/overdraft-service/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/overdraft-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/overdraft-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter8/overdraft-service/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/overdraft-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/overdraft-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter10/micrometer-account-service/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter12/account-service-annotations/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter10/account-service/src/main/java/quarkus/accounts/AlwaysHealthyLivenessCheck.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import org.eclipse.microprofile.health.HealthCheck; 4 | import org.eclipse.microprofile.health.HealthCheckResponse; 5 | import org.eclipse.microprofile.health.Liveness; 6 | 7 | import javax.enterprise.context.ApplicationScoped; 8 | import java.util.Date; 9 | 10 | @ApplicationScoped 11 | @Liveness 12 | public class AlwaysHealthyLivenessCheck implements HealthCheck { 13 | @Override 14 | public HealthCheckResponse call() { 15 | return HealthCheckResponse 16 | .named("Always live") 17 | .withData("time", String.valueOf(new Date())) 18 | .up() 19 | .build(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapter12/account-service-external-openapi/src/main/docker/Dockerfile.native-distroless: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM quay.io/quarkus/quarkus-distroless-image:1.0 18 | COPY target/*-runner /application 19 | 20 | EXPOSE 8080 21 | USER nonroot 22 | 23 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 24 | -------------------------------------------------------------------------------- /chapter13/account-service/src/main/java/quarkus/accounts/AlwaysHealthyLivenessCheck.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import org.eclipse.microprofile.health.HealthCheck; 4 | import org.eclipse.microprofile.health.HealthCheckResponse; 5 | import org.eclipse.microprofile.health.Liveness; 6 | 7 | import javax.enterprise.context.ApplicationScoped; 8 | import java.util.Date; 9 | 10 | @ApplicationScoped 11 | @Liveness 12 | public class AlwaysHealthyLivenessCheck implements HealthCheck { 13 | @Override 14 | public HealthCheckResponse call() { 15 | return HealthCheckResponse 16 | .named("Always live") 17 | .withData("time", String.valueOf(new Date())) 18 | .up() 19 | .build(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapter6/account-service/src/main/java/quarkus/accounts/AlwaysHealthyLivenessCheck.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import org.eclipse.microprofile.health.HealthCheck; 4 | import org.eclipse.microprofile.health.HealthCheckResponse; 5 | import org.eclipse.microprofile.health.Liveness; 6 | 7 | import javax.enterprise.context.ApplicationScoped; 8 | import java.util.Date; 9 | 10 | @ApplicationScoped 11 | @Liveness 12 | public class AlwaysHealthyLivenessCheck implements HealthCheck { 13 | @Override 14 | public HealthCheckResponse call() { 15 | return HealthCheckResponse 16 | .named("Always live") 17 | .withData("time", String.valueOf(new Date())) 18 | .up() 19 | .build(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapter7/account-service/src/main/java/quarkus/accounts/AlwaysHealthyLivenessCheck.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import org.eclipse.microprofile.health.HealthCheck; 4 | import org.eclipse.microprofile.health.HealthCheckResponse; 5 | import org.eclipse.microprofile.health.Liveness; 6 | 7 | import javax.enterprise.context.ApplicationScoped; 8 | import java.util.Date; 9 | 10 | @ApplicationScoped 11 | @Liveness 12 | public class AlwaysHealthyLivenessCheck implements HealthCheck { 13 | @Override 14 | public HealthCheckResponse call() { 15 | return HealthCheckResponse 16 | .named("Always live") 17 | .withData("time", String.valueOf(new Date())) 18 | .up() 19 | .build(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapter9/account-service/src/main/java/quarkus/accounts/AlwaysHealthyLivenessCheck.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import org.eclipse.microprofile.health.HealthCheck; 4 | import org.eclipse.microprofile.health.HealthCheckResponse; 5 | import org.eclipse.microprofile.health.Liveness; 6 | 7 | import javax.enterprise.context.ApplicationScoped; 8 | import java.util.Date; 9 | 10 | @ApplicationScoped 11 | @Liveness 12 | public class AlwaysHealthyLivenessCheck implements HealthCheck { 13 | @Override 14 | public HealthCheckResponse call() { 15 | return HealthCheckResponse 16 | .named("Always live") 17 | .withData("time", String.valueOf(new Date())) 18 | .up() 19 | .build(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapter5/transaction-service/src/test/java/io/quarkus/transactions/TransactionServiceTest.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import io.quarkus.test.common.QuarkusTestResource; 4 | import io.quarkus.test.junit.QuarkusTest; 5 | import io.restassured.http.ContentType; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import static io.restassured.RestAssured.given; 9 | 10 | @QuarkusTest 11 | @QuarkusTestResource(WiremockAccountService.class) 12 | public class TransactionServiceTest { 13 | @Test 14 | void testTransaction() { 15 | given() 16 | .body("142.12") 17 | .contentType(ContentType.JSON) 18 | .when().post("/transactions/{accountNumber}", 121212) 19 | .then() 20 | .statusCode(200); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /chapter6/transaction-service/src/test/java/io/quarkus/transactions/TransactionServiceTest.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import io.quarkus.test.common.QuarkusTestResource; 4 | import io.quarkus.test.junit.QuarkusTest; 5 | import io.restassured.http.ContentType; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import static io.restassured.RestAssured.given; 9 | 10 | @QuarkusTest 11 | @QuarkusTestResource(WiremockAccountService.class) 12 | public class TransactionServiceTest { 13 | @Test 14 | void testTransaction() { 15 | given() 16 | .body("142.12") 17 | .contentType(ContentType.JSON) 18 | .when().post("/transactions/{accountNumber}", 121212) 19 | .then() 20 | .statusCode(200); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /chapter7/transaction-service/src/test/java/io/quarkus/transactions/TransactionServiceTest.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import io.quarkus.test.common.QuarkusTestResource; 4 | import io.quarkus.test.junit.QuarkusTest; 5 | import io.restassured.http.ContentType; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import static io.restassured.RestAssured.given; 9 | 10 | @QuarkusTest 11 | @QuarkusTestResource(WiremockAccountService.class) 12 | public class TransactionServiceTest { 13 | @Test 14 | void testTransaction() { 15 | given() 16 | .body("142.12") 17 | .contentType(ContentType.JSON) 18 | .when().post("/transactions/{accountNumber}", 121212) 19 | .then() 20 | .statusCode(200); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /chapter9/transaction-service/src/test/java/io/quarkus/transactions/TransactionServiceTest.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import io.quarkus.test.common.QuarkusTestResource; 4 | import io.quarkus.test.junit.QuarkusTest; 5 | import io.restassured.http.ContentType; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import static io.restassured.RestAssured.given; 9 | 10 | @QuarkusTest 11 | @QuarkusTestResource(WiremockAccountService.class) 12 | public class TransactionServiceTest { 13 | @Test 14 | void testTransaction() { 15 | given() 16 | .body("142.12") 17 | .contentType(ContentType.JSON) 18 | .when().post("/transactions/{accountNumber}", 121212) 19 | .then() 20 | .statusCode(200); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /chapter10/transaction-service/src/test/java/io/quarkus/transactions/TransactionServiceTest.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import io.quarkus.test.common.QuarkusTestResource; 4 | import io.quarkus.test.junit.QuarkusTest; 5 | import io.restassured.http.ContentType; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import static io.restassured.RestAssured.given; 9 | 10 | @QuarkusTest 11 | @QuarkusTestResource(WiremockAccountService.class) 12 | public class TransactionServiceTest { 13 | @Test 14 | void testTransaction() { 15 | given() 16 | .body("142.12") 17 | .contentType(ContentType.JSON) 18 | .when().post("/transactions/{accountNumber}", 121212) 19 | .then() 20 | .statusCode(200); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /chapter13/transaction-service/src/test/java/io/quarkus/transactions/TransactionServiceTest.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import io.quarkus.test.common.QuarkusTestResource; 4 | import io.quarkus.test.junit.QuarkusTest; 5 | import io.restassured.http.ContentType; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import static io.restassured.RestAssured.given; 9 | 10 | @QuarkusTest 11 | @QuarkusTestResource(WiremockAccountService.class) 12 | public class TransactionServiceTest { 13 | @Test 14 | void testTransaction() { 15 | given() 16 | .body("142.12") 17 | .contentType(ContentType.JSON) 18 | .when().post("/transactions/{accountNumber}", 121212) 19 | .then() 20 | .statusCode(200); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-operator-serviceMonitor.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: monitoring.coreos.com/v1 2 | kind: ServiceMonitor 3 | metadata: 4 | labels: 5 | app.kubernetes.io/component: controller 6 | app.kubernetes.io/name: prometheus-operator 7 | app.kubernetes.io/version: v0.44.1 8 | name: prometheus-operator 9 | namespace: monitoring 10 | spec: 11 | endpoints: 12 | - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token 13 | honorLabels: true 14 | port: https 15 | scheme: https 16 | tlsConfig: 17 | insecureSkipVerify: true 18 | selector: 19 | matchLabels: 20 | app.kubernetes.io/component: controller 21 | app.kubernetes.io/name: prometheus-operator 22 | app.kubernetes.io/version: v0.44.1 23 | -------------------------------------------------------------------------------- /chapter13/scripts/keycloak-operator/hack/modify_etc_hosts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # The main part of this script has been downloaded from: https://gist.github.com/jacobtomlinson/4b835d807ebcea73c6c8f602613803d4 4 | 5 | set -x 6 | 7 | INGRESSES=$1 8 | MINIKUBE_IP=$2 9 | 10 | if [ -z "$INGRESSES" ]; then 11 | echo "Ingress address not set" 12 | exit 1 13 | fi 14 | 15 | if [ -z "$MINIKUBE_IP" ]; then 16 | echo "Assuming Minikube running with the current user" 17 | MINIKUBE_IP=$(minikube ip || exit 1) 18 | fi 19 | 20 | HOSTS_ENTRY="$MINIKUBE_IP $INGRESSES" 21 | 22 | if grep -Fq "$MINIKUBE_IP" /etc/hosts > /dev/null 23 | then 24 | sudo sed -i "s/^$MINIKUBE_IP.*/$HOSTS_ENTRY/" /etc/hosts 25 | echo "Updated hosts entry" 26 | else 27 | echo "$HOSTS_ENTRY" | sudo tee -a /etc/hosts 28 | echo "Added hosts entry" 29 | fi -------------------------------------------------------------------------------- /chapter12/account-service-annotations/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=account-service 3 | quarkus.kubernetes.name=account-service 4 | 5 | mp.openapi.extensions.smallrye.info.title=Account Service 6 | %dev.mp.openapi.extensions.smallrye.info.title=Account Service (development) 7 | mp.openapi.extensions.smallrye.info.version=1.0.0 8 | mp.openapi.extensions.smallrye.info.description=Service for maintaining accounts, their balances, and issuing deposit and withdrawal transactions 9 | mp.openapi.extensions.smallrye.info.license.name=Apache 2.0 10 | mp.openapi.extensions.smallrye.info.license.url=https://www.apache.org/licenses/LICENSE-2.0.html 11 | mp.openapi.extensions.smallrye.operationIdStrategy=METHOD 12 | mp.openapi.filter=quarkus.accounts.OpenApiFilter 13 | -------------------------------------------------------------------------------- /chapter8/account-service/src/test/java/quarkus/accounts/InMemoryLifecycleManager.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; 4 | import io.smallrye.reactive.messaging.connectors.InMemoryConnector; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | public class InMemoryLifecycleManager implements QuarkusTestResourceLifecycleManager { 10 | @Override 11 | public Map start() { 12 | Map env = new HashMap<>(); 13 | env.putAll(InMemoryConnector.switchIncomingChannelsToInMemory("overdraft-update")); 14 | env.putAll(InMemoryConnector.switchOutgoingChannelsToInMemory("account-overdrawn")); 15 | return env; 16 | } 17 | 18 | @Override 19 | public void stop() { 20 | InMemoryConnector.clear(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /chapter11/account-service/src/test/java/quarkus/accounts/InMemoryLifecycleManager.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; 4 | import io.smallrye.reactive.messaging.connectors.InMemoryConnector; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | public class InMemoryLifecycleManager implements QuarkusTestResourceLifecycleManager { 10 | @Override 11 | public Map start() { 12 | Map env = new HashMap<>(); 13 | env.putAll(InMemoryConnector.switchIncomingChannelsToInMemory("overdraft-update")); 14 | env.putAll(InMemoryConnector.switchOutgoingChannelsToInMemory("account-overdrawn")); 15 | return env; 16 | } 17 | 18 | @Override 19 | public void stop() { 20 | InMemoryConnector.clear(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /chapter10/micrometer-account-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=account-service-micrometer 3 | quarkus.kubernetes.name=account-service-micrometer 4 | 5 | quarkus.datasource.db-kind=postgresql 6 | quarkus.datasource.username=quarkus_banking 7 | quarkus.datasource.password=quarkus_banking 8 | quarkus.datasource.jdbc.url=jdbc:postgresql://postgres.default:5432/quarkus_banking 9 | 10 | %test.quarkus.datasource.db-kind=h2 11 | %test.quarkus.datasource.username=username-default 12 | %test.quarkus.datasource.password= 13 | %test.quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:default 14 | 15 | quarkus.hibernate-orm.database.generation=drop-and-create 16 | quarkus.hibernate-orm.sql-load-script=import.sql 17 | 18 | quarkus.hibernate-orm.metrics.enabled=true 19 | -------------------------------------------------------------------------------- /chapter4/jpa/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter10/transaction-service/src/main/java/io/quarkus/transactions/AccountServiceProgrammatic.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import javax.ws.rs.*; 4 | import javax.ws.rs.core.MediaType; 5 | import java.math.BigDecimal; 6 | import java.util.concurrent.CompletionStage; 7 | 8 | @Path("/accounts") 9 | @Produces(MediaType.APPLICATION_JSON) 10 | public interface AccountServiceProgrammatic { 11 | @GET 12 | @Path("/{acctNumber}/balance") 13 | BigDecimal getBalance(@PathParam("acctNumber") Long accountNumber); 14 | 15 | @POST 16 | @Path("{accountNumber}/transaction") 17 | void transact(@PathParam("accountNumber") Long accountNumber, BigDecimal amount); 18 | 19 | @POST 20 | @Path("{accountNumber}/transaction") 21 | CompletionStage transactAsync(@PathParam("accountNumber") Long accountNumber, BigDecimal amount); 22 | } 23 | -------------------------------------------------------------------------------- /chapter13/bank-service/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/bank-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/bank-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter13/transaction-service/src/main/java/io/quarkus/transactions/AccountServiceProgrammatic.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import javax.ws.rs.*; 4 | import javax.ws.rs.core.MediaType; 5 | import java.math.BigDecimal; 6 | import java.util.concurrent.CompletionStage; 7 | 8 | @Path("/accounts") 9 | @Produces(MediaType.APPLICATION_JSON) 10 | public interface AccountServiceProgrammatic { 11 | @GET 12 | @Path("/{acctNumber}/balance") 13 | BigDecimal getBalance(@PathParam("acctNumber") Long accountNumber); 14 | 15 | @POST 16 | @Path("{accountNumber}/transaction") 17 | void transact(@PathParam("accountNumber") Long accountNumber, BigDecimal amount); 18 | 19 | @POST 20 | @Path("{accountNumber}/transaction") 21 | CompletionStage transactAsync(@PathParam("accountNumber") Long accountNumber, BigDecimal amount); 22 | } 23 | -------------------------------------------------------------------------------- /chapter2/generated/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter3/bank-service/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/bank-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/bank-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter5/transaction-service/src/main/java/io/quarkus/transactions/AccountServiceProgrammatic.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import javax.ws.rs.*; 4 | import javax.ws.rs.core.MediaType; 5 | import java.math.BigDecimal; 6 | import java.util.concurrent.CompletionStage; 7 | 8 | @Path("/accounts") 9 | @Produces(MediaType.APPLICATION_JSON) 10 | public interface AccountServiceProgrammatic { 11 | @GET 12 | @Path("/{acctNumber}/balance") 13 | BigDecimal getBalance(@PathParam("acctNumber") Long accountNumber); 14 | 15 | @POST 16 | @Path("{accountNumber}/transaction") 17 | void transact(@PathParam("accountNumber") Long accountNumber, BigDecimal amount); 18 | 19 | @POST 20 | @Path("{accountNumber}/transaction") 21 | CompletionStage transactAsync(@PathParam("accountNumber") Long accountNumber, BigDecimal amount); 22 | } 23 | -------------------------------------------------------------------------------- /chapter6/transaction-service/src/main/java/io/quarkus/transactions/AccountServiceProgrammatic.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import javax.ws.rs.*; 4 | import javax.ws.rs.core.MediaType; 5 | import java.math.BigDecimal; 6 | import java.util.concurrent.CompletionStage; 7 | 8 | @Path("/accounts") 9 | @Produces(MediaType.APPLICATION_JSON) 10 | public interface AccountServiceProgrammatic { 11 | @GET 12 | @Path("/{acctNumber}/balance") 13 | BigDecimal getBalance(@PathParam("acctNumber") Long accountNumber); 14 | 15 | @POST 16 | @Path("{accountNumber}/transaction") 17 | void transact(@PathParam("accountNumber") Long accountNumber, BigDecimal amount); 18 | 19 | @POST 20 | @Path("{accountNumber}/transaction") 21 | CompletionStage transactAsync(@PathParam("accountNumber") Long accountNumber, BigDecimal amount); 22 | } 23 | -------------------------------------------------------------------------------- /chapter7/transaction-service/src/main/java/io/quarkus/transactions/AccountServiceProgrammatic.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import javax.ws.rs.*; 4 | import javax.ws.rs.core.MediaType; 5 | import java.math.BigDecimal; 6 | import java.util.concurrent.CompletionStage; 7 | 8 | @Path("/accounts") 9 | @Produces(MediaType.APPLICATION_JSON) 10 | public interface AccountServiceProgrammatic { 11 | @GET 12 | @Path("/{acctNumber}/balance") 13 | BigDecimal getBalance(@PathParam("acctNumber") Long accountNumber); 14 | 15 | @POST 16 | @Path("{accountNumber}/transaction") 17 | void transact(@PathParam("accountNumber") Long accountNumber, BigDecimal amount); 18 | 19 | @POST 20 | @Path("{accountNumber}/transaction") 21 | CompletionStage transactAsync(@PathParam("accountNumber") Long accountNumber, BigDecimal amount); 22 | } 23 | -------------------------------------------------------------------------------- /chapter9/bank-service/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/bank-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/bank-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter9/transaction-service/src/main/java/io/quarkus/transactions/AccountServiceProgrammatic.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import javax.ws.rs.*; 4 | import javax.ws.rs.core.MediaType; 5 | import java.math.BigDecimal; 6 | import java.util.concurrent.CompletionStage; 7 | 8 | @Path("/accounts") 9 | @Produces(MediaType.APPLICATION_JSON) 10 | public interface AccountServiceProgrammatic { 11 | @GET 12 | @Path("/{acctNumber}/balance") 13 | BigDecimal getBalance(@PathParam("acctNumber") Long accountNumber); 14 | 15 | @POST 16 | @Path("{accountNumber}/transaction") 17 | void transact(@PathParam("accountNumber") Long accountNumber, BigDecimal amount); 18 | 19 | @POST 20 | @Path("{accountNumber}/transaction") 21 | CompletionStage transactAsync(@PathParam("accountNumber") Long accountNumber, BigDecimal amount); 22 | } 23 | -------------------------------------------------------------------------------- /chapter4/active-record/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter10/account-service/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/node-exporter-serviceMonitor.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: monitoring.coreos.com/v1 2 | kind: ServiceMonitor 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: node-exporter 6 | app.kubernetes.io/version: v1.0.1 7 | name: node-exporter 8 | namespace: monitoring 9 | spec: 10 | endpoints: 11 | - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token 12 | interval: 15s 13 | port: https 14 | relabelings: 15 | - action: replace 16 | regex: (.*) 17 | replacement: $1 18 | sourceLabels: 19 | - __meta_kubernetes_pod_node_name 20 | targetLabel: instance 21 | scheme: https 22 | tlsConfig: 23 | insecureSkipVerify: true 24 | jobLabel: app.kubernetes.io/name 25 | selector: 26 | matchLabels: 27 | app.kubernetes.io/name: node-exporter 28 | -------------------------------------------------------------------------------- /chapter11/account-service/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter13/account-service/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter2/account-service/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter4/data-repository/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter5/account-service/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter6/account-service/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter7/account-service/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter8/account-service/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter9/account-service/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter11/overdraft-service/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/overdraft-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/overdraft-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter8/overdraft-service/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/overdraft-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/overdraft-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter10/micrometer-account-service/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter12/account-service-annotations/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter12/account-service-external-openapi/src/main/docker/Dockerfile.native: -------------------------------------------------------------------------------- 1 | #### 2 | # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode 3 | # 4 | # Before building the container image run: 5 | # 6 | # ./mvnw package -Pnative 7 | # 8 | # Then, build the image with: 9 | # 10 | # docker build -f src/main/docker/Dockerfile.native -t quarkus/account-service . 11 | # 12 | # Then run the container using: 13 | # 14 | # docker run -i --rm -p 8080:8080 quarkus/account-service 15 | # 16 | ### 17 | FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 18 | WORKDIR /work/ 19 | RUN chown 1001 /work \ 20 | && chmod "g+rwX" /work \ 21 | && chown 1001:root /work 22 | COPY --chown=1001:root target/*-runner /work/application 23 | 24 | EXPOSE 8080 25 | USER 1001 26 | 27 | CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] 28 | -------------------------------------------------------------------------------- /chapter13/transaction-service/src/test/java/io/quarkus/transactions/SecurityTest.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import static io.restassured.RestAssured.given; 4 | 5 | import org.hamcrest.CoreMatchers; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import io.quarkus.test.common.QuarkusTestResource; 9 | import io.quarkus.test.junit.QuarkusTest; 10 | import io.quarkus.test.security.TestSecurity; 11 | 12 | @QuarkusTest 13 | @QuarkusTestResource(WiremockAccountService.class) 14 | @TestSecurity(user = "duke", roles = { "customer" }) 15 | public class SecurityTest { 16 | @Test 17 | public void built_in_security() { 18 | given() 19 | .when() 20 | .get("/transactions/config-secure/{acctNumber}/balance", 121212) 21 | .then() 22 | .statusCode(200) 23 | .body(CoreMatchers.containsString("435.76")); 24 | } 25 | } -------------------------------------------------------------------------------- /chapter6/transaction-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=transaction-service 3 | quarkus.kubernetes.name=transaction-service 4 | 5 | %prod.io.quarkus.transactions.AccountService/mp-rest/url=http://account-service:80 6 | %prod.account.service=http://account-service:80 7 | 8 | %dev.quarkus.http.port=8088 9 | %dev.io.quarkus.transactions.AccountService/mp-rest/url=http://localhost:8080 10 | 11 | org.eclipse.microprofile.rest.client.propagateHeaders=Special-Header 12 | 13 | # Health Probe configuration 14 | 15 | quarkus.kubernetes.liveness-probe.initial-delay=10 16 | quarkus.kubernetes.liveness-probe.period=2 17 | quarkus.kubernetes.liveness-probe.timeout=5 18 | 19 | quarkus.kubernetes.readiness-probe.initial-delay=10 20 | quarkus.kubernetes.readiness-probe.period=2 21 | quarkus.kubernetes.readiness-probe.timeout=5 22 | -------------------------------------------------------------------------------- /chapter3/bank-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # Configuration file 2 | # key = value 3 | 4 | # Bank names 5 | bank.name=Bank of Quarkus 6 | %dev.bank.name=Bank of Development 7 | %prod.bank.name=Bank of Production 8 | 9 | # Using @ConfigProperties 10 | bank-support.email=support@bankofquarkus.com 11 | bank-support.phone=555-555-5555 12 | 13 | # Using @ConfigMapping 14 | bank-support-mapping.email=support@bankofquarkus.com 15 | bank-support-mapping.phone=555-555-5555 16 | bank-support-mapping.business.email=business-support@bankofquarkus.com 17 | bank-support-mapping.business.phone=555-555-1234 18 | 19 | # Enable Kubernetes ConfigMap 20 | %prod.quarkus.kubernetes-config.enabled=true 21 | %prod.quarkus.kubernetes-config.config-maps=banking 22 | 23 | # Enable Kubernetes Secrets 24 | %prod.quarkus.kubernetes-config.secrets.enabled=true 25 | %prod.quarkus.kubernetes-config.secrets=db-credentials 26 | -------------------------------------------------------------------------------- /chapter4/active-record/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=account-service 3 | quarkus.kubernetes.name=account-service 4 | 5 | %prod.quarkus.kubernetes-config.enabled=true 6 | %prod.quarkus.kubernetes-config.secrets.enabled=true 7 | %prod.quarkus.kubernetes-config.secrets=db-credentials 8 | 9 | quarkus.datasource.db-kind=postgresql 10 | quarkus.datasource.username=${username} 11 | quarkus.datasource.password=${password} 12 | quarkus.datasource.jdbc.url=jdbc:postgresql://postgres.default:5432/quarkus_banking 13 | 14 | %test.quarkus.datasource.db-kind=h2 15 | %test.quarkus.datasource.username=username-default 16 | %test.quarkus.datasource.password= 17 | %test.quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:default 18 | 19 | quarkus.hibernate-orm.database.generation=drop-and-create 20 | quarkus.hibernate-orm.sql-load-script=import.sql 21 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | quarkus 6 | book-examples-parent 7 | 1.0.0-SNAPSHOT 8 | pom 9 | 10 | 11 | chapter2 12 | chapter3/bank-service 13 | chapter4 14 | chapter5 15 | chapter6 16 | chapter7 17 | chapter8 18 | chapter9 19 | chapter10 20 | chapter11 21 | chapter12 22 | chapter13 23 | 24 | 25 | -------------------------------------------------------------------------------- /chapter11/overdraft-service/src/test/java/quarkus/overdraft/InMemoryLifecycleManager.java: -------------------------------------------------------------------------------- 1 | package quarkus.overdraft; 2 | 3 | import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; 4 | import io.smallrye.reactive.messaging.connectors.InMemoryConnector; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | public class InMemoryLifecycleManager implements QuarkusTestResourceLifecycleManager { 10 | @Override 11 | public Map start() { 12 | Map env = new HashMap<>(); 13 | env.putAll(InMemoryConnector.switchIncomingChannelsToInMemory("account-overdrawn")); 14 | env.putAll(InMemoryConnector.switchOutgoingChannelsToInMemory("overdraft-update")); 15 | env.putAll(InMemoryConnector.switchOutgoingChannelsToInMemory("overdraft-fee")); 16 | return env; 17 | } 18 | 19 | @Override 20 | public void stop() { 21 | InMemoryConnector.clear(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /chapter8/overdraft-service/src/test/java/quarkus/overdraft/InMemoryLifecycleManager.java: -------------------------------------------------------------------------------- 1 | package quarkus.overdraft; 2 | 3 | import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; 4 | import io.smallrye.reactive.messaging.connectors.InMemoryConnector; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | public class InMemoryLifecycleManager implements QuarkusTestResourceLifecycleManager { 10 | @Override 11 | public Map start() { 12 | Map env = new HashMap<>(); 13 | env.putAll(InMemoryConnector.switchIncomingChannelsToInMemory("account-overdrawn")); 14 | env.putAll(InMemoryConnector.switchOutgoingChannelsToInMemory("overdraft-update")); 15 | env.putAll(InMemoryConnector.switchOutgoingChannelsToInMemory("overdraft-fee")); 16 | return env; 17 | } 18 | 19 | @Override 20 | public void stop() { 21 | InMemoryConnector.clear(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /chapter4/README.md: -------------------------------------------------------------------------------- 1 | # Database access with Panache 2 | 3 | ## Deploying to Kubernetes 4 | 5 | ### PostgreSQL 6 | 7 | Create a Secret for the PostgreSQL database user credentials: 8 | 9 | ```shell script 10 | kubectl create secret generic db-credentials \ 11 | --from-literal=username=quarkus_banking \ 12 | --from-literal=password=quarkus_banking 13 | ``` 14 | 15 | Install PostgreSQL into Kubernetes: 16 | 17 | ```shell script 18 | kubectl apply -f postgresql_kubernetes.yml 19 | ``` 20 | 21 | ### Deploy application 22 | 23 | Choose one of the versions to deploy (jpa, active-record, or data-repository) and change into the directory. 24 | Then run the following to deploy the application: 25 | 26 | ```shell script 27 | eval $(minikube -p minikube docker-env) 28 | mvn clean package -Dquarkus.kubernetes.deploy=true 29 | ``` 30 | 31 | Use `minikube service list` to find the URL for the `account-service` to access it in a browser. 32 | -------------------------------------------------------------------------------- /chapter10/metrics/servicemonitor.yml: -------------------------------------------------------------------------------- 1 | apiVersion: monitoring.coreos.com/v1 2 | kind: ServiceMonitor 3 | metadata: 4 | name: transaction-service 5 | namespace: default 6 | labels: 7 | app.kubernetes.io/name: transaction-service 8 | spec: 9 | namespaceSelector: 10 | matchNames: 11 | - default 12 | selector: 13 | matchLabels: 14 | app.kubernetes.io/name: transaction-service 15 | endpoints: 16 | - port: http 17 | interval: 3s 18 | path: /q/metrics 19 | --- 20 | apiVersion: monitoring.coreos.com/v1 21 | kind: ServiceMonitor 22 | metadata: 23 | name: account-service 24 | namespace: default 25 | labels: 26 | app.kubernetes.io/name: account-service 27 | spec: 28 | namespaceSelector: 29 | matchNames: 30 | - default 31 | selector: 32 | matchLabels: 33 | app.kubernetes.io/name: account-service 34 | endpoints: 35 | - port: http 36 | interval: 3s 37 | path: /q/metrics 38 | -------------------------------------------------------------------------------- /chapter10/account-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=account-service 3 | quarkus.kubernetes.name=account-service 4 | 5 | quarkus.datasource.db-kind=postgresql 6 | quarkus.datasource.username=quarkus_banking 7 | quarkus.datasource.password=quarkus_banking 8 | quarkus.datasource.jdbc.url=jdbc:postgresql://localhost/quarkus_banking 9 | %prod.quarkus.datasource.jdbc.url=jdbc:postgresql://postgres.default:5432/quarkus_banking 10 | 11 | quarkus.hibernate-orm.database.generation=drop-and-create 12 | quarkus.hibernate-orm.sql-load-script=import.sql 13 | 14 | # Health Probe configuration 15 | 16 | quarkus.kubernetes.liveness-probe.initial-delay=10 17 | quarkus.kubernetes.liveness-probe.period=2 18 | quarkus.kubernetes.liveness-probe.timeout=5 19 | 20 | quarkus.kubernetes.readiness-probe.initial-delay=10 21 | quarkus.kubernetes.readiness-probe.period=2 22 | quarkus.kubernetes.readiness-probe.timeout=5 -------------------------------------------------------------------------------- /chapter6/account-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=account-service 3 | quarkus.kubernetes.name=account-service 4 | 5 | quarkus.datasource.db-kind=postgresql 6 | quarkus.datasource.username=quarkus_banking 7 | quarkus.datasource.password=quarkus_banking 8 | quarkus.datasource.jdbc.url=jdbc:postgresql://localhost/quarkus_banking 9 | %prod.quarkus.datasource.jdbc.url=jdbc:postgresql://postgres.default:5432/quarkus_banking 10 | 11 | quarkus.hibernate-orm.database.generation=drop-and-create 12 | quarkus.hibernate-orm.sql-load-script=import.sql 13 | 14 | # Health Probe configuration 15 | 16 | quarkus.kubernetes.liveness-probe.initial-delay=10 17 | quarkus.kubernetes.liveness-probe.period=2 18 | quarkus.kubernetes.liveness-probe.timeout=5 19 | 20 | quarkus.kubernetes.readiness-probe.initial-delay=10 21 | quarkus.kubernetes.readiness-probe.period=2 22 | quarkus.kubernetes.readiness-probe.timeout=5 -------------------------------------------------------------------------------- /chapter7/account-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=account-service 3 | quarkus.kubernetes.name=account-service 4 | 5 | quarkus.datasource.db-kind=postgresql 6 | quarkus.datasource.username=quarkus_banking 7 | quarkus.datasource.password=quarkus_banking 8 | quarkus.datasource.jdbc.url=jdbc:postgresql://localhost/quarkus_banking 9 | %prod.quarkus.datasource.jdbc.url=jdbc:postgresql://postgres.default:5432/quarkus_banking 10 | 11 | quarkus.hibernate-orm.database.generation=drop-and-create 12 | quarkus.hibernate-orm.sql-load-script=import.sql 13 | 14 | # Health Probe configuration 15 | 16 | quarkus.kubernetes.liveness-probe.initial-delay=10 17 | quarkus.kubernetes.liveness-probe.period=2 18 | quarkus.kubernetes.liveness-probe.timeout=5 19 | 20 | quarkus.kubernetes.readiness-probe.initial-delay=10 21 | quarkus.kubernetes.readiness-probe.period=2 22 | quarkus.kubernetes.readiness-probe.timeout=5 -------------------------------------------------------------------------------- /chapter9/account-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=account-service 3 | quarkus.kubernetes.name=account-service 4 | 5 | quarkus.datasource.db-kind=postgresql 6 | quarkus.datasource.username=quarkus_banking 7 | quarkus.datasource.password=quarkus_banking 8 | quarkus.datasource.jdbc.url=jdbc:postgresql://localhost/quarkus_banking 9 | %prod.quarkus.datasource.jdbc.url=jdbc:postgresql://postgres.default:5432/quarkus_banking 10 | 11 | quarkus.hibernate-orm.database.generation=drop-and-create 12 | quarkus.hibernate-orm.sql-load-script=import.sql 13 | 14 | # Health Probe configuration 15 | 16 | quarkus.kubernetes.liveness-probe.initial-delay=10 17 | quarkus.kubernetes.liveness-probe.period=2 18 | quarkus.kubernetes.liveness-probe.timeout=5 19 | 20 | quarkus.kubernetes.readiness-probe.initial-delay=10 21 | quarkus.kubernetes.readiness-probe.period=2 22 | quarkus.kubernetes.readiness-probe.timeout=5 -------------------------------------------------------------------------------- /chapter8/overdraft-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=overdraft-service 3 | quarkus.kubernetes.name=overdraft-service 4 | 5 | %prod.kafka.bootstrap.servers=my-cluster-kafka-bootstrap.kafka:9092 6 | 7 | mp.messaging.incoming.account-overdrawn.connector=smallrye-kafka 8 | mp.messaging.incoming.account-overdrawn.topic=overdrawn 9 | mp.messaging.incoming.account-overdrawn.value.deserializer=quarkus.overdraft.OverdrawnDeserializer 10 | 11 | mp.messaging.outgoing.overdraft-fee.connector=smallrye-kafka 12 | mp.messaging.outgoing.overdraft-fee.topic=account-fee 13 | mp.messaging.outgoing.overdraft-fee.value.serializer=io.quarkus.kafka.client.serialization.JsonbSerializer 14 | 15 | mp.messaging.outgoing.overdraft-update.connector=smallrye-kafka 16 | mp.messaging.outgoing.overdraft-update.topic=new-limit 17 | mp.messaging.outgoing.overdraft-update.value.serializer=io.quarkus.kafka.client.serialization.JsonbSerializer 18 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-prometheus.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: monitoring.coreos.com/v1 2 | kind: Prometheus 3 | metadata: 4 | labels: 5 | prometheus: k8s 6 | name: k8s 7 | namespace: monitoring 8 | spec: 9 | alerting: 10 | alertmanagers: 11 | - name: alertmanager-main 12 | namespace: monitoring 13 | port: web 14 | image: quay.io/prometheus/prometheus:v2.22.1 15 | nodeSelector: 16 | kubernetes.io/os: linux 17 | podMonitorNamespaceSelector: {} 18 | podMonitorSelector: {} 19 | probeNamespaceSelector: {} 20 | probeSelector: {} 21 | replicas: 2 22 | resources: 23 | requests: 24 | memory: 400Mi 25 | ruleSelector: 26 | matchLabels: 27 | prometheus: k8s 28 | role: alert-rules 29 | securityContext: 30 | fsGroup: 2000 31 | runAsNonRoot: true 32 | runAsUser: 1000 33 | serviceAccountName: prometheus-k8s 34 | serviceMonitorNamespaceSelector: {} 35 | serviceMonitorSelector: {} 36 | version: v2.22.1 37 | -------------------------------------------------------------------------------- /chapter5/README.md: -------------------------------------------------------------------------------- 1 | # Clients for consuming other microservices 2 | 3 | ## Local execution 4 | 5 | ### PostgreSQL 6 | 7 | ```shell script 8 | docker run --ulimit memlock=-1:-1 -it --rm=true --memory-swappiness=0 --name quarkus_banking -e POSTGRES_USER=quarkus_banking -e POSTGRES_PASSWORD=quarkus_banking -e POSTGRES_DB=quarkus_banking -p 5432:5432 postgres:12 9 | ``` 10 | 11 | ## Deploying to Kubernetes 12 | 13 | ### PostgreSQL 14 | 15 | Install PostgreSQL into Kubernetes: 16 | 17 | ```shell script 18 | kubectl apply -f postgresql_kubernetes.yml 19 | ``` 20 | 21 | ### Deploy application 22 | 23 | ```shell script 24 | eval $(minikube -p minikube docker-env) 25 | cd account-service 26 | mvn clean package -Dquarkus.kubernetes.deploy=true -DskipTests 27 | cd ../transaction-service 28 | mvn clean package -Dquarkus.kubernetes.deploy=true -DskipTests 29 | ``` 30 | 31 | Use `minikube service list` to find the URL for the `account-service` and `transaction-service` to interact with the services using `curl`. 32 | -------------------------------------------------------------------------------- /chapter10/postgresql_kubernetes.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: postgres 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: postgres 9 | template: 10 | metadata: 11 | labels: 12 | app: postgres 13 | spec: 14 | containers: 15 | - name: postgres 16 | image: postgres:12 17 | imagePullPolicy: Always 18 | ports: 19 | - containerPort: 5432 20 | protocol: TCP 21 | env: 22 | - name: POSTGRES_DB 23 | value: quarkus_banking 24 | - name: POSTGRES_USER 25 | value: quarkus_banking 26 | - name: POSTGRES_PASSWORD 27 | value: quarkus_banking 28 | --- 29 | apiVersion: v1 30 | kind: Service 31 | metadata: 32 | labels: 33 | app: postgres 34 | name: postgres 35 | spec: 36 | ports: 37 | - name: http 38 | port: 5432 39 | protocol: TCP 40 | selector: 41 | app: postgres 42 | type: NodePort 43 | -------------------------------------------------------------------------------- /chapter11/postgresql_kubernetes.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: postgres 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: postgres 9 | template: 10 | metadata: 11 | labels: 12 | app: postgres 13 | spec: 14 | containers: 15 | - name: postgres 16 | image: postgres:12 17 | imagePullPolicy: Always 18 | ports: 19 | - containerPort: 5432 20 | protocol: TCP 21 | env: 22 | - name: POSTGRES_DB 23 | value: quarkus_banking 24 | - name: POSTGRES_USER 25 | value: quarkus_banking 26 | - name: POSTGRES_PASSWORD 27 | value: quarkus_banking 28 | --- 29 | apiVersion: v1 30 | kind: Service 31 | metadata: 32 | labels: 33 | app: postgres 34 | name: postgres 35 | spec: 36 | ports: 37 | - name: http 38 | port: 5432 39 | protocol: TCP 40 | selector: 41 | app: postgres 42 | type: NodePort 43 | -------------------------------------------------------------------------------- /chapter13/postgresql_kubernetes.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: postgres 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: postgres 9 | template: 10 | metadata: 11 | labels: 12 | app: postgres 13 | spec: 14 | containers: 15 | - name: postgres 16 | image: postgres:12 17 | imagePullPolicy: Always 18 | ports: 19 | - containerPort: 5432 20 | protocol: TCP 21 | env: 22 | - name: POSTGRES_DB 23 | value: quarkus_banking 24 | - name: POSTGRES_USER 25 | value: quarkus_banking 26 | - name: POSTGRES_PASSWORD 27 | value: quarkus_banking 28 | --- 29 | apiVersion: v1 30 | kind: Service 31 | metadata: 32 | labels: 33 | app: postgres 34 | name: postgres 35 | spec: 36 | ports: 37 | - name: http 38 | port: 5432 39 | protocol: TCP 40 | selector: 41 | app: postgres 42 | type: NodePort 43 | -------------------------------------------------------------------------------- /chapter5/postgresql_kubernetes.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: postgres 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: postgres 9 | template: 10 | metadata: 11 | labels: 12 | app: postgres 13 | spec: 14 | containers: 15 | - name: postgres 16 | image: postgres:12 17 | imagePullPolicy: Always 18 | ports: 19 | - containerPort: 5432 20 | protocol: TCP 21 | env: 22 | - name: POSTGRES_DB 23 | value: quarkus_banking 24 | - name: POSTGRES_USER 25 | value: quarkus_banking 26 | - name: POSTGRES_PASSWORD 27 | value: quarkus_banking 28 | --- 29 | apiVersion: v1 30 | kind: Service 31 | metadata: 32 | labels: 33 | app: postgres 34 | name: postgres 35 | spec: 36 | ports: 37 | - name: http 38 | port: 5432 39 | protocol: TCP 40 | selector: 41 | app: postgres 42 | type: NodePort 43 | -------------------------------------------------------------------------------- /chapter6/postgresql_kubernetes.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: postgres 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: postgres 9 | template: 10 | metadata: 11 | labels: 12 | app: postgres 13 | spec: 14 | containers: 15 | - name: postgres 16 | image: postgres:12 17 | imagePullPolicy: Always 18 | ports: 19 | - containerPort: 5432 20 | protocol: TCP 21 | env: 22 | - name: POSTGRES_DB 23 | value: quarkus_banking 24 | - name: POSTGRES_USER 25 | value: quarkus_banking 26 | - name: POSTGRES_PASSWORD 27 | value: quarkus_banking 28 | --- 29 | apiVersion: v1 30 | kind: Service 31 | metadata: 32 | labels: 33 | app: postgres 34 | name: postgres 35 | spec: 36 | ports: 37 | - name: http 38 | port: 5432 39 | protocol: TCP 40 | selector: 41 | app: postgres 42 | type: NodePort 43 | -------------------------------------------------------------------------------- /chapter7/postgresql_kubernetes.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: postgres 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: postgres 9 | template: 10 | metadata: 11 | labels: 12 | app: postgres 13 | spec: 14 | containers: 15 | - name: postgres 16 | image: postgres:12 17 | imagePullPolicy: Always 18 | ports: 19 | - containerPort: 5432 20 | protocol: TCP 21 | env: 22 | - name: POSTGRES_DB 23 | value: quarkus_banking 24 | - name: POSTGRES_USER 25 | value: quarkus_banking 26 | - name: POSTGRES_PASSWORD 27 | value: quarkus_banking 28 | --- 29 | apiVersion: v1 30 | kind: Service 31 | metadata: 32 | labels: 33 | app: postgres 34 | name: postgres 35 | spec: 36 | ports: 37 | - name: http 38 | port: 5432 39 | protocol: TCP 40 | selector: 41 | app: postgres 42 | type: NodePort 43 | -------------------------------------------------------------------------------- /chapter8/postgresql_kubernetes.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: postgres 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: postgres 9 | template: 10 | metadata: 11 | labels: 12 | app: postgres 13 | spec: 14 | containers: 15 | - name: postgres 16 | image: postgres:12 17 | imagePullPolicy: Always 18 | ports: 19 | - containerPort: 5432 20 | protocol: TCP 21 | env: 22 | - name: POSTGRES_DB 23 | value: quarkus_banking 24 | - name: POSTGRES_USER 25 | value: quarkus_banking 26 | - name: POSTGRES_PASSWORD 27 | value: quarkus_banking 28 | --- 29 | apiVersion: v1 30 | kind: Service 31 | metadata: 32 | labels: 33 | app: postgres 34 | name: postgres 35 | spec: 36 | ports: 37 | - name: http 38 | port: 5432 39 | protocol: TCP 40 | selector: 41 | app: postgres 42 | type: NodePort 43 | -------------------------------------------------------------------------------- /chapter9/postgresql_kubernetes.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: postgres 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: postgres 9 | template: 10 | metadata: 11 | labels: 12 | app: postgres 13 | spec: 14 | containers: 15 | - name: postgres 16 | image: postgres:12 17 | imagePullPolicy: Always 18 | ports: 19 | - containerPort: 5432 20 | protocol: TCP 21 | env: 22 | - name: POSTGRES_DB 23 | value: quarkus_banking 24 | - name: POSTGRES_USER 25 | value: quarkus_banking 26 | - name: POSTGRES_PASSWORD 27 | value: quarkus_banking 28 | --- 29 | apiVersion: v1 30 | kind: Service 31 | metadata: 32 | labels: 33 | app: postgres 34 | name: postgres 35 | spec: 36 | ports: 37 | - name: http 38 | port: 5432 39 | protocol: TCP 40 | selector: 41 | app: postgres 42 | type: NodePort 43 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/kube-state-metrics-serviceMonitor.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: monitoring.coreos.com/v1 2 | kind: ServiceMonitor 3 | metadata: 4 | labels: 5 | app.kubernetes.io/name: kube-state-metrics 6 | app.kubernetes.io/version: 1.9.7 7 | name: kube-state-metrics 8 | namespace: monitoring 9 | spec: 10 | endpoints: 11 | - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token 12 | honorLabels: true 13 | interval: 30s 14 | port: https-main 15 | relabelings: 16 | - action: labeldrop 17 | regex: (pod|service|endpoint|namespace) 18 | scheme: https 19 | scrapeTimeout: 30s 20 | tlsConfig: 21 | insecureSkipVerify: true 22 | - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token 23 | interval: 30s 24 | port: https-self 25 | scheme: https 26 | tlsConfig: 27 | insecureSkipVerify: true 28 | jobLabel: app.kubernetes.io/name 29 | selector: 30 | matchLabels: 31 | app.kubernetes.io/name: kube-state-metrics 32 | -------------------------------------------------------------------------------- /chapter13/bank-service/src/main/java/quarkus/bank/TokenResource.java: -------------------------------------------------------------------------------- 1 | package quarkus.bank; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | import javax.inject.Inject; 7 | import javax.ws.rs.GET; 8 | import javax.ws.rs.Path; 9 | import javax.ws.rs.Produces; 10 | import javax.ws.rs.core.MediaType; 11 | 12 | import org.eclipse.microprofile.jwt.JsonWebToken; 13 | 14 | import io.quarkus.security.Authenticated; 15 | 16 | @Authenticated 17 | @Path("/token") 18 | public class TokenResource { 19 | /** 20 | * Injection point for the Access Token issued 21 | * by the OpenID Connect Provider 22 | */ 23 | @Inject 24 | JsonWebToken accessToken; 25 | 26 | @GET 27 | @Path("/tokeninfo") 28 | @Produces(MediaType.APPLICATION_JSON) 29 | public Set token() { 30 | HashSet set = new HashSet(); 31 | for (String t : accessToken.getClaimNames()) { 32 | set.add(t + " = " + accessToken.getClaim(t)); 33 | } 34 | return set; 35 | } 36 | } -------------------------------------------------------------------------------- /chapter10/micrometer-account-service/postgresql_kubernetes.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: postgres 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: postgres 9 | template: 10 | metadata: 11 | labels: 12 | app: postgres 13 | spec: 14 | containers: 15 | - name: postgres 16 | image: postgres:12 17 | imagePullPolicy: Always 18 | ports: 19 | - containerPort: 5432 20 | protocol: TCP 21 | env: 22 | - name: POSTGRES_DB 23 | value: quarkus_banking 24 | - name: POSTGRES_USER 25 | value: quarkus_banking 26 | - name: POSTGRES_PASSWORD 27 | value: quarkus_banking 28 | --- 29 | apiVersion: v1 30 | kind: Service 31 | metadata: 32 | labels: 33 | app: postgres 34 | name: postgres 35 | spec: 36 | ports: 37 | - name: http 38 | port: 5432 39 | protocol: TCP 40 | selector: 41 | app: postgres 42 | type: NodePort 43 | -------------------------------------------------------------------------------- /chapter13/scripts/keycloak-operator/deploy/operator.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: keycloak-operator 5 | spec: 6 | replicas: 1 7 | selector: 8 | matchLabels: 9 | name: keycloak-operator 10 | template: 11 | metadata: 12 | labels: 13 | name: keycloak-operator 14 | spec: 15 | serviceAccountName: keycloak-operator 16 | containers: 17 | - name: keycloak-operator 18 | # Replace this with the built image name 19 | image: quay.io/keycloak/keycloak-operator:14.0.0 20 | command: 21 | - keycloak-operator 22 | imagePullPolicy: Always 23 | env: 24 | - name: WATCH_NAMESPACE 25 | valueFrom: 26 | fieldRef: 27 | fieldPath: metadata.namespace 28 | - name: POD_NAME 29 | valueFrom: 30 | fieldRef: 31 | fieldPath: metadata.name 32 | - name: OPERATOR_NAME 33 | value: "keycloak-operator" 34 | -------------------------------------------------------------------------------- /chapter8/account-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=account-service 3 | quarkus.kubernetes.name=account-service 4 | 5 | quarkus.datasource.db-kind=postgresql 6 | quarkus.datasource.username=quarkus_banking 7 | quarkus.datasource.password=quarkus_banking 8 | %prod.quarkus.datasource.jdbc.url=jdbc:postgresql://postgres.default:5432/quarkus_banking 9 | 10 | quarkus.hibernate-orm.database.generation=drop-and-create 11 | quarkus.hibernate-orm.sql-load-script=import.sql 12 | 13 | %prod.kafka.bootstrap.servers=my-cluster-kafka-bootstrap.kafka:9092 14 | 15 | mp.messaging.outgoing.account-overdrawn.connector=smallrye-kafka 16 | mp.messaging.outgoing.account-overdrawn.topic=overdrawn 17 | mp.messaging.outgoing.account-overdrawn.value.serializer=io.quarkus.kafka.client.serialization.JsonbSerializer 18 | 19 | mp.messaging.incoming.overdraft-update.connector=smallrye-kafka 20 | mp.messaging.incoming.overdraft-update.topic=new-limit 21 | mp.messaging.incoming.overdraft-update.value.deserializer=quarkus.accounts.OverdraftLimitUpdateDeserializer -------------------------------------------------------------------------------- /chapter10/metrics/scripts/invoke_deposit_endpoints.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | # Number of calls per endpoint 5 | num_requests=${1:-100} 6 | 7 | # Bash method to deposit random funds to the specified URL 8 | # a specified number of times 9 | 10 | function post_deposit() { 11 | # URL to deposit endpoint 12 | url=$1 13 | 14 | # Number of times to deposit 15 | num_deposits=$2 16 | 17 | count=0 18 | 19 | while (( count++ < $num_deposits )); do 20 | curl -s -i \ 21 | -H "Content-Type:application/json" \ 22 | -X POST \ 23 | -d "\""$((1 + $RANDOM % 1000))"\"" \ 24 | $url 25 | done 26 | echo 27 | } 28 | 29 | # Get the transaction service URL from minikube 30 | export TRANSACTION_URL=`minikube service --url transaction-service` 31 | 32 | # Invoke the imperative, async, and imperative REST Client API endpoints 33 | # (default) 100 times each 34 | 35 | post_deposit $TRANSACTION_URL/transactions/444666 $num_requests & 36 | post_deposit $TRANSACTION_URL/transactions/async/444666 $num_requests & 37 | post_deposit $TRANSACTION_URL/transactions/api/444666 $num_requests & 38 | 39 | wait 40 | -------------------------------------------------------------------------------- /chapter13/scripts/gettoken.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$1" = "remote" ]; 4 | then 5 | 6 | # Run CURL from within the container to obtain a token with "keycloak" issuer, 7 | # which maps to the host name in the container 8 | 9 | kubectl run curl \ 10 | -n keycloak \ 11 | -i \ 12 | --image=curlimages/curl:7.76.0 \ 13 | --rm \ 14 | --tty \ 15 | --restart=Never \ 16 | --command -- \ 17 | curl -X POST -s -k https://keycloak:8443/auth/realms/bank/protocol/openid-connect/token \ 18 | --user bank:bank \ 19 | -H 'content-type: application/x-www-form-urlencoded' \ 20 | -d 'username=duke&password=duke&grant_type=password' |\ 21 | cut -d\" -f4 22 | else 23 | 24 | # Run CURL from localhost to obtain a token with "localhost" issuer, 25 | # which maps to the host name in the container 26 | 27 | curl -X POST -s -k http://keycloak.local/auth/realms/bank/protocol/openid-connect/token \ 28 | --user bank:bank \ 29 | -H 'content-type: application/x-www-form-urlencoded' \ 30 | -d 'username=duke&password=duke&grant_type=password' |\ 31 | cut -d\" -f4 32 | fi 33 | 34 | -------------------------------------------------------------------------------- /chapter11/transaction-service/src/main/java/io/quarkus/transactions/TransactionResource.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import org.eclipse.microprofile.rest.client.inject.RestClient; 4 | 5 | import javax.inject.Inject; 6 | import javax.ws.rs.*; 7 | import javax.ws.rs.core.MediaType; 8 | import javax.ws.rs.core.Response; 9 | 10 | @Path("/transactions") 11 | @Produces(MediaType.APPLICATION_JSON) 12 | @Consumes(MediaType.APPLICATION_JSON) 13 | public class TransactionResource { 14 | @Inject 15 | @RestClient 16 | AccountService accountService; 17 | 18 | @PUT 19 | @Path("/{acctNumber}/withdrawal") 20 | public Account withdrawal(@PathParam("acctNumber") Long accountNumber, String amount) throws AccountNotFoundException { 21 | return accountService.withdrawal(accountNumber, amount); 22 | } 23 | 24 | @PUT 25 | @Path("/{acctNumber}/deposit") 26 | public Response deposit(@PathParam("acctNumber") Long accountNumber, String amount) { 27 | try { 28 | accountService.deposit(accountNumber, amount); 29 | return Response.ok().build(); 30 | } catch (Throwable t) { 31 | return Response.serverError().entity(t).build(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/alertmanager-secret.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: alertmanager-main 5 | namespace: monitoring 6 | stringData: 7 | alertmanager.yaml: |- 8 | "global": 9 | "resolve_timeout": "5m" 10 | "inhibit_rules": 11 | - "equal": 12 | - "namespace" 13 | - "alertname" 14 | "source_match": 15 | "severity": "critical" 16 | "target_match_re": 17 | "severity": "warning|info" 18 | - "equal": 19 | - "namespace" 20 | - "alertname" 21 | "source_match": 22 | "severity": "warning" 23 | "target_match_re": 24 | "severity": "info" 25 | "receivers": 26 | - "name": "Default" 27 | - "name": "Watchdog" 28 | - "name": "Critical" 29 | "route": 30 | "group_by": 31 | - "namespace" 32 | "group_interval": "5m" 33 | "group_wait": "30s" 34 | "receiver": "Default" 35 | "repeat_interval": "12h" 36 | "routes": 37 | - "match": 38 | "alertname": "Watchdog" 39 | "receiver": "Watchdog" 40 | - "match": 41 | "severity": "critical" 42 | "receiver": "Critical" 43 | type: Opaque 44 | -------------------------------------------------------------------------------- /chapter10/metrics/scripts/overload_bulkhead.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ### 4 | ### Cause TransactionService BulkheadExceptions. Not 100% gauranted, 5 | ### but likely to cause them. 6 | ### 7 | 8 | TRANSACTION_URL=${1:-"http://localhost:8088"} 9 | num_requests=${2:-100} 10 | 11 | # Bash method to deposit random funds to the specified URL 12 | # a specified number of times 13 | 14 | function post_deposit() { 15 | # URL to deposit endpoint 16 | url=$1 17 | 18 | # Number of times to deposit 19 | num_deposits=$2 20 | 21 | count=0 22 | 23 | while (( count++ < $num_deposits )); do 24 | curl -s -i \ 25 | -H "Content-Type:application/json" \ 26 | -X POST \ 27 | -d "\""$((1 + $RANDOM % 1000))"\"" \ 28 | $url 29 | done 30 | echo 31 | } 32 | 33 | # Deposit funds (default) 200 times to the MicroProfile REST Client 34 | # api endpoint 35 | # Run the first 100 in the background to cause a number of 36 | # BulkheadExceptions (more than one simultaneous request) 37 | 38 | post_deposit $TRANSACTION_URL/transactions/api/444666 $num_requests & 39 | post_deposit $TRANSACTION_URL/transactions/api/444666 $num_requests & 40 | 41 | # Wait for the background processes to stop. 42 | 43 | wait 44 | -------------------------------------------------------------------------------- /chapter4/postgresql_kubernetes.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: postgres 5 | spec: 6 | selector: 7 | matchLabels: 8 | app: postgres 9 | template: 10 | metadata: 11 | labels: 12 | app: postgres 13 | spec: 14 | containers: 15 | - name: postgres 16 | image: postgres:12 17 | imagePullPolicy: Always 18 | ports: 19 | - containerPort: 5432 20 | protocol: TCP 21 | env: 22 | - name: POSTGRES_DB 23 | value: quarkus_banking 24 | - name: POSTGRES_USER 25 | valueFrom: 26 | secretKeyRef: 27 | name: db-credentials 28 | key: username 29 | - name: POSTGRES_PASSWORD 30 | valueFrom: 31 | secretKeyRef: 32 | name: db-credentials 33 | key: password 34 | --- 35 | apiVersion: v1 36 | kind: Service 37 | metadata: 38 | labels: 39 | app: postgres 40 | name: postgres 41 | spec: 42 | ports: 43 | - name: http 44 | port: 5432 45 | protocol: TCP 46 | selector: 47 | app: postgres 48 | type: NodePort 49 | -------------------------------------------------------------------------------- /chapter4/jpa/src/main/resources/import.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (1, 123456789, 0, 550.78, 'Debbie Hall', 12345); 2 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (2, 111222333, 0, 2389.32, 'David Tennant', 112211); 3 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (3, 444666, 0, 3499.12, 'Billie Piper', 332233); 4 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (4, 87878787, 0, 890.54, 'Matt Smith', 444434); 5 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (5, 990880221, 0, 1298.34, 'Alex Kingston', 778877); 6 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (6, 987654321, 0, 781.82, 'Tom Baker', 908990); 7 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (7, 5465, 0, 239.33, 'Alex Trebek', 776868); 8 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (8, 78790, 0, 439.01, 'Vanna White', 444222); 9 | -------------------------------------------------------------------------------- /chapter5/account-service/src/main/resources/import.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (1, 123456789, 0, 550.78, 'Debbie Hall', 12345); 2 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (2, 111222333, 0, 2389.32, 'David Tennant', 112211); 3 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (3, 444666, 0, 3499.12, 'Billie Piper', 332233); 4 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (4, 87878787, 0, 890.54, 'Matt Smith', 444434); 5 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (5, 990880221, 0, 1298.34, 'Alex Kingston', 778877); 6 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (6, 987654321, 0, 781.82, 'Tom Baker', 908990); 7 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (7, 5465, 0, 239.33, 'Alex Trebek', 776868); 8 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (8, 78790, 0, 439.01, 'Vanna White', 444222); 9 | -------------------------------------------------------------------------------- /chapter10/metrics/manifests-prometheus-grafana/prometheus-roleBindingSpecificNamespaces.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | items: 3 | - apiVersion: rbac.authorization.k8s.io/v1 4 | kind: RoleBinding 5 | metadata: 6 | name: prometheus-k8s 7 | namespace: default 8 | roleRef: 9 | apiGroup: rbac.authorization.k8s.io 10 | kind: Role 11 | name: prometheus-k8s 12 | subjects: 13 | - kind: ServiceAccount 14 | name: prometheus-k8s 15 | namespace: monitoring 16 | - apiVersion: rbac.authorization.k8s.io/v1 17 | kind: RoleBinding 18 | metadata: 19 | name: prometheus-k8s 20 | namespace: kube-system 21 | roleRef: 22 | apiGroup: rbac.authorization.k8s.io 23 | kind: Role 24 | name: prometheus-k8s 25 | subjects: 26 | - kind: ServiceAccount 27 | name: prometheus-k8s 28 | namespace: monitoring 29 | - apiVersion: rbac.authorization.k8s.io/v1 30 | kind: RoleBinding 31 | metadata: 32 | name: prometheus-k8s 33 | namespace: monitoring 34 | roleRef: 35 | apiGroup: rbac.authorization.k8s.io 36 | kind: Role 37 | name: prometheus-k8s 38 | subjects: 39 | - kind: ServiceAccount 40 | name: prometheus-k8s 41 | namespace: monitoring 42 | kind: RoleBindingList 43 | -------------------------------------------------------------------------------- /chapter7/transaction-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=transaction-service 3 | quarkus.kubernetes.name=transaction-service 4 | 5 | %prod.io.quarkus.transactions.AccountService/mp-rest/url=http://account-service:80 6 | %prod.account.service=http://account-service:80 7 | 8 | %dev.quarkus.http.port=8088 9 | %dev.io.quarkus.transactions.AccountService/mp-rest/url=http://localhost:8080 10 | 11 | org.eclipse.microprofile.rest.client.propagateHeaders=Special-Header 12 | 13 | # Health Probe configuration 14 | 15 | quarkus.kubernetes.liveness-probe.initial-delay=10 16 | quarkus.kubernetes.liveness-probe.period=2 17 | quarkus.kubernetes.liveness-probe.timeout=5 18 | 19 | quarkus.kubernetes.readiness-probe.initial-delay=10 20 | quarkus.kubernetes.readiness-probe.period=2 21 | quarkus.kubernetes.readiness-probe.timeout=5 22 | 23 | # Modify the MicroProfile Fault Tolerance Timeout settings 24 | # io.quarkus.transactions.TransactionResource/Timeout/enabled=false 25 | io.quarkus.transactions.TransactionResource/getBalance/Timeout/value=150 26 | io.quarkus.transactions.TransactionResource/newTransactionWithApi/CircuitBreaker/skipOn=org.eclipse.microprofile.faulttolerance.exceptions.BulkheadException 27 | -------------------------------------------------------------------------------- /chapter9/transaction-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=transaction-service 3 | quarkus.kubernetes.name=transaction-service 4 | 5 | %prod.io.quarkus.transactions.AccountService/mp-rest/url=http://account-service:80 6 | %prod.account.service=http://account-service:80 7 | 8 | %dev.quarkus.http.port=8088 9 | %dev.io.quarkus.transactions.AccountService/mp-rest/url=http://localhost:8080 10 | 11 | org.eclipse.microprofile.rest.client.propagateHeaders=Special-Header 12 | 13 | # Health Probe configuration 14 | 15 | quarkus.kubernetes.liveness-probe.initial-delay=10 16 | quarkus.kubernetes.liveness-probe.period=2 17 | quarkus.kubernetes.liveness-probe.timeout=5 18 | 19 | quarkus.kubernetes.readiness-probe.initial-delay=10 20 | quarkus.kubernetes.readiness-probe.period=2 21 | quarkus.kubernetes.readiness-probe.timeout=5 22 | 23 | # Modify the MicroProfile Fault Tolerance Timeout settings 24 | # io.quarkus.transactions.TransactionResource/Timeout/enabled=false 25 | io.quarkus.transactions.TransactionResource/getBalance/Timeout/value=150 26 | io.quarkus.transactions.TransactionResource/newTransactionWithApi/CircuitBreaker/skipOn=org.eclipse.microprofile.faulttolerance.exceptions.BulkheadException 27 | -------------------------------------------------------------------------------- /chapter10/account-service/src/main/java/quarkus/accounts/Account.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import io.quarkus.hibernate.orm.panache.PanacheEntity; 4 | 5 | import javax.persistence.*; 6 | import java.math.BigDecimal; 7 | import java.util.Objects; 8 | 9 | @Entity 10 | public class Account extends PanacheEntity { 11 | public Long accountNumber; 12 | public Long customerNumber; 13 | public String customerName; 14 | public BigDecimal balance; 15 | public AccountStatus accountStatus = AccountStatus.OPEN; 16 | 17 | public static long totalAccountsForCustomer(Long customerNumber) { 18 | return find("customerNumber", customerNumber).count(); 19 | } 20 | 21 | public static Account findByAccountNumber(Long accountNumber) { 22 | return find("accountNumber", accountNumber).firstResult(); 23 | } 24 | 25 | @Override 26 | public boolean equals(Object o) { 27 | if (this == o) return true; 28 | if (o == null || getClass() != o.getClass()) return false; 29 | Account account = (Account) o; 30 | return id.equals(account.id) && 31 | accountNumber.equals(account.accountNumber) && 32 | customerNumber.equals(account.customerNumber); 33 | } 34 | 35 | @Override 36 | public int hashCode() { 37 | return Objects.hash(id, accountNumber, customerNumber); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /chapter13/account-service/src/main/java/quarkus/accounts/Account.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import io.quarkus.hibernate.orm.panache.PanacheEntity; 4 | 5 | import javax.persistence.*; 6 | import java.math.BigDecimal; 7 | import java.util.Objects; 8 | 9 | @Entity 10 | public class Account extends PanacheEntity { 11 | public Long accountNumber; 12 | public Long customerNumber; 13 | public String customerName; 14 | public BigDecimal balance; 15 | public AccountStatus accountStatus = AccountStatus.OPEN; 16 | 17 | public static long totalAccountsForCustomer(Long customerNumber) { 18 | return find("customerNumber", customerNumber).count(); 19 | } 20 | 21 | public static Account findByAccountNumber(Long accountNumber) { 22 | return find("accountNumber", accountNumber).firstResult(); 23 | } 24 | 25 | @Override 26 | public boolean equals(Object o) { 27 | if (this == o) return true; 28 | if (o == null || getClass() != o.getClass()) return false; 29 | Account account = (Account) o; 30 | return id.equals(account.id) && 31 | accountNumber.equals(account.accountNumber) && 32 | customerNumber.equals(account.customerNumber); 33 | } 34 | 35 | @Override 36 | public int hashCode() { 37 | return Objects.hash(id, accountNumber, customerNumber); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /chapter5/account-service/src/main/java/quarkus/accounts/Account.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import io.quarkus.hibernate.orm.panache.PanacheEntity; 4 | 5 | import javax.persistence.*; 6 | import java.math.BigDecimal; 7 | import java.util.Objects; 8 | 9 | @Entity 10 | public class Account extends PanacheEntity { 11 | public Long accountNumber; 12 | public Long customerNumber; 13 | public String customerName; 14 | public BigDecimal balance; 15 | public AccountStatus accountStatus = AccountStatus.OPEN; 16 | 17 | public static long totalAccountsForCustomer(Long customerNumber) { 18 | return find("customerNumber", customerNumber).count(); 19 | } 20 | 21 | public static Account findByAccountNumber(Long accountNumber) { 22 | return find("accountNumber", accountNumber).firstResult(); 23 | } 24 | 25 | @Override 26 | public boolean equals(Object o) { 27 | if (this == o) return true; 28 | if (o == null || getClass() != o.getClass()) return false; 29 | Account account = (Account) o; 30 | return id.equals(account.id) && 31 | accountNumber.equals(account.accountNumber) && 32 | customerNumber.equals(account.customerNumber); 33 | } 34 | 35 | @Override 36 | public int hashCode() { 37 | return Objects.hash(id, accountNumber, customerNumber); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /chapter6/account-service/src/main/java/quarkus/accounts/Account.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import io.quarkus.hibernate.orm.panache.PanacheEntity; 4 | 5 | import javax.persistence.*; 6 | import java.math.BigDecimal; 7 | import java.util.Objects; 8 | 9 | @Entity 10 | public class Account extends PanacheEntity { 11 | public Long accountNumber; 12 | public Long customerNumber; 13 | public String customerName; 14 | public BigDecimal balance; 15 | public AccountStatus accountStatus = AccountStatus.OPEN; 16 | 17 | public static long totalAccountsForCustomer(Long customerNumber) { 18 | return find("customerNumber", customerNumber).count(); 19 | } 20 | 21 | public static Account findByAccountNumber(Long accountNumber) { 22 | return find("accountNumber", accountNumber).firstResult(); 23 | } 24 | 25 | @Override 26 | public boolean equals(Object o) { 27 | if (this == o) return true; 28 | if (o == null || getClass() != o.getClass()) return false; 29 | Account account = (Account) o; 30 | return id.equals(account.id) && 31 | accountNumber.equals(account.accountNumber) && 32 | customerNumber.equals(account.customerNumber); 33 | } 34 | 35 | @Override 36 | public int hashCode() { 37 | return Objects.hash(id, accountNumber, customerNumber); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /chapter7/account-service/src/main/java/quarkus/accounts/Account.java: -------------------------------------------------------------------------------- 1 | package quarkus.accounts; 2 | 3 | import io.quarkus.hibernate.orm.panache.PanacheEntity; 4 | 5 | import javax.persistence.*; 6 | import java.math.BigDecimal; 7 | import java.util.Objects; 8 | 9 | @Entity 10 | public class Account extends PanacheEntity { 11 | public Long accountNumber; 12 | public Long customerNumber; 13 | public String customerName; 14 | public BigDecimal balance; 15 | public AccountStatus accountStatus = AccountStatus.OPEN; 16 | 17 | public static long totalAccountsForCustomer(Long customerNumber) { 18 | return find("customerNumber", customerNumber).count(); 19 | } 20 | 21 | public static Account findByAccountNumber(Long accountNumber) { 22 | return find("accountNumber", accountNumber).firstResult(); 23 | } 24 | 25 | @Override 26 | public boolean equals(Object o) { 27 | if (this == o) return true; 28 | if (o == null || getClass() != o.getClass()) return false; 29 | Account account = (Account) o; 30 | return id.equals(account.id) && 31 | accountNumber.equals(account.accountNumber) && 32 | customerNumber.equals(account.customerNumber); 33 | } 34 | 35 | @Override 36 | public int hashCode() { 37 | return Objects.hash(id, accountNumber, customerNumber); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /chapter10/transaction-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=transaction-service 3 | quarkus.kubernetes.name=transaction-service 4 | 5 | %prod.io.quarkus.transactions.AccountService/mp-rest/url=http://account-service:80 6 | %prod.account.service=http://account-service:80 7 | 8 | %dev.quarkus.http.port=8088 9 | %dev.io.quarkus.transactions.AccountService/mp-rest/url=http://localhost:8080 10 | 11 | org.eclipse.microprofile.rest.client.propagateHeaders=Special-Header 12 | 13 | # Health Probe configuration 14 | 15 | quarkus.kubernetes.liveness-probe.initial-delay=10 16 | quarkus.kubernetes.liveness-probe.period=2 17 | quarkus.kubernetes.liveness-probe.timeout=5 18 | 19 | quarkus.kubernetes.readiness-probe.initial-delay=10 20 | quarkus.kubernetes.readiness-probe.period=2 21 | quarkus.kubernetes.readiness-probe.timeout=5 22 | 23 | # Modify the MicroProfile Fault Tolerance Timeout settings 24 | # io.quarkus.transactions.TransactionResource/Timeout/enabled=false 25 | io.quarkus.transactions.TransactionResource/getBalance/Timeout/value=150 26 | io.quarkus.transactions.TransactionResource/newTransactionWithApi/CircuitBreaker/skipOn=org.eclipse.microprofile.faulttolerance.exceptions.BulkheadException 27 | 28 | # MicroProfile Metrics settings 29 | #MP_Fault_Tolerance_Metrics_Enabled=false 30 | quarkus.resteasy.metrics.enabled=true 31 | -------------------------------------------------------------------------------- /chapter10/account-service/src/main/resources/import.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (1, 123456789, 0, 550.78, 'Debbie Hall', 12345); 2 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (2, 111222333, 0, 2389.32, 'David Tennant', 112211); 3 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (3, 444666, 0, 3499.12, 'Billie Piper', 332233); 4 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (4, 87878787, 0, 890.54, 'Matt Smith', 444434); 5 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (5, 990880221, 0, 1298.34, 'Alex Kingston', 778877); 6 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (6, 987654321, 0, 781.82, 'Tom Baker', 908990); 7 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (7, 5465, 0, 239.33, 'Alex Trebek', 776868); 8 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (8, 78790, 0, 439.01, 'Vanna White', 444222); 9 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (9, 999999999, 0, 999999999.01, 'Readiness HealthCheck', 99999999999); 10 | -------------------------------------------------------------------------------- /chapter13/account-service/src/main/resources/import.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (1, 123456789, 0, 550.78, 'Debbie Hall', 12345); 2 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (2, 111222333, 0, 2389.32, 'David Tennant', 112211); 3 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (3, 444666, 0, 3499.12, 'Billie Piper', 332233); 4 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (4, 87878787, 0, 890.54, 'Matt Smith', 444434); 5 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (5, 990880221, 0, 1298.34, 'Alex Kingston', 778877); 6 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (6, 987654321, 0, 781.82, 'Tom Baker', 908990); 7 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (7, 5465, 0, 239.33, 'Alex Trebek', 776868); 8 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (8, 78790, 0, 439.01, 'Vanna White', 444222); 9 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (9, 999999999, 0, 999999999.01, 'Readiness HealthCheck', 99999999999); 10 | -------------------------------------------------------------------------------- /chapter6/account-service/src/main/resources/import.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (1, 123456789, 0, 550.78, 'Debbie Hall', 12345); 2 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (2, 111222333, 0, 2389.32, 'David Tennant', 112211); 3 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (3, 444666, 0, 3499.12, 'Billie Piper', 332233); 4 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (4, 87878787, 0, 890.54, 'Matt Smith', 444434); 5 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (5, 990880221, 0, 1298.34, 'Alex Kingston', 778877); 6 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (6, 987654321, 0, 781.82, 'Tom Baker', 908990); 7 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (7, 5465, 0, 239.33, 'Alex Trebek', 776868); 8 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (8, 78790, 0, 439.01, 'Vanna White', 444222); 9 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (9, 999999999, 0, 999999999.01, 'Readiness HealthCheck', 99999999999); 10 | -------------------------------------------------------------------------------- /chapter7/account-service/src/main/resources/import.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (1, 123456789, 0, 550.78, 'Debbie Hall', 12345); 2 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (2, 111222333, 0, 2389.32, 'David Tennant', 112211); 3 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (3, 444666, 0, 3499.12, 'Billie Piper', 332233); 4 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (4, 87878787, 0, 890.54, 'Matt Smith', 444434); 5 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (5, 990880221, 0, 1298.34, 'Alex Kingston', 778877); 6 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (6, 987654321, 0, 781.82, 'Tom Baker', 908990); 7 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (7, 5465, 0, 239.33, 'Alex Trebek', 776868); 8 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (8, 78790, 0, 439.01, 'Vanna White', 444222); 9 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (9, 999999999, 0, 999999999.01, 'Readiness HealthCheck', 99999999999); 10 | -------------------------------------------------------------------------------- /chapter9/account-service/src/main/resources/import.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (1, 123456789, 0, 550.78, 'Debbie Hall', 12345); 2 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (2, 111222333, 0, 2389.32, 'David Tennant', 112211); 3 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (3, 444666, 0, 3499.12, 'Billie Piper', 332233); 4 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (4, 87878787, 0, 890.54, 'Matt Smith', 444434); 5 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (5, 990880221, 0, 1298.34, 'Alex Kingston', 778877); 6 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (6, 987654321, 0, 781.82, 'Tom Baker', 908990); 7 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (7, 5465, 0, 239.33, 'Alex Trebek', 776868); 8 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (8, 78790, 0, 439.01, 'Vanna White', 444222); 9 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (9, 999999999, 0, 999999999.01, 'Readiness HealthCheck', 99999999999); 10 | -------------------------------------------------------------------------------- /chapter4/active-record/src/main/resources/import.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 123456789, 0, 550.78, 'Debbie Hall', 12345); 2 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 111222333, 0, 2389.32, 'David Tennant', 112211); 3 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 444666, 0, 3499.12, 'Billie Piper', 332233); 4 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 87878787, 0, 890.54, 'Matt Smith', 444434); 5 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 990880221, 0, 1298.34, 'Alex Kingston', 778877); 6 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 987654321, 0, 781.82, 'Tom Baker', 908990); 7 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 5465, 0, 239.33, 'Alex Trebek', 776868); 8 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 78790, 0, 439.01, 'Vanna White', 444222); 9 | -------------------------------------------------------------------------------- /chapter4/data-repository/src/main/resources/import.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 123456789, 0, 550.78, 'Debbie Hall', 12345); 2 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 111222333, 0, 2389.32, 'David Tennant', 112211); 3 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 444666, 0, 3499.12, 'Billie Piper', 332233); 4 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 87878787, 0, 890.54, 'Matt Smith', 444434); 5 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 990880221, 0, 1298.34, 'Alex Kingston', 778877); 6 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 987654321, 0, 781.82, 'Tom Baker', 908990); 7 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 5465, 0, 239.33, 'Alex Trebek', 776868); 8 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 78790, 0, 439.01, 'Vanna White', 444222); 9 | -------------------------------------------------------------------------------- /chapter10/micrometer-account-service/src/main/resources/import.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 123456789, 0, 550.78, 'Debbie Hall', 12345); 2 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 111222333, 0, 2389.32, 'David Tennant', 112211); 3 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 444666, 0, 3499.12, 'Billie Piper', 332233); 4 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 87878787, 0, 890.54, 'Matt Smith', 444434); 5 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 990880221, 0, 1298.34, 'Alex Kingston', 778877); 6 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 987654321, 0, 781.82, 'Tom Baker', 908990); 7 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 5465, 0, 239.33, 'Alex Trebek', 776868); 8 | INSERT INTO account(id, accountNumber, accountStatus, balance, customerName, customerNumber) VALUES (nextval('hibernate_sequence'), 78790, 0, 439.01, 'Vanna White', 444222); 9 | -------------------------------------------------------------------------------- /chapter13/account-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | quarkus.container-image.group=quarkus-mp 2 | quarkus.container-image.name=account-service 3 | quarkus.kubernetes.name=account-service 4 | 5 | quarkus.datasource.db-kind=postgresql 6 | quarkus.datasource.username=quarkus_banking 7 | quarkus.datasource.password=quarkus_banking 8 | quarkus.datasource.jdbc.url=jdbc:postgresql://localhost/quarkus_banking 9 | %prod.quarkus.datasource.jdbc.url=jdbc:postgresql://postgres.default:5432/quarkus_banking 10 | 11 | quarkus.hibernate-orm.database.generation=drop-and-create 12 | quarkus.hibernate-orm.sql-load-script=import.sql 13 | 14 | # Health Probe configuration 15 | 16 | quarkus.kubernetes.liveness-probe.initial-delay=10 17 | quarkus.kubernetes.liveness-probe.period=2 18 | quarkus.kubernetes.liveness-probe.timeout=5 19 | 20 | quarkus.kubernetes.readiness-probe.initial-delay=10 21 | quarkus.kubernetes.readiness-probe.period=2 22 | quarkus.kubernetes.readiness-probe.timeout=5 23 | 24 | # Configure MicroProfile JWT 25 | 26 | mp.jwt.verify.publickey=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3zMl7s0H8VicXJeyXCnexwrvvlzVSuJgxBSqS/4WaRO9hR3zteceJJhnJhYxBk2G38chDxe8cOUyzjPm6u/V7pQkoj9oGqsqDBQKSCWaltxMbohuVIshi41QDWDUzBnPqd1Cm9+0BW0ZmRmQu3uKReR5+VKQ9CreIjwQf6I0G8o+/wnSUb1CBnqtdVb6+LyQvl+8jUyFfMViiA3AdkWW8bTGdiJUp3MSqquOdWkp30JFRYMU4UaQ4r3FOkC6ryXgdHoumxWO4WUnBu71bx60+kKL0EaSvCoVt+yCoTMY+xBY2E7Ic/m7WDZTCZgyFTu79P8zk/S9rpeCjE8NGutXJQIDAQAB 27 | mp.jwt.verify.issuer=http://keycloak.local/auth/realms/bank 28 | -------------------------------------------------------------------------------- /chapter13/bank-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # Configuration file 2 | # key = value 3 | 4 | # Bank names 5 | bank.name=Bank of Quarkus 6 | %dev.bank.name=Bank of Development 7 | %prod.bank.name=Bank of Production 8 | 9 | # Using @ConfigProperties 10 | bank-support.email=support@bankofquarkus.com 11 | bank-support.phone=555-555-5555 12 | 13 | # Using @ConfigMapping 14 | bank-support-mapping.email=support@bankofquarkus.com 15 | bank-support-mapping.phone=555-555-5555 16 | bank-support-mapping.business.email=business-support@bankofquarkus.com 17 | bank-support-mapping.business.phone=555-555-1234 18 | 19 | 20 | # Enable Kubernetes ConfigMap 21 | %prod.quarkus.kubernetes-config.enabled=true 22 | %prod.quarkus.kubernetes-config.config-maps=banking 23 | 24 | # Enable Kubernetes Secrets 25 | %prod.quarkus.kubernetes-config.secrets.enabled=true 26 | %prod.quarkus.kubernetes-config.secrets=db-credentials 27 | 28 | # Property expansion 29 | db.username=${username} 30 | db.password=${password} 31 | 32 | # Security 33 | 34 | quarkus.oidc.enabled=true 35 | quarkus.oidc.tls.verification=none 36 | quarkus.oidc.token.issuer=https://keycloak.local/auth/realms/bank 37 | %dev.quarkus.oidc.auth-server-url=https://keycloak.local/auth/realms/bank 38 | %test.quarkus.oidc.auth-server-url=${keycloak.url}/realms/quarkus 39 | %prod.quarkus.oidc.auth-server-url=https://keycloak:8443/auth/realms/bank 40 | quarkus.oidc.client-id=bank 41 | quarkus.oidc.application-type=web-app 42 | username=admin 43 | password=secret -------------------------------------------------------------------------------- /chapter9/spring-config-server/minikube.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: spring-config-server 7 | app.kubernetes.io/version: 0.0.1-SNAPSHOT 8 | name: spring-config-server 9 | spec: 10 | ports: 11 | - name: http 12 | nodePort: 30705 13 | port: 18888 14 | targetPort: 18888 15 | selector: 16 | app.kubernetes.io/name: spring-config-server 17 | app.kubernetes.io/version: 0.0.1-SNAPSHOT 18 | type: NodePort 19 | --- 20 | apiVersion: apps/v1 21 | kind: Deployment 22 | metadata: 23 | labels: 24 | app.kubernetes.io/name: spring-config-server 25 | app.kubernetes.io/version: 0.0.1-SNAPSHOT 26 | name: spring-config-server 27 | spec: 28 | replicas: 1 29 | selector: 30 | matchLabels: 31 | app.kubernetes.io/name: spring-config-server 32 | app.kubernetes.io/version: 0.0.1-SNAPSHOT 33 | template: 34 | metadata: 35 | labels: 36 | app.kubernetes.io/name: spring-config-server 37 | app.kubernetes.io/version: 0.0.1-SNAPSHOT 38 | spec: 39 | containers: 40 | - env: 41 | - name: KUBERNETES_NAMESPACE 42 | valueFrom: 43 | fieldRef: 44 | fieldPath: metadata.namespace 45 | image: quarkus-mp/spring-config-server:0.0.1-SNAPSHOT 46 | imagePullPolicy: IfNotPresent 47 | name: account-service 48 | ports: 49 | - containerPort: 18888 50 | name: http 51 | protocol: TCP 52 | -------------------------------------------------------------------------------- /chapter5/transaction-service/src/test/java/io/quarkus/transactions/WiremockAccountService.java: -------------------------------------------------------------------------------- 1 | package io.quarkus.transactions; 2 | 3 | import com.github.tomakehurst.wiremock.WireMockServer; 4 | import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; 5 | 6 | import java.util.Collections; 7 | import java.util.Map; 8 | 9 | import static com.github.tomakehurst.wiremock.client.WireMock.*; 10 | 11 | public class WiremockAccountService implements QuarkusTestResourceLifecycleManager { 12 | private WireMockServer wireMockServer; 13 | 14 | @Override 15 | public Map start() { 16 | wireMockServer = new WireMockServer(); 17 | wireMockServer.start(); 18 | 19 | stubFor(get(urlEqualTo("/accounts/121212/balance")) 20 | .willReturn(aResponse() 21 | .withHeader("Content-Type", "application/json") 22 | .withBody("435.76") 23 | )); 24 | 25 | stubFor(post(urlEqualTo("/accounts/121212/transaction")) 26 | .willReturn(aResponse() 27 | //noContent() needed to be changed once the external service returned a Map 28 | .withHeader("Content-Type", "application/json") 29 | .withStatus(200) 30 | .withBody("{}") 31 | )); 32 | 33 | return Collections.singletonMap("io.quarkus.transactions.AccountService/mp-rest/url", wireMockServer.baseUrl()); 34 | } 35 | 36 | @Override 37 | public void stop() { 38 | if (null != wireMockServer) { 39 | wireMockServer.stop(); 40 | } 41 | } 42 | } 43 | --------------------------------------------------------------------------------