1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 21:46:22 +01:00
Files
openshift-docs/modules/getting-started-cli-load-data-output.adoc

82 lines
2.3 KiB
Plaintext

// Module included in the following assemblies:
//
// * getting-started/openshift-cli.adoc
:_content-type: PROCEDURE
[id="getting-started-cli-load-data-output_{context}"]
= Loading data and displaying the national parks map
You deployed the `parksmap` and `nationalparks` applications and then deployed the `mongodb-nationalparks` database. However, no data has been loaded _into_ the database.
.Prerequisites
* You must have access to an {product-title} cluster.
* You must have installed the OpenShift CLI (`oc`).
* You have a deployed image.
.Procedure
. To load national parks data, enter the following command:
+
[source,terminal]
----
$ oc exec $(oc get pods -l component=nationalparks | tail -n 1 | awk '{print $1;}') -- curl -s http://localhost:8080/ws/data/load
----
+
.Example output
+
[source,text]
----
"Items inserted in database: 2893"
----
. To verify that your data is loaded properly, enter the following command:
+
[source,terminal]
----
$ oc exec $(oc get pods -l component=nationalparks | tail -n 1 | awk '{print $1;}') -- curl -s http://localhost:8080/ws/data/all
----
+
.Example output (trimmed)
+
[source,terminal]
----
, {"id": "Great Zimbabwe", "latitude": "-20.2674635", "longitude": "30.9337986", "name": "Great Zimbabwe"}]
----
. To add labels to the route, enter the following command:
+
[source,terminal]
----
$ oc label route nationalparks type=parksmap-backend
----
+
.Example output
+
[source,terminal]
----
route.route.openshift.io/nationalparks labeled
----
. To retrieve your routes to view your map, enter the following command:
+
[source,terminal]
----
$ oc get routes
----
+
.Example output
+
[source,terminal]
----
NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
nationalparks nationalparks-user-getting-started.apps.cluster.example.com nationalparks 8080-tcp edge None
parksmap parksmap-user-getting-started.apps.cluster.example.com parksmap 8080-tcp edge None
----
. Copy and paste the `HOST/PORT` path you retrieved above into your web browser. Your browser should display a map of the national parks across the world.
+
.National parks across the world
image::getting-started-map-national-parks.png[A map of the national parks across the world is displayed with location tracking.]