Last active
March 21, 2024 18:40
-
-
Save mandibuswell/0cdb03f388c079a3ac1ac8e5a0e9e26a to your computer and use it in GitHub Desktop.
ARO Workshop Application
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
#This GIST is for use with the https://microsoft.github.io/aroworkshop/, it provides all the OC commands within the exercise in easy to use copy/paste automation. | |
#Before running this gist ensure you have forked the following | |
#https://github.com/MicrosoftDocs/mslearn-aks-workshop-ratings-api/fork | |
#https://github.com/MicrosoftDocs/mslearn-aks-workshop-ratings-web/fork | |
#update mslearn-aks-workshop-ratings-web for with these two files | |
#https://raw.githubusercontent.com/sajitsasi/rating-web/master/Dockerfile | |
#https://raw.githubusercontent.com/sajitsasi/rating-web/master/src/components/Footer.vue | |
githubname=mandibuswell | |
project=workshop | |
echo 'Step One Create Project' | |
oc new-project $project | |
oc new-app bitnami/mongodb \ | |
-e MONGODB_USERNAME=ratingsuser \ | |
-e MONGODB_PASSWORD=ratingspassword \ | |
-e MONGODB_DATABASE=ratingsdb \ | |
-e MONGODB_ROOT_USER=root \ | |
-e MONGODB_ROOT_PASSWORD=ratingspassword | |
echo 'Get Service' | |
oc get svc mongodb | |
echo '****** 2.4 Deploy Rating Application *******' | |
oc new-app https://github.com/$githubname/mslearn-aks-workshop-ratings-api --strategy=source --name=rating-api | |
echo 'configure required variables' | |
oc set env deploy/rating-api MONGODB_URI=mongodb://ratingsuser:ratingspassword@mongodb.workshop.svc.cluster.local:27017/ratingsdb | |
echo 'wait until RATING-API pods are running then continue' | |
oc get pods --watch | |
echo 'get rating service' | |
oc get svc rating-api | |
oc patch service/rating-api --patch '{"spec": {"ports": [{"name": "8080-tcp","protocol": "TCP", "port": 8080, "targetPort": 3000}]}}' | |
oc get svc rating-api | |
echo 'get webhook secret' | |
oc get bc/rating-api -o=jsonpath='{.spec.triggers..github.secret}' | |
echo 'Replace the <secret> placeholder with the secret you retrieved in the previous step to have a URL similar and add to your github repo to complete the triggers exercise' | |
oc describe bc/rating-api | |
echo '******* 2.5 Deploy Ratings frontend ********' | |
oc new-app https://github.com/$githubname/mslearn-aks-workshop-ratings-web --strategy=docker --name=rating-web | |
echo 'wait until pods are running then continue' | |
oc get pods --watch | |
oc set env deploy rating-web API=http://rating-api:8080 | |
oc expose svc/rating-web | |
oc get route | |
oc get bc/rating-web -o=jsonpath='{.spec.triggers..github.secret}' | |
echo 'Replace the <secret> placeholder with the secret you retrieved in the previous step to have a URL similar and add to your github repo to complete the triggers exercise' | |
oc describe bc/rating-web | |
echo '***** 2.6 Create Network Policy *******' | |
oc apply -f https://raw.githubusercontent.com/mandibuswell/mslearn-aks-workshop-ratings-web/master/networkpolicy.yaml | |
ON A BRANCH | |
githubname=mandibuswell | |
project=tankrank | |
echo 'Step One Create Project' | |
oc new-project $project | |
oc new-app bitnami/mongodb \ | |
-e MONGODB_USERNAME=ratingsuser \ | |
-e MONGODB_PASSWORD=ratingspassword \ | |
-e MONGODB_DATABASE=ratingsdb \ | |
-e MONGODB_ROOT_USER=root \ | |
-e MONGODB_ROOT_PASSWORD=ratingspassword | |
echo 'Get Service' | |
oc get svc mongodb | |
oc project $project | |
oc new-app https://github.com/$githubname/mslearn-aks-workshop-ratings-api#tankrank --strategy=source --name=tank-rating-api | |
echo 'configure required variables' | |
oc set env deploy/tank-rating-api MONGODB_URI=mongodb://ratingsuser:ratingspassword@mongodb.$project.svc.cluster.local:27017/ratingsdb | |
echo 'wait until RATING-API pods are running then continue' | |
oc get pods --watch | |
oc patch service/tank-rating-api --patch '{"spec": {"ports": [{"name": "8080-tcp","protocol": "TCP", "port": 8080, "targetPort": 3000}]}}' | |
oc new-app https://github.com/$githubname/mslearn-aks-workshop-ratings-web#tankrank --strategy=docker --name=tank-rating-web | |
echo 'wait until pods are running then continue' | |
oc get pods --watch | |
oc set env deploy tank-rating-web API=http://tank-rating-api:8080 | |
oc expose svc/tank-rating-web | |
oc apply -f https://raw.githubusercontent.com/mandibuswell/mslearn-aks-workshop-ratings-web/tankrank/networkpolicy.yaml | |
oc patch route/tank-rating-web --patch '{"spec": {"tls": {"termination": "edge","insecureEdgeTerminationPolicy": "Allow"}}}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment