Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

jwnmulder/java-meetup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo for Server Side Software Developers South NL meetup 'Back-end programming: making your applications cloud ready'

Meetup event: https://www.meetup.com/Server-Side-Software-Developers-South-NL/events/264919153/

Pre-requisuites

  • Docker for Desktop with Kubernetes enabled
  • WSL (When running on Windows)

Before continuing, test that connectivity to Kubernetes is working

# docker-for-desktop test
kubectl --context=docker-for-desktop cluster-info

# all Jenkins demo deployments will be done to the default docker cluster. To check the default settings:
kubectl config current-context

Jenkins setup

Before starting docker-compose, make sure you have created the following files

  • docker hub credentials for pushing images
    • .secrets/docker-hub-username
    • .secrets/docker-hub-password
  • github credentials for discoverying repositories
    • .secrets/github-username
    • .secrets/github-password
  • .env file
    SMEE_CHANNEL=<channel id>
    HOME=<only needed on Windows, set to C:\Users\username>

The following files will be automatically created on first start, these are:

  • ./secrets/kubectl-encoded-config (a copy of ~/.kube/config)
  • ./secrets/ssh-github-java-meetup-key (generated ssh keypair)
  • ./secrets/ssh-github-java-meetup-key.pub (generated ssh keypair, used for cloning repositories)

Start jenkins using docker-compose

docker-compose --compatibility up -V --build

After Jenkins is up and running you can go ahead and visit these URL's

Kubernetes setup (Docker for Desktop)

Provision kubernetes with some default demo deployments. After running the script the following is done

  • kubernetes-dashboard installed
  • k8dash installed (another kubernetes dashboard)
  • namespace 'java-meetup' created
# This installs some kubernetes tools using 'kubectl --context=docker-for-desktop'
./setup.sh

If something doesn't work in Docker for Desktop, try the following

# Check for any errors in the docker log
tail -f /c/Users/<username>/AppData/Local/Docker/log.txt

# If Kubernetes fails to start, remove all docker-for-desktop certificates.
# These are automatically re-generated after a first restart
rm -rf /c/ProgramData/DockerDesktop/pki

References

Demo

Prepare:

  • kubectl delete ns java-meetup && kubectl create ns java-meetup

Demo 1 - Maven build using Jenkins & Docker

Demo 2 - Docker build and push

Demo 3 - Kubernetes deployment

Demo 4 - Testing on Kubernetes - multi branch pipeline

  • vscode: Jenkinsfile
  • http://kubernetes.docker.internal:31523 (check ./setup.sh for actual URL)
  • test multibranch pipeline webhook
    git checkout master
    git branch -d feature/1 feature/2 feature/3
    git push origin --delete feature/1 feature/2 feature/3
    git checkout -b feature/1
    git checkout -b feature/2
    git checkout -b feature/3
    git checkout master
    git push --all origin
    kubectl get events -n java-meetup --watch

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Groovy 46.3%
  • Shell 31.1%
  • Dockerfile 22.6%