Skip to content

Instantly share code, notes, and snippets.

@blues-man
Last active February 4, 2022 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blues-man/2570c98ac24e18adf5fd3246b353e63c to your computer and use it in GitHub Desktop.
Save blues-man/2570c98ac24e18adf5fd3246b353e63c to your computer and use it in GitHub Desktop.
Script to deploy the whole Getting Started with OpenShift 4.10 for Developers workshop
# Project
oc new-project workshop
# Permissions for Service Account and Fabric8 Kubernetes client
oc policy add-role-to-user view -z default
# Parksmap
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 Python
oc new-app python~https://github.com/openshift-roadshow/nationalparks-py.git --name nationalparks -l 'app=workshop,component=nationalparks,role=backend,app.kubernetes.io/part-of=workshop,app.kubernetes.io/name=python' --allow-missing-images=true
oc create route edge nationalparks --service=nationalparks
# MongoDB
oc new-app quay.io/centos7/mongodb-36-centos7 --name mongodb-nationalparks -e MONGODB_USER=mongodb -e MONGODB_PASSWORD=mongodb -e MONGODB_DATABASE=mongodb -e MONGODB_ADMIN_PASSWORD=mongodb -l 'app.kubernetes.io/part-of=workshop,app.kubernetes.io/name=mongodb'
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
# Attach mongodb secret to nationalparks workload
oc set env --from=secret/nationalparks-mongodb-parameters deploy/nationalparks
# Wait for services to be up and running
oc rollout status deployment nationalparks
oc rollout status deployment mongodb-nationalparks
# Load National Parks
oc exec $(oc get pods -l component=nationalparks | tail -n 1 | awk '{print $1;}') -- curl -s http://localhost:8080/ws/data/load
# Verify data is loaded
oc exec $(oc get pods -l component=nationalparks | tail -n 1 | awk '{print $1;}') -- curl -s http://localhost:8080/ws/data/all | jq
# Label Route
oc label route nationalparks type=parksmap-backend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment