================
This project is a sample data manager. It provides a basic template for Java/Spring developers. This project also includes form validation of controller model objects and request parameters. Users can view, add, delete person objects from the database via web UI.
Java 23 (LTS Version), Spring Boot 3, Hibernate, MySQL or H2 databases supported, JSP, Gradle 8.10, GKE, Docker, minikube, & kubectl.
MySql
docker pull mysql:latest
docker run -d --name test-mysql -e MYSQL_ROOT_PASSWORD=mypassword -p 3307:3306 mysql
docker logs test-mysql
docker exec -it test-mysql bash
docker network create my-network
docker inspect network my-network
docker network connect my-network <mysql_container_name:test-mysql>
Inspect network configurations & update application properties with IPv4Address instead of localhost if mac user (IPv4Address for my-sql etc.)
- Get IPv4Address from inspect cmd and test connection from MySql workbench with new host IP. Run StarterDb.sql.
docker inspect network my-network
gradle clean build
Run 'com.ironoc.db.App.java' directly from IntelliJ (can use localhost for spring.datasource.url) or
docker image build -t ironoc-db .
docker compose up -d
docker logs ironoc-db-web-1 -f
gradle bootRun --args='--spring.profiles.active=h2'
gradle bootRun --args='--spring.profiles.active=default'
docker stop test-mysql
docker remove test-mysql
minikube start --driver=docker
kubectl cluster-info
minikube dashboard
- Then change namespace in browser after creation of 'ironoc-db' namespace.
docker images
docker image build -t ironoc-db .
minikube image load ironoc-db:latest
kubectl create ns ironoc-db-ns
kubectl get ns
kubectl apply -f ./kubernetes/ironoc-db-local.yml --namespace=ironoc-db-ns
kubectl get pods --namespace=ironoc-db-ns
kubectl get deployment --namespace=ironoc-db-ns
kubectl expose deployment ironoc-db-app-deployment --type=NodePort --namespace=ironoc-db-ns
kubectl get services --namespace=ironoc-db-ns
minikube service ironoc-db-app-deployment --url --namespace=ironoc-db-ns
- Open a new terminal tab & follow the logs
% kubectl get pods --namespace=ironoc-db-ns
NAME READY STATUS RESTARTS AGE
ironoc-db-app-deployment-6c566784bc-q29xs 1/1 Running 0 2m40s
% kubectl logs ironoc-db-app-deployment-6c566784bc-q29xs -f --namespace=ironoc-db-ns
minikube delete