Skip to content

Commit e481736

Browse files
author
mcouliba
committed
Updated the all labs
1 parent 3fa2413 commit e481736

20 files changed

+178
-165
lines changed

abtesting.adoc

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
== A/B Testing with Service Mesh
22

3-
*10 MINUTES PRACTICE*
3+
_10 MINUTE EXERCISE_
44

5-
https://en.wikipedia.org/wiki/A/B_testing[A/B testing^] allows running multiple versions of a functionality in parallel; and using analytics of the user behavior it is possible to determine which version is the best.
6-
It is also possible to launch the new features only for a small set of users, to prepare the general avalability of a new feature.
7-
8-
In this lab you will see how you can use Site Mesh to do some A/B testing using and route traffic between 2 versions of the Catalog service.
9-
10-
=== Deploying the new Catalog service
5+
In this lab you will see how you can use *OpenShift Service Mesh* to do some A/B testing using and route traffic between 2 versions of the Catalog service.
116

12-
A new *_Catalog Service v2_* has been created, this service is developed in https://golang.org/[Golang^] and available in the following repository:
7+
[sidebar]
8+
.A/B Testing
9+
--
10+
https://en.wikipedia.org/wiki/A/B_testing[A/B testing^] allows running multiple versions of a functionality in parallel and using analytics of the user behavior it is possible to determine which version is the best.
11+
It is also possible to launch the new features only for a small set of users, to prepare the general avalability of a new feature.
12+
--
1313

14-
<{{CATALOG_GO_GIT_REPO}}>
14+
=== Deploying the new Catalog Service
1515

16-
This service use the same business logic except that all product descriptions are returned in uppercase.
16+
A new *_Catalog Service v2_* has been implemented in https://golang.org/[Golang^] which uses the same business logic than *_Catalog Service v1_*
17+
except that all product descriptions are returned in **UPPERCASE**.
1718

1819
Let's deploy the service directly from the git repository using the `*oc new-app*` command.
1920

2021
In the terminal window type the following command:
21-
2222
----
2323
$ oc new-app {{LABS_GIT_REPO}} \
2424
--strategy=docker \
@@ -29,7 +29,7 @@ $ oc new-app {{LABS_GIT_REPO}} \
2929

3030
TIP: To simplify the lab, we use the same labels for *_catalog_* and *_catalog-v2_* since they are used for the service routing.
3131

32-
Service Mesh will be used to route the traffic between the catalog service v1 and v2, so you have to add the Istio sidecar to the *_Catalog Service v2_* using the following command:
32+
**OpenShift Service Mesh** will be used to route the traffic between the catalog service v1 and v2, so you have to add the Istio sidecar to the *_Catalog Service v2_* using the following command:
3333

3434
----
3535
$ oc patch dc/catalog-v2 --patch \
@@ -50,11 +50,10 @@ Wait few seconds that the application restarts.
5050

5151
=== Enabling A/B Testing
5252

53-
https://en.wikipedia.org/wiki/[A/B_testing^] allows to run in parallel two versions of an application with one single variant (usually visual) and to collect metrics in order to determine the variant with the best effect of the user behavior.
54-
55-
The implementation of such procedure is one are the advantages coming with OpenShift Service Mesh.
53+
The implementation of such procedure like **A/B Testing** is one are the advantages coming with OpenShift Service Mesh.
54+
For this lab, you want to answer the following question:
5655

57-
For this lab, you want to answer the following question: **Do the product descriptions written in uppercase increase sales rate?**
56+
**Do the product descriptions written in uppercase increase sales rate?**
5857

5958
Let's now create the *_Destination Rule_* resource.
6059

@@ -131,10 +130,10 @@ TIP: You can also go to the Web interface and refresh the page to see that produ
131130

132131
Go to Kiali to see the traffic distribution between Catalog v1 and v2.
133132

134-
From the {{ KIALI_URL }}[Kiali Console^], `*click on the 'Graph' link*` in the left navigation and enter the following configuration:
133+
From the {{ KIALI_URL }}[Kiali Console^], `*click on the 'Graph' link*` in the left navigation and enter the following configuration in the drop down menus:
135134

136135
* Namespace: **{{COOLSTORE_PROJECT}}**
137-
* Display: **check 'Traffic Animation'**
136+
* Display: **'Traffic Animation'** check
138137
* Edge Label: **Requests percent of total**
139138
* Fetching: **Last 5 min**
140139

catalog-deployment.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
== Deploying the Catalog Service
22

3-
_10 MINUTES PRACTICE_
3+
_10 MINUTE EXERCISE_
44

55
In this lab you will learn about building and deploying a microservice based on Java/Maven on OpenShift.
66
The **Catalog Service** is part of the Cool Store architecture to provide a list of products for the CoolStore online shop.

catalog-spring-boot-codeready.adoc

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
== Microservices with Spring Boot
22

3-
_45 MINUTES PRACTICE_
3+
_45 MINUTE EXERCISE_
44

55
In this lab you will learn about Spring Boot and how you can build microservices
66
using Spring Boot and JBoss technologies. During this lab, you will create a REST API for
@@ -37,7 +37,7 @@ This is a minimal Spring Boot project with support for RESTful services and Spri
3737
to a database. This project currently contains no code other than the main class, ***CatalogApplication***
3838
which is there to bootstrap the Spring Boot application.
3939

40-
Examine ***com/redhat/cloudnative/catalog/CatalogApplication.java*** in the **src/main** directory:
40+
`*Examine 'com.redhat.cloudnative.catalog.CatalogApplication' class*` in the **/projects/labs/catalog-spring-boot/src/main** directory:
4141

4242
[source,java]
4343
.CatalogApplication.java
@@ -57,7 +57,7 @@ public class CatalogApplication {
5757
----
5858

5959
The database is configured using the Spring application configuration file which is located at
60-
**src/main/resources/application.properties**. Examine this file to see the database connection details
60+
**/projects/labs/catalog-spring-boot/src/main/resources/application.properties**. Examine this file to see the database connection details
6161
and note that an in-memory H2 database is used in this lab for local development and will be replaced
6262
with a PostgreSQL database in the following labs. Be patient! More on that later.
6363

@@ -74,9 +74,9 @@ image:{% image_path codeready-commands-build.png %}[Maven Build,600]
7474
Once successfully built, the resulting ***jar*** is located in the **target/** directory:
7575

7676
----
77-
$ ls labs/catalog-spring-boot/target/*.jar
77+
$ ls /projects/labs/catalog-spring-boot/target/*.jar
7878
79-
labs/catalog-spring-boot/target/catalog-1.0-SNAPSHOT.jar
79+
/projects/labs/catalog-spring-boot/target/catalog-1.0-SNAPSHOT.jar
8080
----
8181

8282
This is an uber-jar with all the dependencies required packaged in the ***jar*** to enable running the
@@ -255,9 +255,9 @@ $ curl http://localhost:9000/api/catalog
255255
[{"itemId":"329299","name":"Red Fedora","desc":"Official Red Hat Fedora","price":34.99},...]
256256
----
257257

258-
You can also use the preview url that CodeReady Workspaces has generated for you to be able to test service
259-
directly in the browser. Append the path **/api/catalog** at the end of the preview url and try
260-
it in your browser in a new tab.
258+
You can also use the preview url that CodeReady Workspaces has generated for you to be able to test the service
259+
that is now running in the workspace directly in the browser.
260+
Append the path **/api/catalog** at the end of the preview url and try it in your browser in a new tab.
261261

262262
image:{% image_path springboot-che-preview-browser.png %}[Preview URL,900]
263263

@@ -278,10 +278,9 @@ S2I uses the https://access.redhat.com/documentation/en-us/red_hat_jboss_middlew
278278
of the **Catalog Service** by uploading the Spring Boot uber-jar from the **target/**
279279
folder to the OpenShift platform.
280280

281-
Maven projects can use the https://maven.fabric8.io[Fabric8 Maven Plugin^] in order to use OpenShift S2I for building
282-
the container image of the application from within the project. This maven plugin is a Kubernetes/OpenShift client
283-
able to communicate with the OpenShift platform using the REST endpoints in order to issue the commands
284-
allowing to build a project, deploy it and finally launch a docker process as a pod.
281+
Maven projects can use the https://maven.fabric8.io[Fabric8 Maven Plugin^] to access the OpenShift S2I for building the application container image.
282+
This maven plugin is a Kubernetes/OpenShift client and uses the REST API to communicate with OpenShift and issue commands to build,
283+
deploy and launch the application as a pod.
285284

286285
To build and deploy the **Catalog Service** on OpenShift using the *fabric8* maven plugin,
287286
which is already configured in CodeReady Workspaces, `*right click on catalog-spring-boot*` project in the project explorer then, `*click on Commands > Deploy > fabric8:deploy*`

continuous-delivery.adoc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
== Automating Deployments Using Pipelines
22

3-
*20 MINUTES PRACTICE*
3+
_20 MINUTE EXERCISE_
44

55
In this lab you will learn about deployment pipelines and you will create a pipeline to
66
automate build and deployment of the Inventory service.
77

8-
==== Continuous Delivery
8+
[sidebar]
9+
.Continuous Delivery
10+
--
911
So far you have been building and deploying each service manually to OpenShift. Although
1012
it's convenient for local development, it's an error-prone way of delivering software if
1113
extended to test and production environments.
@@ -18,13 +20,12 @@ to go through in order to reach upper environments and eventually to production.
1820
OpenShift simplifies building CI/CD Pipelines by integrating
1921
the popular https://jenkins.io/doc/book/pipeline/overview/[Jenkins Pipelines^] into
2022
the platform and enables defining truly complex workflows directly from within OpenShift.
21-
22-
The first step for any deployment pipeline is to store all code and configurations in
23-
a source code repository.
23+
--
2424

2525
==== Create a Git Repository for Inventory
2626

27-
You can use any Git server (e.g. GitHub, BitBucket, etc) for this lab but we have prepared a
27+
The first step for any deployment pipeline is to store all code and configurations in
28+
a source code repository. You can use any Git server (e.g. GitHub, BitBucket, etc) for this lab but we have prepared a
2829
Gogs git server which you can access here:
2930

3031
{{ GIT_URL }}[{{ GIT_URL }}^]

debug-codeready.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Debugging Applications
22

3-
*20 MINUTES PRACTICE*
3+
*20 MINUTE EXERCISE*
44

55
In this lab you will debug the CoolStore application using Java remote debugging and
66
look into line-by-line code execution as the code runs inside a container on OpenShift.

env-info.adoc

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1-
## Appendix: Environment Info
1+
== Appendix: Environment Info
22

33
You find all urls, hostnames, usernames and passwords that are needed during the
44
labs in this page. Note that the urls are also embedded inside each lab instructions.
55

6-
**OPENSHIFT**
7-
6+
OPENSHIFT::
87
{{ OPENSHIFT_CONSOLE_URL }}
98

10-
**GIT SERVER**
11-
9+
GIT SERVER::
1210
{{ GIT_URL }}
1311

14-
**NEXUS MAVEN REPOSITORY**
15-
12+
NEXUS MAVEN REPOSITORY::
1613
{{ NEXUS_URL }}
1714

18-
**ECLIPSE CHE IDE**
19-
20-
Register an account on Eclipse Che using an email address.
15+
CODEREADY WORKSPACES::
16+
{{ CODEREADY_WORKSPACES_URL }}
2117

22-
{{ ECLIPSE_CHE_URL }}
18+
KIALI::
19+
{{ KIALI_URL }}
2320

24-
**OPENSHIFT DOCS**
21+
JAEGER::
22+
{{ JAEGER_URL }}
2523

24+
OPENSHIFT DOCS::
2625
{{ OPENSHIFT_DOCS_BASE }}

fault-tolerance-codeready.adoc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Service Resilience and Fault Tolerance
22

3-
*30 MINUTES PRACTICE*
3+
_30 MINUTE EXERCISE_
44

55
In this lab you will learn about how you can build service resilience and fault tolerance into
66
the applications both at the infrastructure level using OpenShift capabilities as well as
@@ -266,6 +266,9 @@ user load and recovers from failures. However failures also happen in the downst
266266
is dependent on. It's not uncommon that the whole application fails or slows down because one of the downstream
267267
services consumed by the application is not responsive or responds slowly.
268268

269+
[sidebar]
270+
.Circuit Breaker
271+
--
269272
https://martinfowler.com/bliki/CircuitBreaker.html[Circuit Breaker^] is a pattern to address this issue and while
270273
it became popular with microservice architecture, it's a useful pattern for all applications that depend on other
271274
services.
@@ -282,6 +285,7 @@ image:{% image_path fault-circuit-breaker.png %}[Circuit Breaker,300]
282285
Spring Boot and Thorntail provide convenient integration with https://github.com/Netflix/Hystrix[Hystrix^]
283286
which is a framework that provides circuit breaker functionality. Eclipse Vert.x, in addition to integration
284287
with Hystrix, provides built-in support for circuit breakers.
288+
--
285289

286290
Let's take the Inventory service down and see what happens to the CoolStore online shop.
287291

@@ -303,7 +307,7 @@ The CoolStore online shop cannot function without the products list, however the
303307
crucial bit in the shopping experience. Let's add a circuit breaker for calls to the Inventory service and
304308
provide a default inventory status when the Inventory service is not responsive.
305309

306-
In the `*gateway-vertx*` project, open `*src/main/java/com/redhat/cloudnative/gateway/GatewayVerticle.java*` and
310+
In the `*gateway-vertx*` project, `*open /projects/labs/gateway-vertx/src/main/java/com/redhat/cloudnative/gateway/GatewayVerticle.java*` and
307311
replace its code it with the following code:
308312

309313
[source,java]
@@ -458,8 +462,8 @@ image:{% image_path eclipse-che-commands-build.png %}[Maven Build,340]
458462
Although you can use the **DEPLOY > fabric8:deploy** from the commands palette, you
459463
can also trigger a new container image build on OpenShift using
460464
the `*oc start-build*` command which allows you to build container images directly from the application
461-
archives (`jar`, `*war`, etc) without the need to have access to the source code for example by downloading
462-
the `*jar*` file form the Maven repository (e.g. Nexus or Artifactory).
465+
archives (`jar`, `war`, etc) without the need to have access to the source code for example by downloading
466+
the `jar` file form the Maven repository (e.g. Nexus or Artifactory).
463467

464468
----
465469
$ oc start-build gateway-s2i --from-file=labs/gateway-vertx/target/gateway-1.0-SNAPSHOT.jar

gateway-deployment.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
== Deploying the API Gateway
22

3-
_10 MINUTES PRACTICE_
3+
_10 MINUTE EXERCISE_
44

55
As explained in the introduction at the core of the Cool Store Portal architecture there is a Gateway component.
66

gateway-vertx-codeready.adoc

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
== Reactive Microservices with Eclipse Vert.x
22

3-
_45 MINUTES PRACTICE_
3+
_45 MINUTE EXERCISE_
44

55
In this lab you will learn about Eclipse Vert.x and how you can
66
build microservices using reactive principles. During this lab you will
@@ -48,7 +48,7 @@ image:{% image_path vertx-event-loop.png %}[Vert.x Event Loop,600]
4848

4949
Although you can have multiple, there is currently only one Verticle created in the *_gateway-vertx_* project.
5050

51-
`*Examine 'GatewayVerticle' class*` in the *_com.redhat.cloudnative.gateway_* package in the **src** directory.
51+
`*Examine 'GatewayVerticle' class*` in the **com.redhat.cloudnative.gateway** package in the **/projects/labs/gateway-vertx/src** directory.
5252

5353
[source,java]
5454
.GatewayVerticle.java
@@ -89,9 +89,9 @@ image:{% image_path codeready-commands-build.png %}[Maven Build,600]
8989
Once successfully built, the resulting *_jar_* is located in the **target/** directory:
9090

9191
----
92-
$ ls labs/gateway-vertx/target/*.jar
92+
$ ls /projects/labs/gateway-vertx/target/*.jar
9393
94-
labs/gateway-vertx/target/gateway-1.0-SNAPSHOT.jar
94+
/projects/labs/gateway-vertx/target/gateway-1.0-SNAPSHOT.jar
9595
----
9696

9797
This is an uber-jar with all the dependencies required packaged in the *jar* to enable running the
@@ -107,7 +107,7 @@ architecture.
107107

108108
image:{% image_path coolstore-arch.png %}[API Gateway Pattern,400]
109109

110-
Replace the content of *_src/main/java/com/redhat/cloudnative/gateway/GatewayVerticle.java_* class with the following:
110+
`*Replace the content of '/projects/labs/gateway-vertx/src/main/java/com.redhat.cloudnative.gateway/GatewayVerticle.java'*` class with the following:
111111

112112
[source,java]
113113
.GatewayVerticle.java
@@ -260,10 +260,9 @@ S2I uses the https://access.redhat.com/documentation/en-us/red_hat_jboss_middlew
260260
image of the API Gateway service by uploading the Vert.x uber-jar from
261261
the **target** folder to the OpenShift platform.
262262

263-
Maven projects can use the https://maven.fabric8.io[Fabric8 Maven Plugin^] in order to use OpenShift S2I for building
264-
the container image of the application from within the project. This maven plugin is a Kubernetes/OpenShift client
265-
able to communicate with the OpenShift platform using the REST endpoints in order to issue the commands
266-
allowing to build a project, deploy it and finally launch a docker process as a pod.
263+
Maven projects can use the https://maven.fabric8.io[Fabric8 Maven Plugin^] to access the OpenShift S2I for building the application container image.
264+
This maven plugin is a Kubernetes/OpenShift client and uses the REST API to communicate with OpenShift and issue commands to build,
265+
deploy and launch the application as a pod.
267266

268267
To build and deploy the **Gateway Service** on OpenShift using the *fabric8* maven plugin,
269268
which is already configured in CodeReady Workspaces, `*right click on 'gateway-vertx'*` project in the project explorer then, `*click on 'Commands > Deploy > fabric8:deploy'*`

getting-started-codeready.adoc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
== Getting Started with OpenShift
22

3-
_5 MINUTES PRACTICE_
3+
_5 MINUTE EXERCISE_
44

55
In this lab you will learn about providing your Developer Workspace with a Kubernetes-native development platform
66
and getting familiar with the OpenShift CLI and OpenShift Web Console.
@@ -38,10 +38,14 @@ Finally, `*enter your account information*` and `*click on 'Submit'*`
3838
image:{% image_path codeready-account-information.png %}[CodeReady Workspaces - Log in,300]
3939

4040
=== Creating a Workspace
41-
Once logged into CodeReady Workspaces, you can now create your workspace based on a stack.
41+
Once logged into CodeReady Workspaces, you can now create your workspace based on the **Cloud-Native Stack**.
42+
43+
[TIP]
44+
====
4245
A **Stack** is a template for workspace configuration.
4346
It includes the programming language and tools needed in your workspace to create applications.
4447
Stacks make it possible to deploy identical workspaces for all users on demand.
48+
====
4549

4650
`*Select the stack called 'Cloud-Native'*` and then `*click on 'CREATE & OPEN'*`.
4751

0 commit comments

Comments
 (0)