Install the Robot Shop Application
3.1: Introduction
In this lab, you will learn how to install the demo application, Robot Shop.
Robot Shop is pre-configured with changes needed to enable Instana monitoring. Some technologies such as java don't require any configuration, but others require configuration changes so the application can be monitored.
During the install, you will also specify the required information that is necessary for Instana to monitor the End User Experience (EUM) / Real User Monitoring (RUM) data.
If you are unsure how to get access to the Bastion host (Guacamole) see Accessing a Lab Environment
From the Bastion host open the Firefox browser and select the Instana bookmark.
You can safely ignore the warning about the certificate being untrusted.
When prompted, enter the username and password that you updated earlier.
- Username: admin@instana.local
- Password: Passw0rd
3.2: Create the Website in Instana
If you want to capture EUM/RUM data within Instana, you must first create a website within the GUI (or via API). Open the Instana GUI within your browser.
On left side navigation, select Websites & Mobile Apps. You'll see a dialog
where you can enter a Website Name. Enter Robot Shop
as the website name.
Then, click the Add Website button.
A dialog containing javascript will open. In a more typical application, you would follow the instructions on the dialog. You copy/paste the javascript into the HTML pages.
Robot Shop has already done some of the work for you by embedding this script with variable placeholders for the unique values into the application. When you deploy the application, you can pass parameters into the helm install to populate the unique variables. There are two parameters within the javascript that we will need to copy and use when we do the install. You will need the key and the reportingURL. Either copy those parameters now or leave this dialog open so that you can retrieve it later.
3.3: Install Robot Shop
We will install Robot Shop on the Apps Single Node OpenShift cluster.
The full installation instructions for Robot Shop can be found here. You'll notice that there are instructions for installing Robot Shop into a number of different environments including docker, kubernetes, and OpenShift. This lab uses an OpenShift environment, so we'll be following those steps.
We have documented the steps below, so there is no need to refer to the GitHub instructions.
The following should be run from the terminal on the bastion host (admin@bastion-gym-lan).
From the Bastion host (Guacamole), open a terminal window by selecting Activities at the top left of the screen and then the terminal icon.
Check to make sure you are in the right place by running the following:
cd ~ && oc cluster-info --kubeconfig kubeconfig-apps
You should see the following output, specifically the url
https:api.sno.techzone.lan:6443
. If you don't try opening a new tab or
terminal window and trying again.
cd ~ && git clone https://github.com/instana/robot-shop.git
Change directory into the robot-shop/K8s directory
cd robot-shop/K8s
Ensure namespace robot-shop
is created:
cat <<EOF | oc apply --server-side --kubeconfig ~/kubeconfig-apps -f -
apiVersion: v1
kind: Namespace
metadata:
name: robot-shop
EOF
Next, setup privileges within the cluster for the Robot Shop application by issuing the following two commands:
oc adm policy add-scc-to-user anyuid -z default -n robot-shop --kubeconfig ~/kubeconfig-apps
oc adm policy add-scc-to-user privileged -z default -n robot-shop --kubeconfig ~/kubeconfig-apps
Install the Robot Shop using Helm:
- Set your reporting URL by making the substitution below and running the command.
- your-instana-reporting-url is the reportingURL you obtained in section
3.2.
Example:https://instana.techzone.lan/eum/
.
export REPORTING_URL="your-instana-reporting-url"
- Set your key value by making the substitution below and running the command.
your-instana-key is the key you obtained in section 3.2 from the Instana
user interface.
Example: _9ouL2yERFuYz49FAPIhQQ
.
export EUM_KEY="your-instana-key"
Deploy the Robot Shop application with the following Helm command:
helm install robot-shop \
--set openshift=true \
--set eum.key=${EUM_KEY} \
--set eum.url=${REPORTING_URL} \
-n robot-shop helm \
--kubeconfig ~/kubeconfig-apps
If successful, you should see the results similar to what's shown below.
Check the status of the Robot Shop deployment by watching the pods:
Type Ctrl-C
to exit the watch loop.
oc get pods -n robot-shop -w --kubeconfig ~/kubeconfig-apps
If the install was successful, you'll see the following pods running.
If some of the pods (for example ratings or shipping) show 0/1 instead of 1/1 in the READY column or the pods aren't yet in a Running state you may need to wait a little longer. It can take as much as 15 minutes before all of the pods are running. If you don't want to wait, you can exit the watch and proceed to the next steps.
Finally, if you want to bring up the Robot Shop user interface, you need to expose the service as a route. Issue the following command:
oc expose service web -n robot-shop --kubeconfig ~/kubeconfig-apps
The route to the application has already been saved to a bookmark called Robot Shop. Alternatively you can issue the oc get route command to get the route to the application
oc get route -n robot-shop --kubeconfig ~/kubeconfig-apps
The result should look similar to: web-robot-shop.CLUSTER_DOMAIN
. In our case
it is web-robot-shop.apps.sno.techzone.lan
Wait for all pods to be in a running state before you continue.
Open a new Firefox tab and select the Robot Shop bookmark to navigate to the Robot Shop application.
If using the route you printed earlier make sure you pay attention to the 'Port' field, for this application you will be using http instead of https.
Workaround Required for Robot Shop in OpenShift Deployments
You can now navigate and use the Robot Shop application, however if you navigate to Websites & Mobile Apps > Robot Shop you will not see the EUM data in Instana.
There are two reasons for this:
- The EUM reporting URL we used was https://instana.techzone.lan/eum/ and becuase we are using Self Signed Certificates in this lab the browser will not allow the EUM data to be sent to Instana without first providing approval.
- There is a bug in Robot Shop when deployed on OpenShift that causes the trailing slash of the reporting URL to be stripped on install. Without the slash the EUM data will not be correctly proxied and therefore no End User Monitoring details will be shown in Instana.
To fix this first issue, from Firefox select the bookmark EUM TLS and accept the certificate.
If you have done this correctly you should now see the eum.min.js file.
You can now close the tab.
To fix the second issue, we need to manually add the trailing slash back into the eum.html file.
If you want to understand the issue here you can open the Firefox dev tools with F12 and navigate to the Network tab. As you click around the app you will notice the failing EUM beacons. Once we adjust the eum.html with the correct URL you will see these same EUM beacons succeeding and sending data in Instana.
Run the following command to update the URL:
kubectl exec -n robot-shop $(kubectl get pod -l service=web -n robot-shop -o jsonpath={..metadata.name} --kubeconfig ~/kubeconfig-apps) -- sed -i 's|https://instana.techzone.lan/eum|https://instana.techzone.lan/eum/|g' /usr/share/nginx/html/eum.html
Now click around the Robot Shop app to generate beacons. Navigate to Websites & Mobile Apps > Robot Shop and you should now see EUM data in Instana. If you don't see it yet, adjust the time range to Last minute and select Live.
3.4: Setup Automated Load
Now that the application is running and EUM data in displaying, we can generate some artifical traffic against the Robot-Shop application.
Issue the following command to install the load generation pod.
cat <<EOF | oc create --kubeconfig ~/kubeconfig-apps -f -
apiVersion: apps/v1
kind: Deployment
metadata:
name: rs-website-load
namespace: robot-shop
labels:
service: rs-website-load
spec:
replicas: 1
selector:
matchLabels:
service: rs-website-load
template:
metadata:
labels:
service: rs-website-load
spec:
containers:
- name: rs-website-load
env:
- name: HOST
value: "http://web:8080/"
image: brightzheng100/rs-website-load:latest
EOF
Run the oc get pods command.
oc get pods -n robot-shop --kubeconfig ~/kubeconfig-apps
You should now see an additional pod named rs-website-load-* running within the project.
Navigate to Websites & Mobile Apps and select the the Robot Shop application you just created. After a few minutes you should begin to see traffic in the Robot Shop dashboard.
You can change the filter at the top right of the page to Live and Last minute to see the traffic in real time.
3.5: Summary
In this section, you learned how to install an application that includes monitoring and configure it for Website EUM/RUM monitoring.
Now you can proceed to the next section of the lab where you will configure the monitoring for IBM MQ and IBM App Connect Enterprise (ACE).