App Java web (javaee8) with Wildfly, PostgreSQL and Docker.
Running on Kubernetes and replicating the session between instances using Kube Ping.
Clone the project repository:
git clone https://github.com/evandromoura/jkubecluster.git
Datasource:
Configure according to your PostgreSQL connection data
HOST:
Configure the Host correctly
If you need to register the host on your machine:
echo "192.168.xx.xx jkubecluster.evandromoura.com" >> /etc/hosts
Enter the IP of Kubernetes – NGINX – IngressController
When generating the Docker build, it will copy the KUBE PING module files, the standalone-full-ha.xml file (with the datasource and host information) and the build to the corresponding wildfly directories.
Also, it will set the docker ENTRYPOINT to docker-entrypoint.sh
File buildAndRun.sh
mvn clean package && sudo docker build -t evandromoura/jkubecluster . && sudo docker push evandromoura/jkubecluster
Change the command above informing your repository on the docker hub
Prerequisites: Have Kubernetes and NGINX Ingress Controller installed:
Run this configuration on the master
kubectl apply -f jkubecluster-app.yaml
3 replicas of our container were created.
Let's stop POD jkubecluster-evandromoura-97d578665-wb5j8
Refreshing the page will redirect it to another POD and keep the session values