Skip to content

About

Spring Boot blogging app with Jenkins build pipelines, Docker, Terraform for Amazon EKS and Kubernetes manifests.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Full-Stack Blogging App: Spring Boot on Amazon EKS

A Spring Boot blogging application with user registration, login and posts, delivered through Jenkins build pipelines, a Docker image, Terraform for an Amazon EKS cluster, and Kubernetes manifests.

Java Spring Boot Spring Security Jenkins Docker Terraform Kubernetes

Last commit Top language Repository size

What this demonstrates

  • Building and testing a Spring Boot application in a pipeline, on a labelled agent
  • Provisioning an EKS cluster with Terraform and deploying to it with Kubernetes manifests
  • Pulling from a private registry inside a cluster using an image pull secret

Application

  • Spring Boot web app with Thymeleaf pages: home feed, new post, login and registration
  • Spring Security with a custom UserDetailsService
  • Spring Data JPA on an in-memory H2 database, with the H2 console at /h2-console. Data resets whenever the app restarts.

Delivery components

Path Purpose
Jenkinsfile Compile → Test → Package with Maven 3 and JDK 17, on any agent
Jenkinsfile1 The same pipeline, pinned to the slave-1 agent
Dockerfile eclipse-temurin:17-jdk-alpine image that runs the packaged JAR on port 8080
EKS_Terraform/ VPC with two public subnets in ap-south-1, internet gateway, routing, security groups and the EKS cluster
deployment-service.yml Deployment (2 replicas pulling a private Docker Hub image through the regcred secret) and a LoadBalancer Service, port 80 → 8080

Architecture

flowchart LR
    GH["GitHub"] --> J["Jenkins<br/>compile → test → package"]
    J --> JAR["Application JAR"]
    JAR --> IMG["docker build"]
    IMG --> DH["Docker Hub<br/>private repository"]
    TF["Terraform<br/>EKS_Terraform/"] --> EKS["Amazon EKS<br/>ap-south-1"]
    DH --> DEP["Deployment: 2 replicas"]
    DEP --> EKS
    EKS --> LB["LoadBalancer Service<br/>port 80"]
Loading

Run locally

./mvnw spring-boot:run

Open http://localhost:8080.

Build the container

./mvnw clean package
docker build -t <dockerhub-user>/bloggingapp:latest .
docker push <dockerhub-user>/bloggingapp:latest

Deploy to Amazon EKS

cd EKS_Terraform
terraform init
terraform apply

aws eks update-kubeconfig --region ap-south-1 --name <cluster-name>   # cluster name: see output.tf

kubectl create secret docker-registry regcred \
  --docker-username=<dockerhub-user> --docker-password=<access-token>

kubectl apply -f ../deployment-service.yml
kubectl get svc bloggingapp-ssvc     # EXTERNAL-IP is the load balancer address

Change the image in deployment-service.yml to your own before applying.

Credits

Based on jaiswaladi246/FullStack-Blogging-App by Aditya Jaiswal (DevOps Shack).


Maintained by Rajan Kumar · LinkedIn

About

Spring Boot blogging app with Jenkins build pipelines, Docker, Terraform for Amazon EKS and Kubernetes manifests.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages