Created
February 8, 2022 18:40
-
-
Save blues-man/de5c9b957cc3e7b9942603a0196d2feb to your computer and use it in GitHub Desktop.
Revisions
-
blues-man created this gist
Feb 8, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ #!/bin/bash # Project oc new-project workshop # Parksmap oc policy add-role-to-user view -z default oc new-app quay.io/openshiftroadshow/parksmap:latest --name=parksmap -l 'app=workshop,component=parksmap,role=frontend,app.kubernetes.io/part-of=workshop' oc create route edge parksmap --service=parksmap # Nationalparks oc new-app java:openjdk-11-ubi8~https://github.com/openshift-roadshow/nationalparks.git --name nationalparks -l 'app=workshop,component=nationalparks,role=backend,app.kubernetes.io/part-of=workshop,app.kubernetes.io/name=java' --allow-missing-images=true oc expose svc nationalparks # MongoDB oc create -f https://raw.githubusercontent.com/openshift-labs/starter-guides/ocp-4.8/mongodb-template.yaml -n workshop oc new-app --template=mongodb-ephemeral -p DATABASE_SERVICE_NAME=mongodb-nationalparks -p MONGODB_USER=mongodb -p MONGODB_PASSWORD=mongodb -p MONGODB_DATABASE=mongodb -p MONGODB_ADMIN_PASSWORD=mongodb -l 'app.kubernetes.io/part-of=workshop' oc label dc/mongodb-nationalparks svc/mongodb-nationalparks app=workshop component=nationalparks role=database --overwrite oc create secret generic nationalparks-mongodb-parameters --from-literal=DATABASE_SERVICE_NAME=mongodb-nationalparks --from-literal=MONGODB_USER=mongodb --from-literal=MONGODB_PASSWORD=mongodb --from-literal=MONGODB_DATABASE=mongodb --from-literal=MONGODB_ADMIN_PASSWORD=mongodb oc rollout status deployment nationalparks oc rollout status deploymentconfig mongodb-nationalparks # Add secret to workload oc set env --from=secret/nationalparks-mongodb-parameters deploy/nationalparks # /ws/data/load # Wait for Nationalparks and MongoDB # Load Data oc exec $(oc get pods -l component=nationalparks | tail -n 1 | awk '{print $1;}') -- curl -s http://localhost:8080/ws/data/load # Verify oc exec $(oc get pods -l component=nationalparks | tail -n 1 | awk '{print $1;}') -- curl -s http://localhost:8080/ws/data/all # Label Route oc label route nationalparks type=parksmap-backend # Health checks oc set probe deploy/nationalparks --readiness --liveness --get-url=http://:8080/ws/healthz/