Skip to content

Instantly share code, notes, and snippets.

@blues-man
Last active September 19, 2023 14:12
Show Gist options
  • Save blues-man/ad685dc7bedbf311110290ecceac9fbd to your computer and use it in GitHub Desktop.
Save blues-man/ad685dc7bedbf311110290ecceac9fbd to your computer and use it in GitHub Desktop.
Script to deploy the whole Getting Started with OpenShift 4.6 for Developers workshop
#!/bin/bash
# Project
oc new-project workshop
# Parksmap
oc new-app quay.io/openshiftroadshow/parksmap:1.3.0 --name=parksmap -l 'app=workshop,component=parksmap,role=frontend,app.kubernetes.io/part-of=workshop'
oc create route edge parksmap --service=parksmap
oc policy add-role-to-user view -z default
oc rollout restart deploy/parksmap
# Nationalparks
oc new-app java~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'
oc expose svc nationalparks
# MongoDB
oc create -f https://raw.githubusercontent.com/openshift-labs/starter-guides/ocp-4.6/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
# Add secret to workload
oc set env --from=secret/nationalparks-mongodb-parameters deploy/nationalparks
# /ws/data/load
# Wait for Nationalparks and MongoDB
oc rollout status deployment nationalparks
# 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
oc create -f https://raw.githubusercontent.com/openshift-roadshow/nationalparks/master/pipeline/nationalparks-pipeline-all-vfs-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-all.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