Skip to content
This repository has been archived by the owner on Nov 3, 2020. It is now read-only.

d2iq-shadowbq/springboot-helloworld-dispatch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring Boot Hello World Application for Dispatch

1 Spring Boot Hello-World application

This app is for demoing CI/CD in Jenkins

1.1 Dispatch Setup

1.1.1 Fork and clone the 2 repos

1.1.2 Add your GitHub and DockerHub user

Edit the Dispatchfile and replace the variable values at the top of the file with your user names for GitHub and DockerHub

Example:

// docker_user:: "<YOUR_DOCKERHUB_USERNAME>"
// github_user:: "<YOUR_GITHUB_USERNAME>"

docker_user:: "gregoryg"
github_user:: "gregoryg"

1.1.3 Create namespace used by the application

kubectl create namespace hello-world
kubectl label ns hello-world istio-injection=enabled
kubectl label ns hello-world ca.istio.io/override="true"

1.1.4 Install Dispatch on the cluster

# Do not install if `dispatch` namespace exists
kubectl get ns dispatch
if [ $? -eq 1 ]; then
    dispatch init --set global.prometheus.enabled=true --set global.prometheus.release=prometheus-kubeaddons --watch-namespace=dispatch
fi

1.1.5 Create credentials for Dispatch

kubectl -n dispatch get serviceaccount dispatch-sa
if [ $? -eq 1 ]; then
    dispatch serviceaccount create dispatch-sa --namespace dispatch
fi
kubectl -n dispatch get secret dispatch-sa-basic-auth
if [ $? -eq 1 ]; then
    dispatch login github --user ${GITHUB_USERNAME} --token ${GITHUB_TOKEN} --service-account dispatch-sa --namespace dispatch
fi
docker login
kubectl -n dispatch get secret dispatch-sa-docker-auth
if [ $? -eq 1 ]; then
    dispatch login docker --service-account dispatch-sa --namespace dispatch
fi
dispatch gitops creds add https://github.com/${GITHUB_USERNAME}/springboot-helloworld-dispatch --username=${GITHUB_USERNAME} --token=${GITHUB_TOKEN} --namespace dispatch

1.1.6 Create CI Repository

This step creates the webhook in the Developers GitHub repository This may also be done in the Dispatch UI!

dispatch ci repository create --service-account dispatch-sa --namespace dispatch

1.1.7 Create the App for CD

dispatch gitops app create springboot-helloworld-dispatch \
         --repository=https://github.com/${GITHUB_USERNAME}/springboot-helloworld-dispatch-gitops \
         --service-account dispatch-sa \
         --namespace dispatch

1.2 Demo changes

Edit index.html template

1.2.1 Bring up the application in a web browser

echo http://$(kubectl -n istio-system get svc istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[*].hostname}')/hello-world-dispatch

2 Notes

2.1 About this document

The script bin/install-springboot-cicd.sh can be generated from this document using M-x org-babel-tangle in Emacs, or running the following command on a system with Emacs installed

emacs --batch --eval "(require 'org)" --eval '(org-babel-tangle-file "README.org")'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 52.8%
  • Java 30.5%
  • Dockerfile 8.5%
  • HTML 8.2%