Using java spring-boot reactive webflux r2dbc docker compose docker swarm and k8s kubernetes
IN PROGRESS
Configured Travis CI pipelinesInitialized draft and implement of VuePress documentationImplemented step1 with sets of spring boot 2.2.o.RELEASE reactive applicationsImplemented step2 with replacing in-memory map DBs -> r2dbc-postgres spring-data integration (run pg in docker)Implemented step3 and Dockerize all applications using fabric8.io maven pluginImplemented step4 and Dockerize multi-module application using fabric8.io maven plugin (all in one)Implemented step5 with docker-compose maven pluginImplemented step6 and Dockerize all applications using jib maven plugin from GoogleImplemented step7 with docker-swarm- Implemented step8 with k8s and skaffold
- Implemented step9 with k8s and helm-chart
- Implemented stepX with project riff
Simple sets of applications implementation for local run
./mvnw -DskipTests
java -jar step1-speakers-rest-api-service/target/*.jar
java -jar step1-sessions-rsocket-service/target/*.jar
java -jar step1-frontend/target/*.jar
#http :8082/speakers name=max
#http :8082/speakers name=bax
#http :8082/speakers
http :8080
Simple sets of r2dbc applications with postgres (in docker)
#./mvnw -pl :step2-docker docker:start
docker stop pg || true ; docker run --rm --name pg -p 5432:5432 postgres:alpine
./mvnw
java -jar step2-speakers-rest-api-service/target/*.jar
java -jar step2-sessions-rsocket-service/target/*.jar
java -jar step2-frontend/target/*.jar
#http :8084/sessions name=maximum speakers=max
#http :8084/sessions
#http :8085/speakers name=max
#http :8085/speakers
http :8083
#./mvnw -pl :step2-docker docker:stop
docker rm -f -v pg
An applications in docker using fabric8.io maven plugin
./mvnw -pl :step3-postgres-fabric8 docker:build docker:start
./mvnw -pl :step3-sessions-rsocket-service-fabric8,:step3-speakers-rest-api-service-fabric8,:step3-frontend-fabric8 clean package docker:build docker:start
#http :8087/sessions name=maximum speakers=max
#http :8088/speakers name=max
http :8086
./mvnw -pl :step3-speakers-rest-api-service-fabric8,:step3-sessions-rsocket-service-fabric8,:step3-frontend-fabric8 docker:stop docker:remove
./mvnw -f step3-postgres-fabric8/ docker:stop docker:remove
Dockerized multi-module application using fabric8.io maven plugin (all in one)
./mvnw -f step4-all-in-one-fabric8 clean package -DskipTests
./mvnw -f step4-all-in-one-fabric8 -pl :step4-all-in-one-fabric8 docker:build docker:start
#http :8090/sessions name=maximum speakers=max
#http :8091/speakers name=max
http :8089
./mvnw -f step4-all-in-one-fabric8 -pl :step4-all-in-one-fabric8 docker:stop docker:remove
Dockerized multi-module application using docker-compose maven plugin (all in one)
./mvnw -f step5-all-in-one-docker-compose -pl :step5-all-in-one-docker-compose docker:build docker:start
./mvnw -f step5-all-in-one-docker-compose
./mvnw -f step5-all-in-one-docker-compose -pl :step5-all-in-one-docker-compose docker:stop docker:remove
#./mvnw -pl :step5-all-in-one-docker-compose docker-compose:up
#http :8093/sessions name=maximum speakers=max
#http :8094/speakers name=max
http :8092
./mvnw -pl :step5-all-in-one-docker-compose docker-compose:down
Dockerized multi-module application using jib maven plugin from Google and docker-compose maven plugin (all in one)
./mvnw -pl :step6-all-in-one-google-jib -P pg-start
./mvnw -f step6-all-in-one-google-jib compile jib:dockerBuild
./mvnw -pl :step6-all-in-one-google-jib -P pg-stop
./mvnw -pl :step6-all-in-one-google-jib -P compose-create
./mvnw -pl :step6-all-in-one-google-jib -P compose-up
#http :8096/sessions name=maximum speakers=max
#http :8097/speakers name=max
http :8095
./mvnw -pl :step6-all-in-one-google-jib -P compose-down
Dockerized multi-module application using docker-swarm (all in one)
prepare docker-swarm
docker swarm init
docker service create --name registry --publish published=5000,target=5000 registry:2
run test postgres container for success tests during build
./mvnw -pl :step7-all-in-one-docker-swarm -P pg-start
./mvnw -f step7-all-in-one-docker-swarm compile jib:build
./mvnw -pl :step7-all-in-one-docker-swarm -P pg-stop
test with docker-compose
./mvnw -pl :step7-all-in-one-docker-swarm -P compose-create
./mvnw -pl :step7-all-in-one-docker-swarm -P compose-up
#http :8099/sessions name=maximum speakers=max
#http :8100/speakers name=max
http :8098
./mvnw -pl :step7-all-in-one-docker-swarm -P compose-down
docker stack deploy
docker stack deploy -c step7-all-in-one-docker-swarm/docker-compose.yml step7
#http :8100/speakers name=max | jq '.'
#http :8099/sessions name=maximum speakers=max | jq '.'
http :8098
docker stack rm step7
docker service rm registry
docker swarm leave -f
./mvnw build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false
#docker rm -f -v `docker ps -aq`
for i in $(docker ps -aq) ; do docker rm -f -v $i ; done
#docker rmi -f `docker images -q --filter=dangling=true`
for i in $(docker images -q --filter=dangling=true) ; do docker rmi -f $i ; done
#docker rmi -f `docker images -q -f=reference='*/*step*'`
for i in $(docker images -q -f=reference='*/*step*') ; do docker rmi -f $i ; done
Documentation is located here
For further reference, please consider the following sections:
- GitHub: daggerok/k8s-nginx-ingress-example
- YouTube: Kubernetes Master Class: Kubernetes from Zero to Hero
- YouTube: k3s -- The Lightweight Kubernetes Distribution Built for the Edge
- Official Apache Maven documentation
- Spring Boot Maven Plugin Reference Guide
- Spring Configuration Processor
- Thymeleaf
- Handling Form Submission
- Error handling
- ServerWebExchange injection
- R2DBC db initialization
- Maven + Docker by using fabric.io
- Maven + Docker by using GoogleContainerTools/jib maven plugin
- Postgres on Docker Hub
- Docker cleanup: docker images -f "dangling=true"
- docker-compose-maven-plugin
- Spring Boot Google JIB
- Google JIB FAQ
- jib-maven-plugin
- YouTube: Speedy build for your java application images with JIB! by Mohammed Aboullaite
- No fat jars with jib
- Docker Swarm getting started guide
- Docker Swarm -> k8s
- YouTujbe: Deploying and scaling applications with Docker, Swarm, and a tiny bit of Python magic - PyCon 2016
- YouTube: Deploy and scale containers with Docker native, open source orchestration PyCon 2017
- Container Training
- k8s workshop