================
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, Spring Boot 3, Hibernate, MySQL or H2 databases supported, JSP, Gradle 8.11, 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>
docker inspect network my-network
gradle clean build
gcloud auth application-default login
gcloud config list
docker image build -t ironoc-db .
docker compose up -d
docker ps
docker logs ironoc-db-web-1 -f
docker compose down
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
π minikube v1.35.0 on Darwin 15.3.1
β Both driver=docker and vm-driver=virtualbox have been set.
Since vm-driver is deprecated, minikube will default to driver=docker.
If vm-driver is set in the global config, please run "minikube config unset vm-driver" to resolve this warning.
β¨ Using the docker driver based on user configuration
π Using Docker Desktop driver with root privileges
π Starting "minikube" primary control-plane node in "minikube" cluster
π Pulling base image v0.0.46 ...
πΎ Downloading Kubernetes v1.32.0 preload ...
> preloaded-images-k8s-v18-v1...: 333.57 MiB / 333.57 MiB 100.00% 22.49 M
> gcr.io/k8s-minikube/kicbase...: 500.31 MiB / 500.31 MiB 100.00% 14.30 M
π₯ Creating docker container (CPUs=2, Memory=4000MB) ...
π³ Preparing Kubernetes v1.32.0 on Docker 27.4.1 ...
βͺ Generating certificates and keys ...
βͺ Booting up control plane ...
βͺ Configuring RBAC rules ...
π Configuring bridge CNI (Container Networking Interface) ...
π Verifying Kubernetes components...
βͺ Using image gcr.io/k8s-minikube/storage-provisioner:v5
π Enabled addons: storage-provisioner, default-storageclass
π Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
% kubectl cluster-info
Kubernetes control plane is running at https://127.0.0.1:54912
CoreDNS is running at https://127.0.0.1:54912/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
% minikube dashboard
π Enabling dashboard ...
βͺ Using image docker.io/kubernetesui/metrics-scraper:v1.0.8
βͺ Using image docker.io/kubernetesui/dashboard:v2.7.0
π‘ Some dashboard features require the metrics-server addon. To enable all features please run:
minikube addons enable metrics-server
π€ Verifying dashboard health ...
π Launching proxy ...
π€ Verifying proxy health ...
π Opening http://127.0.0.1:54976/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser...
% docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
gcr.io/k8s-minikube/kicbase v0.0.45 e7c9bc3bc515 3 months ago 1.81GB
gcr.io/k8s-minikube/kicbase <none> 81df28859520 3 months ago 1.81GB
% docker image build -t ironoc-db .
[+] Building 122.6s (8/8) FINISHED docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 241B 0.0s
=> [internal] load metadata for docker.io/library/gradle:8.11.1-jdk23-alpine 0.8s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build context 0.6s
=> => transferring context: 252.81kB 0.6s
=> CACHED [1/3] FROM docker.io/library/gradle:8.11.1-jdk23-alpine@sha256:a61858da62eeb4ba9a10e1a188fff2303ebcde278d629d9e2161adeca8455543 0.0s
=> => resolve docker.io/library/gradle:8.11.1-jdk23-alpine@sha256:a61858da62eeb4ba9a10e1a188fff2303ebcde278d629d9e2161adeca8455543 0.0s
=> [2/3] COPY . /home/gradle 0.7s
=> [3/3] RUN gradle build 99.6s
=> exporting to image 20.7s
=> => exporting layers 15.4s
=> => exporting manifest sha256:6254bab1642bda1893d83a6c43db990ad3d876bb2c8df4b71d6179f421d48fc9 0.0s
=> => exporting config sha256:83f14c983f12d2f492c6840136cf94fc2a7947c21fd036ede1a3c661cb7bd061 0.0s
=> => exporting attestation manifest sha256:a320ea5f81d729d731654902265d715d07faffb99b74b169d9f20855bbb5c38b 0.1s
=> => exporting manifest list sha256:1e287e0f161e9d2c71deb57e06d4c619caa79a68ac2648ada074f3fe94d82fee 0.0s
=> => naming to docker.io/library/ironoc-db:latest 0.0s
=> => unpacking to docker.io/library/ironoc-db:latest 5.1s
View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/py9r2clbl41pqcl6ys5dqskmp
Whats next:
View a summary of image vulnerabilities and recommendations β docker scout quickview
% docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ironoc-db latest 1e287e0f161e 7 minutes ago 1.79GB
gcr.io/k8s-minikube/kicbase v0.0.45 e7c9bc3bc515 3 months ago 1.81GB
gcr.io/k8s-minikube/kicbase <none> 81df28859520 3 months ago 1.81GB
% minikube image load ironoc-db:latest
% kubectl create ns ironoc-db-ns
namespace/ironoc-db-ns created
% kubectl get ns
NAME STATUS AGE
default Active 27m
ironoc-db-ns Active 7s
kube-node-lease Active 27m
kube-public Active 27m
kube-system Active 27m
kubernetes-dashboard Active 14m
% kubectl apply -f ./kubernetes/ironoc-db-local.yml --namespace=ironoc-db-ns
deployment.apps/ironoc-db-app-deployment created
horizontalpodautoscaler.autoscaling/ironoc-db-app-deployment-hpa-kbij created
% kubectl get pods --namespace=ironoc-db-ns
NAME READY STATUS RESTARTS AGE
ironoc-db-app-deployment-d5c59b4c5-rzmhz 1/1 Running 0 10s
% kubectl get deployment --namespace=ironoc-db-ns
NAME READY UP-TO-DATE AVAILABLE AGE
ironoc-db-app-deployment 1/1 1 1 17s
% kubectl expose deployment ironoc-db-app-deployment --type=NodePort --namespace=ironoc-db-ns
service/ironoc-db-app-deployment exposed
% kubectl get services --namespace=ironoc-db-ns
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
ironoc-db-app-deployment NodePort 10.96.135.232 <none> 8080:31797/TCP 8s
% minikube service ironoc-db-app-deployment --url --namespace=ironoc-db-ns
http://127.0.0.1:55519
β Because you are using a Docker driver on darwin, the terminal needs to be open to run it.
% kubectl logs ironoc-db-app-deployment-d5c59b4c5-rzmhz -f βnamespace=ironoc-db-ns Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use βstatus for details
Task :compileJava UP-TO-DATE Task :processResources UP-TO-DATE Task :classes UP-TO-DATE Task :resolveMainClassName UP-TO-DATE
Task :bootRun
.__ ____ ____ __ __.
|__|___ \ __ __ __ __ ____ \ ___ / | ___ _ | ___ ____ __
| | | / / _ \ / \ / _ \ _/ __\ | | \ __ \ \ __\ \ | __ \ __ \ / __// __ \
| | | | ( <_> )| | \( <_> )\ \___ | ` \ / __ \_ | | / __ \_ | \_\ \ / __ \_ \___ \ \ ___/
|__| |____|_ / \____/ |___| / \____/ \___ > /_______ /(____ / |__| (____ / |___ /(____ //____ > \___ >
\/ \/ \/ \/ \/ \/ \/ \/ \/ \/
2025-02-20T19:35:28.390Z INFO 143 β [ main] com.ironoc.db.App : Starting App using Java 23.0.1 with PID 143 (/home/gradle/build/classes/java/main started by root in /home/gradle)
2025-02-20T19:35:28.396Z INFO 143 β [ main] com.ironoc.db.App : The following 1 profile is active: βh2β
2025-02-20T19:35:30.088Z INFO 143 β [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2025-02-20T19:35:30.171Z INFO 143 β [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 67 ms. Found 1 JPA repository interface.
2025-02-20T19:35:31.099Z INFO 143 β [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
2025-02-20T19:35:31.125Z INFO 143 β [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2025-02-20T19:35:31.126Z INFO 143 β [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/11.0.3]
2025-02-20T19:35:31.496Z INFO 143 β [ main] org.apache.jasper.servlet.TldScanner : At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2025-02-20T19:35:31.504Z INFO 143 β [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2025-02-20T19:35:31.506Z INFO 143 β [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2878 ms
2025-02-20T19:35:31.579Z INFO 143 β [ main] c.i.db.service.GoogleCloudClientImpl : Entering GoogleCloudClient.getSecret **
2025-02-20T19:35:32.290Z INFO 143 β [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2025-02-20T19:35:32.374Z INFO 143 β [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 6.6.5.Final
2025-02-20T19:35:32.437Z INFO 143 β [ main] o.h.c.internal.RegionFactoryInitiator : HHH000026: Second-level cache disabled
2025-02-20T19:35:32.863Z INFO 143 β [ main] o.s.o.j.p.SpringPersistenceUnitInfo : No LoadTimeWeaver setup: ignoring JPA class transformer
2025-02-20T19:35:32.905Z WARN 143 β [ main] org.hibernate.orm.deprecation : HHH90000025: H2Dialect does not need to be specified explicitly using βhibernate.dialectβ (remove the property setting and it will be selected by default)
2025-02-20T19:35:32.923Z INFO 143 β [ main] org.hibernate.orm.connections.pooling : HHH10001005: Database info:
Database JDBC URL [undefined/unknown]
Database driver: undefined/unknown
Database version: 2.1.214
Autocommit mode: undefined/unknown
Isolation level:


```shell
% minikube delete
π₯ Deleting "minikube" in docker ...
π₯ Deleting container "minikube" ...
π₯ Removing /Users/conorheffron/.minikube/machines/minikube ...
π Removed all traces of the "minikube" cluster.