Skip to content

Commit

Permalink
Merge pull request #10 from hmcts/feat/cleanup-initial-repo
Browse files Browse the repository at this point in the history
Cleanup initial repo
  • Loading branch information
sabahirfan authored Mar 20, 2023
2 parents 0e72055 + b41332c commit 979b61b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 257 deletions.
97 changes: 6 additions & 91 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,9 @@
# Spring Boot application template
# Civil Commons Library

[![Build Status](https://travis-ci.org/hmcts/spring-boot-template.svg?branch=master)](https://travis-ci.org/hmcts/spring-boot-template)

## 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](https://github.com/hmcts/reform-api-docs#publish-swagger-docs))
* 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).
This repository contains the common reusable code for civil project.

## Plugins

Expand Down Expand Up @@ -88,19 +68,15 @@ The template contains the following plugins:
./gradlew dependencyUpdates -Drevision=release
```

## 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 and deploying the library

### Building the application
### Building the library

The project uses [Gradle](https://gradle.org) as a build tool. It already contains
`./gradlew` wrapper script, so there's no need to install gradle.
Expand All @@ -111,72 +87,11 @@ To build the project execute the following command:
./gradlew build
```
### Running the application
Create the image of the application by executing the following command:
```bash
./gradlew assemble
```
Create docker image:
```bash
docker-compose build
```
Run the distribution (created in `build/install/spring-boot-template` directory)
by executing the following command:
To publish the library to local maven execute the following command:
```bash
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:

```bash
curl http://localhost:4550/health
```

You should get a response similar to this:

./gradlew publishToMavenLocal
```
{"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:

```bash
./bin/run-in-docker.sh
```

For more information:

```bash
./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:

```bash
docker-compose rm
```

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

```bash
docker images
docker image rm <image-id>
```

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

### Other
Hystrix offers much more than Circuit Breaker pattern implementation or command monitoring.
Expand Down
93 changes: 0 additions & 93 deletions bin/init.sh

This file was deleted.

73 changes: 0 additions & 73 deletions bin/run-in-docker.sh

This file was deleted.

0 comments on commit 979b61b

Please sign in to comment.