Christina Lin (https://github.com/weimeilin79/sko2018) wrote the original version of this great demo so all credit to her.
I've updated the code to Fuse 7.6 plus done some clean-up and the updated code can be found at (https://github.com/gnunn1/seating).
This demo uses Fuse and Kafka to manage seating reservations and allocations. The flow of the services is shown in the diagram below going from left to right.
The intent of the demo is to highlight Agile Integration as used in a loosely coupled event driven architecture.
This demo uses kustomize to manage cluster specific settings. Kustomize is a patching framework that is included with kubectl/oc so there is no need to download a different tool.
To modify the settings for your cluster, clone one of the clusters in the cluster/overlays
folder and then update the patch files as needed for your environment. The most significant thing that needs updating are the route references the UI components have to their back-end services.
-
Install the Red Hat Jaeger operator
-
Have a 3scale admin portal installed or available. If you are a Red Hat employee you can request access to the 3scale hosted environment which is what I use for the majority of my demos.
-
This demo uses kustomize to install the components, you will need to create an overlay for settings that are specific to your cluster.
-
Copy
cluster/overlays/ocplab
into a new folder for your cluster, i.e.cluster/overlays/mycluster
-
Update the routes to match the routes in your cluster
-
For 3scale you need to provide a secret for apicast to connect to the 3scale admin portal. I use Bitnami's Sealed Secrets to enable me to check into git securely however you can create a secret manually or replace it with a standard secret in your overlay (NOTE: Do not check this secret into github directly!). To create the secret manually use the following and replace
<access-token>
and<admin_portal_domain>
for your specific 3scale instance.oc create secret generic apicast-configuration-url-secret --from-literal=password=https://<access_token>@<admin_portal_domain> --type=kubernetes.io/basic-auth
-
-
Login as a user with cluster-admin rights since this will install operators as needed.
-
Ensure the fuse7-java-openshift image is installed for Fuse 7.6, check the tags in use:
oc get is -n openshift | grep fuse-java-openshift
If there is no 1.6 tag (i.e. only 1.5 or earlier shows), import the Fuse 7.6 imagestream:
oc apply -f https://raw.githubusercontent.com/jboss-fuse/application-templates/2.1.x.sb2.redhat-7-6-x/is-image-streams.json -n openshift
-
Install AMQ Streams Operator first
oc apply -k app/amq-streams-operator/overlays/default
This will create a
seating
project, wait for the operator to be ready. -
Install the kafka cluster, you can either install a full 3 replica cluster using:
oc apply -k app/kafka/overlays/default
Or a minimal 1 replica instance using:
oc apply -k app/kafka/overlays/minimal
Wait for all of the zookeeper and broker instances to be ready
-
Install the seats application:
oc apply -k cluster/overlays/<your cluster>/app/seats
In a smallish cluster wait for all the builds to be completed and deployed before moving onto the next app. In a larger cluster you can deploy everything in parallel.
-
Install the registration application:
oc apply -k cluster/overlays/<your cluster>/app/registration
-
Install the Dashboard. All of the individual UIs are available, the dashboard deploys a simple iFrame application so that everything can be viewed in one window.
oc apply -k app/dashboard/overlays/default
-
Optionally deploy 3scale gateways. Note I use a sealed secret in my ocplab cluster which you will see in the overlay, you will need to replace this your own secret in order for the gateways to connect to the 3scale admin portal. See the 3scale docs.
kustomize build cluster/overlays/<your cluster>/app/apicast | oc apply -f -
I've opted to configure the endpoints in 3scale using the API as a Product feature as per the diagram below, however you can configure it however you like just make sure to update the
ROUTE_HOSTNAME
environment variables to match your configuration.
-
Install the monitoring operators, wait for the grafana and prometheus monitors to be ready
oc apply -k monitoring/operators/overlays/default
-
Install AMQ Streams specific security requirements for their dashboards:
oc apply -k monitoring/security/base
-
Generate secret for fuse console:
cd scripts/generate-fuse-console-cert ./generate.sh
-
Install the monitoring package
oc apply -k cluster/overlays/<your cluster>/monitoring
-
Add non-admin user to projects (user1 in ocplab example)
oc apply -k cluster/overlays/<your cluster>/security
- A swagger file is available in the scripts/swagger directory that can be used to configure a seats as an API Product with two backends.
- Open the Dashboard in the seating project, this will give you three UI elements: a map of seats available, a form that can be filled out to register a seat and a feed of seat registrations
-
Fill out the form to register a seat, the icon for the seat should change to black if it was successful.
-
Open Jaeger monitoring in the
seating-monitoring
project and look at the registration-ui service to see a trace of the services that were traversed to process the rgistration
-
Now show a traditional integration using CSV files. Change directory to
scripts/loader
and look at the reservations.csv file which contains three rows. Run the upload.sh script which will copy the file to the reservation-loader pod for processing. You should see three seats be reserved. -
Check Jaeger and look at the trace for registration-loader to see how the file was processed
-
Log into the fuse-console in
seat-monitoring
and connect to the registration-loader. Notice how it receives one message, the file, and then splits it into three message to process each row individually. -
Scale up the seat-simulator to 1, this service will randomly reserve seats to generate traffic. While it is running use the grafana dashboards to monitor Kafka and Fuse.
- Visit the 3scale analytics dashboard to see the traffic being sent to the two http services (integration and status)
I would like to make some improvements to this demo, PRs gratefully accepted:
-
Enhance the messages with additional information, specifically include customer information in the seat allocation message and persist it to the database. Enhance the UI to show the info as a toolip when hovering or clicking on a seat.
-
Add the schema registry to the demo
-
Handle customers reserving the same seat with a manual intervention queue