Skip to content

Commit

Permalink
Changes to the steps for part 3 and updated scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-kenzan committed Apr 7, 2017
1 parent b186a76 commit 4fab2b6
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 25 deletions.
18 changes: 0 additions & 18 deletions scripts/monitor.sh

This file was deleted.

14 changes: 10 additions & 4 deletions scripts/pages.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
docker build -t 127.0.0.1:30400/kr8sswordz:latest -f old/part2/pages/Dockerfile old/part2/pages
#!/bin/bash

#Retrieve the latest git commit hash
TAG = `git rev-parse --short HEAD`

#Build the docker image
docker build -t 127.0.0.1:30400/kr8sswordz:$TAG -f old/part2/pages/Dockerfile old/part2/pages

#Setup the proxy for the registry
docker stop socat-registry; docker rm socat-registry; docker run -d -e "REGIP=`minikube ip`" --name socat-registry -p 30400:5000 chadmoon/socat:latest bash -c "socat TCP4-LISTEN:5000,fork,reuseaddr TCP4:`minikube ip`:30400"

#Push the images
docker push 127.0.0.1:30400/kr8sswordz:latest
docker push 127.0.0.1:30400/kr8sswordz:$TAG

#Stop the registry proxy
docker stop socat-registry

# Create the deployment and service foddr the crossword server aka services
kubectl apply -f old/part2/pages/k8s/deployment.yaml; kubectl rollout status deployment/kr8sswordz
# Create the deployment and service for the front end aka kr8sswordz
sed 's#127.0.0.1:30400/kr8sswordz:latest#127.0.0.1:30400/kr8sswordz:'$TAG'#' old/part2/pages/k8s/deployment.yaml | kubectl apply -f -
19 changes: 19 additions & 0 deletions scripts/server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

#Retrieve the latest git commit hash
TAG = `git rev-parse --short HEAD`

#Build the docker image
docker build -t 127.0.0.1:30400/services:$TAG -f applications/crossword/Dockerfile applications/crossword

#Setup the proxy for the registry
docker stop socat-registry; docker rm socat-registry; docker run -d -e "REGIP=`minikube ip`" --name socat-registry -p 30400:5000 chadmoon/socat:latest bash -c "socat TCP4-LISTEN:5000,fork,reuseaddr TCP4:`minikube ip`:30400"

#Push the images
docker push 127.0.0.1:30400/services:$TAG

#Stop the registry proxy
docker stop socat-registry

# Create the deployment and service for the crossword server aka services
sed 's#127.0.0.1:30400/services:latest#127.0.0.1:30400/services:'$TAG'#' applications/crossword/k8s/deployment.yaml | kubectl apply -f -
49 changes: 46 additions & 3 deletions steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,57 @@ parts:
- cap: Check job status
com: kubectl describe jobs/etcd-job

- cap: Now we're going to walk through an initial build of the monitoring and scaling service for our crosswords application.
- cap: Now we're going to walk through an initial build of the monitoring and scaling service for our crosswords application.
com: docker build -t 127.0.0.1:30400/monitor-scale:latest -f applications/monitor/Dockerfile applications/monitor

- cap: Bootstrap the crossword services and monitoring applications, creating a docker image and storing it in the local registry
com: scripts/monitor.sh
- cap: Setup the proxy in order to push the monitoring docker image to our cluster's registry
com: docker stop socat-registry; docker rm socat-registry; docker run -d -e "REGIP=`minikube ip`" --name socat-registry -p 30400:5000 chadmoon/socat:latest bash -c "socat TCP4-LISTEN:5000,fork,reuseaddr TCP4:`minikube ip`:30400"

- cap: Push the image
com: docker push 127.0.0.1:30400/monitor-scale:latest

- cap: Stop the registry proxy
com: docker stop socat-registry

- cap: Verify that the image is in our local registry using the registry-ui
com: minikube service registry-ui

- cap: Create the deployment and service for the monitoring and scaling server and wait for it to be deployed
com: kubectl apply -f applications/monitor/k8s/monitor-scale.yaml; kubectl rollout status deployment/monitor-scale

- cap: See the montior-scale-* pod running using kubectl.
com: kubectl get pods

- cap: See the montior-scale-* service is setup using kubectl.
com: kubectl get services

- cap: See the montior-scale-* ingress is configured using kubectl.
com: kubectl get ingress

- cap: See the monitor-scale deployment is setup using kubectl
com: kubectl get deployments

- cap: Delete the monitor-scale pod and watch as k8s brings it back up. Note that everything wrapped in tick marks is used to parse the unique name of the pod from the get pods display.
com: kubectl delete pod `kubectl get pods --selector=app=monitor-scale --output=jsonpath={.items[1]..metadata.name}`

- cap: If you act quickly you might see one pod terminating while a new uniquely identified pod is created.
com: kubectl get pods

- cap: Run this command to make sure the re-deployment of the pod is complete
com: kubectl rollout status deployment/monitor-scale

- cap: Bootstrap the crossword/mongodb services, creating a docker image and storing it in the local registry
com: scripts/server.sh

- cap: Check to see if services has been deployed
com: kubectl rollout status deployment/services

- cap: Bootstrap the frontend web application
com: scripts/pages.sh

- cap: Check to see if the front end has been deployed
com: kubectl rollout status deployment/kr8sswordz

- cap: See all the pods running using kubectl.
com: kubectl get pods

Expand Down

0 comments on commit 4fab2b6

Please sign in to comment.