You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: reactive-jhipster/demo.adoc
+18-17Lines changed: 18 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,15 +5,13 @@
5
5
6
6
== Reactive Java Microservices with JHipster Demo Steps
7
7
8
-
Today, I'd like to show you how to use the JHipster 7 to create a reactive Java microservices architecture.
8
+
Today, I'd like to show you how to use the JHipster 7 to create a reactive Java microservices architecture with Spring Boot, Spring Cloud, Spring Cloud Gateway, and Spring WebFlux.
9
9
10
10
**Prerequisites:**
11
11
12
-
* https://adoptopenjdk.net/[Java 11]+
13
-
* https://nodejs.org/[Node 14]+
14
-
* https://docs.docker.com/get-docker/[Docker]
15
-
16
-
TIP: The brackets at the end of some steps indicate the IntelliJ Live Templates to use. You can find the template definitions at https://github.com/mraible/idea-live-templates[mraible/idea-live-templates].
12
+
- https://adoptopenjdk.net/[Java 11]+
13
+
- https://nodejs.org/[Node 14]+
14
+
- https://docs.docker.com/get-docker/[Docker]
17
15
18
16
toc::[]
19
17
@@ -28,8 +26,6 @@ In this demo, I'll show you how to generate a microservice architecture that use
28
26
npm i -g generator-jhipster@beta
29
27
----
30
28
31
-
=== Design a Micronaut Data Model with JHipster's JDL
32
-
33
29
. Create a directory called `reactive-stack` and initialize `git`.
34
30
+
35
31
[source,shell]
@@ -195,7 +191,7 @@ docker-compose -f src/main/docker/mongodb.yml up -d #jhmongoup
195
191
+
196
192
NOTE: JHipster has support for https://www.cypress.io/[Cypress], but it https://github.com/jhipster/generator-jhipster/issues/12686[doesn't work with Okta] yet.
197
193
198
-
== Prepare Your Reactive Java Stack for Production
194
+
=== Prepare Your Reactive Java Stack for Production
199
195
200
196
Keycloak is a superb open source identity provider. It has excellent support for OAuth 2.0 and OpenID Connect (OIDC) and easily runs in a Docker container. I greatly appreciate Keycloak's ease-of-use. I also ❤️ Spring Security's OAuth and OIDC support.
201
197
@@ -214,14 +210,19 @@ spring:
214
210
215
211
. Install the https://cli.okta.com[Okta CLI] and run `okta register`.
216
212
217
-
. In the gateway project's directory, run `okta apps create jhipster`. Accept the default redirect URIs.
213
+
. In the gateway project's directory, run the command below. Accept the default redirect URIs.
214
+
+
215
+
[source,shell]
216
+
----
217
+
okta apps create jhipster
218
+
----
218
219
219
-
=== Update the JHipster Registry to Distribute OIDC Configuration
220
+
==== Update the JHipster Registry to Distribute OIDC Configuration
220
221
221
222
Spring Cloud Config allows you to distribute Spring's configuration between apps. In this section, you'll configure JHipster's Spring Security settings to use Okta across all your services.
222
223
223
224
. Add the following YAML to `gateway/src/main/docker/central-server-config/localhost-config/application.yml`. You can find the values for each property in the `.okta.env` file.
224
-
225
+
+
225
226
[source,yaml]
226
227
----
227
228
spring:
@@ -247,7 +248,7 @@ jhregistryup
247
248
248
249
. Use kbd:[Ctrl + C] to kill all your `./gradlew` processes and start them again.
249
250
250
-
. Open a new incognito browser window, go to `http://localhost:8080`, and sign in. Rejoice that using Okta for authentication works!
251
+
. Open an incognito window, go to `http://localhost:8080`, and sign in. Rejoice that using Okta for authentication works!
251
252
252
253
. If you're feeling lucky, you can set your Okta credentials as environment variables and run end-to-end tests (from the `gateway` directory).
== Create Docker Images for Your Microservice Apps
262
+
=== Create Docker Images for Your Microservice Apps
262
263
263
264
. Stop all your apps with kbd:[Ctrl + C]. Stop all your Docker instances too.
264
265
+
@@ -276,7 +277,7 @@ TIP: Bump up the memory and CPU that Docker uses in Docker > Preferences > Resou
276
277
./gradlew -Pprod bootJar jibDockerBuild
277
278
----
278
279
279
-
== Run Your Microservices Stack with Docker Compose
280
+
=== Run Your Microservices Stack with Docker Compose
280
281
281
282
Once your Docker containers are finished building, you'll want to add your Okta settings to Spring Cloud Config in JHipster Registry.
282
283
@@ -329,7 +330,7 @@ JHipster creates a cloud-native microservices architecture that can be deployed
329
330
330
331
However, if you're doing microservices, you'll probably want to leverage Docker as you did in this tutorial. When your apps are containerized, they can be orchestrated with Kubernetes.
331
332
332
-
JHipster has a https://www.jhipster.tech/kubernetes/[Kubernetes] sub-generator that you can use to deploy it to the cloud. I'll cover this in a future tutorial.
333
+
JHipster has a https://www.jhipster.tech/kubernetes/[Kubernetes] sub-generator that you can use to deploy it to the cloud. I'll cover this in a future demo.
333
334
334
335
In the meantime, you can watch a presentation that https://twitter.com/saturnism[Ray Tsang] and I did recently that shows how to deploy JHipster microservices with Kubernetes. If you start watching from https://youtu.be/AG4z18qePEw?t=2778[46:18], you'll see Ray show how to deploy to Google Cloud using Kubernetes.
335
336
@@ -347,7 +348,7 @@ Are you dealing with massive amounts of steaming data and millions of customers?
347
348
348
349
What about https://wiki.openjdk.java.net/display/loom/Main[Project Loom]? Will it allow you to write regular non-reactive code that performs as good as reactive frameworks? I'm not sure. I'm betting on reactive for now. I think it's a good skill to have for Java developers.
349
350
350
-
== Stay hip with JHipster!
351
+
== Stay Hip with JHipster!
351
352
352
353
⛑ Find the code on GitHub: https://github.com/oktadeveloper/java-microservices-examples/tree/main/reactive-jhipster[@oktadeveloper/java-microservices-examples/reactive-jhipster].
0 commit comments