Skip to content

agency-icole/spring-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

spring-utils

Collection of Spring utilities supporting integration with Docker/Portainer. This is not an official Portainer.io project, yet.

Instalation

To use services, endpoints and other utilities contained in this project please add following dependency to your pom.xml:

<dependency>
  <groupId>eu.icole</groupId>
  <artifactId>spring-utils</artifactId>
  <version>0.0.3</version>
</dependency>

Endpoints

Currently the only endpoint offered is actuator/docker/health.

actuator/docker/health

The purpose of this Actutator endpoint is to help you provide an status on the health of your application to the Docker engine, so it could be visualised by the Pointainer. First to enable the endpoint you need to add following line in your application.properties:

management.endpoints.web.exposure.include=docker

Then next step is to tell our endpoint which indicators shall be monitored.

icole.docker.health.indicators=diskSpace,portainerStatus

In our example we have choosen two: diskSpace and portainerStatus. If any of this indicators will fail, the Docker will be instructed to show unhealty status together with the output message generated by our failed indicator.

By default this endpoint have a value 'list' provided, so after accessing it by the browser you will see a list of all indicators offered by the Spring.

The other two values possible, beside the list of indicators provided by you, are: 'none' and 'all'. First will always return an healty status, the other will check all indicators offered by Spring for your application.

Configuring Dockerfile

To make possible for Docker to check status of your Spring application you need to add following line in the Dockerfile.

For wget:

HEALTHCHECK --interval=15s --timeout=10s CMD wget -qO- --content-on-error=on http://localhost:8080/actuator/docker/health || exit 1

For curl:

HEALTHCHECK --interval=15s --timeout=10s CMD curl -f http://localhost:8080/actuator/docker/health || exit 1 

The Polish readers can read my article published on Medium on the issue of monitoring the health of application by Docker: https://medium.com/@artur_87325/ciągłe-dostarczanie-sprawdzanie-zdrowia-aplikacji-939af5890b8c

Indicators

telegraf

Checking if telegraf process is running.

jdbcProfile

Checking if there is a connection to database.

Enjoy!

Releases

No releases published

Packages

No packages published

Languages