Giter Club home page Giter Club logo

ia-task-configuration's Introduction

Spring Boot application template

Build Status

Purpose

The purpose of this template is to speed up the creation of new Spring applications within HMCTS and help keep the same standards across multiple teams. If you need to create a new app, you can simply use this one as a starting point and build on top of it.

What's inside

The template is a working application with a minimal setup. It contains:

  • application skeleton
  • setup script to prepare project
  • common plugins and libraries
  • docker setup
  • swagger configuration for api documentation (see how to publish your api documentation to shared repository)
  • code quality tools already set up
  • integration with Travis CI
  • Hystrix circuit breaker enabled
  • MIT license and contribution information
  • Helm chart using chart-java.

The application exposes health endpoint (http://localhost:4550/health) and metrics endpoint (http://localhost:4550/metrics).

Plugins

The template contains the following plugins:

Setup

Located in ./bin/init.sh. Simply run and follow the explanation how to execute it.

Notes

Since Spring Boot 2.1 bean overriding is disabled. If you want to enable it you will need to set spring.main.allow-bean-definition-overriding to true.

JUnit 5 is now enabled by default in the project. Please refrain from using JUnit4 and use the next generation

Building and deploying the application

Building the application

The project uses Gradle as a build tool. It already contains ./gradlew wrapper script, so there's no need to install gradle.

To build the project execute the following command:

  ./gradlew build

Running the application

Create the image of the application by executing the following command:

  ./gradlew assemble

Create docker image:

  docker-compose build

Run the distribution (created in build/install/spring-boot-template directory) by executing the following command:

  docker-compose up

This will start the API container exposing the application's port (set to 4550 in this template app).

In order to test if the application is up, you can call its health endpoint:

  curl http://localhost:4550/health

You should get a response similar to this:

  {"status":"UP","diskSpace":{"status":"UP","total":249644974080,"free":137188298752,"threshold":10485760}}

Alternative script to run application

To skip all the setting up and building, just execute the following command:

./bin/run-in-docker.sh

For more information:

./bin/run-in-docker.sh -h

Script includes bare minimum environment variables necessary to start api instance. Whenever any variable is changed or any other script regarding docker image/container build, the suggested way to ensure all is cleaned up properly is by this command:

docker-compose rm

It clears stopped containers correctly. Might consider removing clutter of images too, especially the ones fiddled with:

docker images

docker image rm <image-id>

There is no need to remove postgres and java or similar core images.

Hystrix

Hystrix is a library that helps you control the interactions between your application and other services by adding latency tolerance and fault tolerance logic. It does this by isolating points of access between the services, stopping cascading failures across them, and providing fallback options. We recommend you to use Hystrix in your application if it calls any services.

Hystrix circuit breaker

This template API has Hystrix Circuit Breaker already enabled. It monitors and manages all the@HystrixCommand or HystrixObservableCommand annotated methods inside @Component or @Service annotated classes.

Other

Hystrix offers much more than Circuit Breaker pattern implementation or command monitoring. Here are some other functionalities it provides:

Adding Git Conventions

Include the git conventions.

  • Make sure your git version is at least 2.9 using the git --version command
  • Run the following command:
git config --local core.hooksPath .git-config/hooks

Once the above is done, you will be required to follow specific conventions for your commit messages and branch names.

If you violate a convention, the git error message will report clearly the convention you should follow and provide additional information where necessary.

Optional:

  • Install this plugin in Chrome: https://github.com/refined-github/refined-github

    It will automatically set the title for new PRs according to the first commit message, so you won't have to change it manually.

    Note that it will also alter other behaviours in GitHub. Hopefully these will also be improvements to you.

In case of problems

  1. Get in touch with your Technical Lead and inform them, so they can adjust the git hooks accordingly

  2. Instruct IntelliJ not to use Git Hooks for that commit or use git's --no-verify option if you are using the command-line

  3. If the rare eventuality that the above is not possible, you can disable enforcement of conventions using the following command

    git config --local --unset core.hooksPath

    Still, you shouldn't be doing it so make sure you get in touch with a Technical Lead soon afterwards.

License

This project is licensed under the MIT License - see the LICENSE file for details

ia-task-configuration's People

Contributors

alexbaeza avatar amandarichards avatar augustio avatar burnsthmcts avatar dependabot-preview[bot] avatar dharmendrak avatar filippo-possenti-version1 avatar gregorio-massara avatar hannah38 avatar iguannago avatar indvamshi avatar ivitale avatar jakecohensol avatar jamiehmcts avatar jamiephillipshmcts avatar lee365 avatar linusnorton avatar ludo05 avatar marcellofabbri avatar mcareyma avatar mkayad avatar nilay913 avatar raghera avatar rajeshthuraiyur avatar renovate[bot] avatar robin-ieong avatar serdaroguzhanakin avatar sibuckley-v1 avatar thomaskkc avatar timja avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ia-task-configuration's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

  • Update all non-major dependencies (gradle, org.apache.tomcat.embed:tomcat-embed-websocket, org.apache.tomcat.embed:tomcat-embed-core, info.solidsoft.gradle.pitest:gradle-pitest-plugin, org.pitest:pitest, org.camunda.bpm:camunda-engine, org.camunda.bpm.dmn:camunda-engine-dmn, com.fasterxml.jackson.module:jackson-module-parameter-names, com.fasterxml.jackson.datatype:jackson-datatype-jdk8, com.fasterxml.jackson.datatype:jackson-datatype-jsr310, com.fasterxml.jackson.dataformat:jackson-dataformat-yaml, com.fasterxml.jackson.dataformat:jackson-dataformat-csv, com.fasterxml.jackson.core:jackson-annotations, com.fasterxml.jackson.core:jackson-core, com.fasterxml.jackson.core:jackson-databind, commons-io:commons-io, org.yaml:snakeyaml, com.google.guava:guava, info.solidsoft.pitest, org.sonarqube, org.owasp.dependencycheck, com.github.ben-manes.versions, io.spring.dependency-management)

Detected dependencies

docker-compose
docker-compose.yml
dockerfile
Dockerfile
github-actions
.github/workflows/pr-title-validation.yml
.github/workflows/stale.yml
  • actions/stale v9
gradle
build.gradle
  • io.spring.dependency-management 1.1.4
  • org.springframework.boot 2.7.18
  • com.github.ben-manes.versions 0.50.0
  • org.owasp.dependencycheck 10.0.3
  • org.sonarqube 4.3.0.3225
  • info.solidsoft.pitest 1.9.11
  • io.freefair.lombok 6.6.3
  • pmd 6.55.0
  • org.bouncycastle:bcpkix-jdk15on 1.70
  • com.google.guava:guava 32.1.2-jre
  • org.yaml:snakeyaml 2.2
  • org.glassfish:jakarta.el 4.0.2
  • commons-io:commons-io 2.15.1
  • com.fasterxml.jackson.core:jackson-databind 2.16.0
  • com.fasterxml.jackson.core:jackson-core 2.16.0
  • com.fasterxml.jackson.core:jackson-annotations 2.16.0
  • com.fasterxml.jackson.dataformat:jackson-dataformat-csv 2.16.0
  • com.fasterxml.jackson.dataformat:jackson-dataformat-yaml 2.16.0
  • com.fasterxml.jackson.datatype:jackson-datatype-jsr310 2.16.0
  • com.fasterxml.jackson.datatype:jackson-datatype-jdk8 2.16.0
  • com.fasterxml.jackson.module:jackson-module-parameter-names 2.16.0
  • io.springfox:springfox-boot-starter 3.0.0
  • com.github.hmcts.java-logging:logging 5.1.9
  • com.github.hmcts.java-logging:logging-appinsights 5.1.9
  • org.apache.tomcat.embed:tomcat-embed-core 9.0.83
  • org.apache.tomcat.embed:tomcat-embed-websocket 9.0.83
  • org.pitest:pitest 1.9.11
  • info.solidsoft.gradle.pitest:gradle-pitest-plugin 1.9.11
  • org.codehaus.sonar-plugins:sonar-pitest-plugin 0.5
  • org.camunda.bpm.dmn:camunda-engine-dmn 7.20.0
  • org.camunda.bpm.assert:camunda-bpm-assert 8.0.0
  • org.camunda.bpm:camunda-engine 7.20.0
  • org.apiguardian:apiguardian-api 1.1.2
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.9
helm-values
charts/ia-task-configuration/values.yaml
helmv3
charts/ia-task-configuration/Chart.yaml
  • java 5.2.1
terraform
infrastructure/main.tf
terraform-version
infrastructure/.terraform-version
  • hashicorp/terraform 0.15.5

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.