Last active
February 2, 2022 16:12
-
-
Save blues-man/5143b0a50a9497fec542d07f9385a232 to your computer and use it in GitHub Desktop.
Script to deploy the whole Getting Started with OpenShift 4.8 for Developers workshop
This file contains 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 characters
#!/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/ | |
# Pipeline | |
# Install Pipelines | |
oc create -f https://raw.githubusercontent.com/openshift-labs/learn-katacoda/master/middleware/pipelines/assets/operator/subscription.yaml | |
until oc api-resources --api-group=tekton.dev | grep tekton.dev &> /dev/null | |
do | |
echo "Operator installation in progress..." | |
sleep 5 | |
done | |
echo "Operator ready" | |
oc create -f https://raw.githubusercontent.com/openshift-roadshow/nationalparks/master/pipeline/nationalparks-pipeline-new.yaml | |
oc create -f https://raw.githubusercontent.com/openshift-roadshow/nationalparks/master/pipeline/nationalparks-pipelinerun.yaml | |
# Tekton Triggers | |
oc create -f https://raw.githubusercontent.com/openshift-roadshow/nationalparks/master/pipeline/nationalparks-triggers.yaml | |
# MLBParks | |
oc create -f https://raw.githubusercontent.com/openshift-roadshow/mlbparks/master/ose3/application-template-eap.json | |
oc new-app mlbparks -p APPLICATION_NAME=mlbparks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment