Skip to content

Instantly share code, notes, and snippets.

@blues-man
Last active September 16, 2021 14:27
Show Gist options
  • Save blues-man/7c6fe950dd939b3482aa60d3b3cd1a9a to your computer and use it in GitHub Desktop.
Save blues-man/7c6fe950dd939b3482aa60d3b3cd1a9a to your computer and use it in GitHub Desktop.
Script to deploy the whole Getting Started with OpenShift 4.7 for Developers workshop
#!/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'
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
# Wait for Nationalparks and 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
# Load Data
sleep 5
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.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