A sample Spring-based application
Find a file
2024-07-05 17:00:06 +02:00
.devcontainer Latest Java version 2023-05-09 10:35:25 +01:00
.github/workflows Bump actions version to latest one (checkout * setup-java) 2024-01-23 12:22:42 +00:00
.mvn/wrapper Update dependency 2023-11-26 09:08:45 +00:00
gradle/wrapper Bump gradle from 8.4 to 8.6 2024-02-29 14:35:20 +00:00
src new stuff 2024-04-07 11:30:47 +02:00
.dockerignore Rest docker init files 2024-04-16 17:24:26 +02:00
.editorconfig Add Gradle files indentation to .editorconfig 2024-02-20 17:14:43 +00:00
.gitattributes Gradle wrapper files should have correct line endings 2024-02-29 14:35:20 +00:00
.gitignore .gitignore update 2024-04-11 12:03:21 +02:00
.gitpod.yml Docker init 2024-04-16 17:23:16 +02:00
build.gradle Fix: Removed enabling and disabeling xml/html reports in build.gradle - they threw an error 2024-07-01 14:15:51 +02:00
compose-test.yaml Split compose files into - test enviroment (db + app) and main compose (app + rds connection string) 2024-07-03 12:12:47 +02:00
compose.yaml Split compose files into - test enviroment (db + app) and main compose (app + rds connection string) 2024-07-03 12:12:47 +02:00
Dockerfile Use mysql profile in dockerfile 2024-07-02 15:42:37 +02:00
gradlew Update dependency 2023-11-26 09:08:45 +00:00
gradlew.bat Bump gradle from 8.4 to 8.6 2024-02-29 14:35:20 +00:00
Jenkinsfile Jenkinsfile update: do not process Aot on check and test 2024-07-04 15:56:10 +02:00
mvnw Upgrade for Spring Boot 3.1 (#1253) 2023-05-26 18:56:00 +01:00
mvnw.cmd Upgrade for Spring Boot 3.1 (#1253) 2023-05-26 18:56:00 +01:00
pom.xml Cleanup and checkstyle config for gradle checkstyle plugin 2024-07-01 12:26:04 +02:00
readme.md README update 2024-07-05 16:48:03 +02:00
settings.gradle Make build work with Gradle 2021-12-16 11:25:09 +00:00
test.txt Test merge pipeline 2024-07-05 17:00:06 +02:00

Sprint-petclinic codebase

This repository contains codebase for capstone project.

For capstone project I made some changes in this code base. Mainly in: Dockerfile, Jenkinsfile and build.gradle.

Also I learned how to use MySQL for spring petclinic - it reqiures some enviroment variables:

  • MYSQL_USER
  • MYSQL_PASSWORD
  • MYSQL_ROOT_PASSWORD
  • MYSQL_DATABASE
  • MYSQL_URL

They are needed for conenction to RDS. One can use it via docker -e MYSQL_... or export MYSQL_... (for java -jar usage).


Overview

Build

  • Application is built with Gradle 8.X
  • Checkstyle is provided via Gradle plugin

CI/CD

Jenkins server can be used in two ways:

  • As agent
  • As separete build server

Each will change a bit in configuration.

Dockerfile

Dockerfile is provided, also compose file for testing is present. Additionally, there is compose file with provided sample connection string - one needs to change it accoring to RDS endpoint and user data.


Explanation of components

CI/CD

Jenkins server can be configured in two ways: agent, separete build server.

As default Jenkins is configured as agent for main Controller and needs to be initilized manually (user, password, plugins, connection, etc.)

Agent usage:

  • In Controller add agent
  • Add agent via commend given from Controller.
  • Create multibranch pipeline job in Controller with GitHub project and SCM pipeline.
  • Ensure all needed credentials are added in Controller (DockerHub, GitHub, AWS, etc.) - check spring-petclinic-infrastructure README
  • Configure repository webhook for server

Separete server usage:

  • For the pipeline to work correctly one needs to setup credentials for Docker Hub and GitHub in Jenkins server
  • Change agent in Jenkinsfile to any
  • Configure repository webhook for server

Dockerfile

For image creation basic Gradle image is used for build purposes, with addition of distroless layer for application. Image is split into layers according to (at time of creation and my knowlage) current standards, and optimalized for minimal size.

Two compose files are present - one for testing connection string, other for providing container that connects to RDS.