Skip to content

Commit cec960b

Browse files
committed
Fixup smallrye probe config
1 parent a3e8dc8 commit cec960b

File tree

5 files changed

+18
-134
lines changed

5 files changed

+18
-134
lines changed
103 KB
Loading
261 KB
Loading
190 KB
Loading

documentation/modules/ROOT/pages/app-config.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ be parameterized to get input for fields like service names and generate values
6565
====
6666

6767
In the {OPENSHIFT_CONSOLE_URL}[OpenShift Web Console^, role='params-link'], `*click on the 'Home' menu, and choose 'Software Catalog'*`
68-
and then select `*Databases*` within the catalog.
68+
and then select `*Databases*` within the catalog. We will deploy 2 databases from this list.
69+
70+
NOTE: Depending on how the web console is configured, the *Software Catalog* may instead be found as a sub-menu of the *Ecosystem* menu item
6971

7072
image::openshift-add-database.png[OpenShift - Add database, 800]
7173

documentation/modules/ROOT/pages/app-health.adoc

Lines changed: 15 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,12 @@ Now, `*switch back to your {CHE_URL}[Workspace^, role='params-link'] and check t
143143

144144
image::che-inventory-traffic-ko.png[Che - Catalog Traffic KO, 500]
145145

146-
**Why do some requests failed? Because as soon as the container is created, the traffic is sent to this new instance even if the application is not ready.**
146+
**Why do some requests fail?**
147+
Because as soon as the container is created, the traffic is sent to this new instance even if the application is not ready.
147148
(The _Inventory Service_ takes a few seconds to start up).
148149

150+
TIP: This is a race condition based on that startup speed, sometimes this script wont fail, if that is the case scale the pods back to 1 instance and try again.
151+
149152
In order to prevent this behaviour, a **Readiness check** is needed. It determines if the container is ready to service requests.
150153
If the readiness probe fails, the endpoints controller ensures the container has its IP address removed from the endpoints of all services.
151154
A readiness probe can be used to signal to the endpoints controller that even though a container is running, it should not receive any traffic from a proxy.
@@ -160,7 +163,7 @@ Now lets go fix some of these problems.
160163
== Configuring Liveness Probes
161164

162165
https://quarkus.io/guides/health-guide[SmallRye Health^] is a Quarkus extension which utilizes the MicroProfile Health specification.
163-
It allows applications to provide information about their state to external viewers which is typically useful
166+
It allows applications to provide information about their state to external viewers via an API call which is typically useful
164167
in cloud environments where automated processes must be able to determine whether the application should be discarded or restarted.
165168

166169
Let's add the needed dependencies to **/projects/workshop/labs/inventory-quarkus/pom.xml**.
@@ -239,104 +242,19 @@ You should have the following output:
239242
}
240243
----
241244

242-
In the {OPENSHIFT_CONSOLE_URL}[OpenShift Web Console^, role='params-link'], under the Workloads menu,
243-
`*click on 'Topology' -> '(D) inventory-coolstore' -> 'Add Health Checks'*`.
244-
245-
image::openshift-inventory-add-health-check.png[Che - Inventory Add Health Check, 700]
246-
247-
Then `*click on 'Add Liveness Probe'*`
248-
249-
image::openshift-inventory-add-liveness-probe.png[Che - Inventory Add Liveness Probe, 500]
250-
251-
`*Enter the following information:*`
252-
253-
.Liveness Probe
254-
[%header,cols=2*]
255-
|===
256-
|Parameter
257-
|Value
258-
259-
|Type
260-
|HTTP GET
261-
262-
|Use HTTPS
263-
|_Unchecked_
264-
265-
|HTTP Headers
266-
|_Empty_
267-
268-
|Path
269-
|/q/health/live
270-
271-
|Port
272-
|8080
273-
274-
|Failure Threshold
275-
|3
276-
277-
|Success Threshold
278-
|1
279-
280-
|Initial Delay
281-
|10
282-
283-
|Period
284-
|10
285-
286-
|Timeout
287-
|1
288-
289-
|===
290-
291-
Finally `*click on the check icon*`. But don't click *Add* yet, we have more probes to configure.
292-
293-
[#configuring_readiness]
294-
== Configuring Inventory Readiness Probes
295-
296-
Now repeat the same task for the *Inventory* service, but this time set the *Readiness* probes:
297-
298-
.Readiness Probe
299-
[%header,cols=2*]
300-
|===
301-
|Parameter
302-
|Value
303-
304-
|Type
305-
|HTTP GET
306-
307-
|Use HTTPS
308-
|_Unchecked_
309-
310-
|HTTP Headers
311-
|_Empty_
312-
313-
|Path
314-
|/q/health/ready
315-
316-
|Port
317-
|8080
318-
319-
|Failure Threshold
320-
|3
321-
322-
|Success Threshold
323-
|1
324-
325-
|Initial Delay
326-
|0
245+
Liveness, Readiness and Startup health checks values have already been set for this service as part of the build and deploying
246+
using the *quarkus-smallrye-health* plugin.
327247

328-
|Period
329-
|5
248+
You can check this in the {OPENSHIFT_CONSOLE_URL}[OpenShift Web Console^, role='params-link'], under the Workloads menu,
249+
`*click on 'Topology' -> '(D) inventory-coolstore' -> 'Actions' -> 'Edit Health Checks'*`.
330250

331-
|Timeout
332-
|1
251+
image::openshift-inventory-edit-health.png[Che - Inventory Add Health Check, 700]
333252

334-
|===
253+
You can now click *Edit Probe* for each probe type in turn to see the configuration, here for example are the liveness settings:
335254

336-
Finally `*click on the check icon and the 'Add' button*`. OpenShift automates deployments using *deployment triggers*
337-
that react to changes to the container image or configuration.
338-
Therefore, as soon as you define the probe, OpenShift automatically redeploys the pod using the new configuration including the liveness probe.
255+
image::openshift-inventory-view-health.png[Che - Inventory View Health Check, 700]
339256

257+
For each probe type the configuration and the API can be different since the delay, retry and responsiveness differs for each circumstance.
340258

341259
[#testing_Readiness]
342260
== Testing Inventory Readiness Probes
@@ -402,45 +320,9 @@ the fast response to stuck states.
402320

403321
Now you understand and know how to configure Readiness, Liveness and Startup probes, let's confirm your expertise!
404322

405-
`*Configure the remaining Probes for Inventory and Catalog*` using the following information:
323+
`*Configure the remaining Probes for Catalog*` using the following information:
406324

407325
.Startup Probes
408-
[%header,cols=2*]
409-
|===
410-
|Inventory Service
411-
|Startup
412-
413-
|Type
414-
|HTTP GET
415-
416-
|Use HTTPS
417-
|_Unchecked_
418-
419-
|HTTP Headers
420-
|_Empty_
421-
422-
|Path
423-
|/q/health/live
424-
425-
|Port
426-
|8080
427-
428-
|Failure Threshold
429-
|3
430-
431-
|Success Threshold
432-
|1
433-
434-
|Initial Delay
435-
|0
436-
437-
|Period
438-
|5
439-
440-
|Timeout
441-
|1
442-
443-
|===
444326

445327
[%header,cols=2*]
446328
|===
@@ -479,7 +361,7 @@ Now you understand and know how to configure Readiness, Liveness and Startup pro
479361

480362
|===
481363

482-
Finally, let's configure probes for Gateway and Web Service.
364+
Finally, let's configure probes for Gateway and Web Service. For speed we will do this via script.
483365
In your {CHE_URL}[Workspace^, role='params-link'], `*click on 'Terminal' -> 'Run Task...' -> 'devfile: Probes - Configure Gateway & Web'*`
484366

485367
image::che-runtask.png[Che - RunTask, 600]

0 commit comments

Comments
 (0)