From 9f5f61ac756f07f3c12117a336aeeaddedeba46d Mon Sep 17 00:00:00 2001
From: evilimkova <xvilimk@fi.muni.cz>
Date: Tue, 25 Apr 2023 10:37:03 +0200
Subject: [PATCH] Adding configuration to expose health and metrics

---
 .../src/main/resources/application.properties               | 5 +++++
 .../src/main/resources/application.properties               | 6 ++++++
 .../src/main/resources/application.properties               | 5 +++++
 .../module-mail/src/main/resources/application.properties   | 6 ++++++
 application/pom.xml                                         | 5 +++++
 5 files changed, 27 insertions(+)

diff --git a/application/module-certificate/src/main/resources/application.properties b/application/module-certificate/src/main/resources/application.properties
index 21fb3ce4..56f47bd4 100644
--- a/application/module-certificate/src/main/resources/application.properties
+++ b/application/module-certificate/src/main/resources/application.properties
@@ -1,5 +1,10 @@
 server.port=5001
 
+management.endpoints.web.exposure.include=health, metrics
+management.endpoint.health.show-details=always
+management.health.defaults.enabled=true
+management.endpoint.health.probes.enabled=true
+
 spring.jpa.open-in-view=false
 spring.datasource.url=jdbc:h2:mem:social-network;MODE=PostgreSQL
 spring.datasource.driverClassName=org.h2.Driver
diff --git a/application/module-exercise/src/main/resources/application.properties b/application/module-exercise/src/main/resources/application.properties
index 22a97362..13d14764 100644
--- a/application/module-exercise/src/main/resources/application.properties
+++ b/application/module-exercise/src/main/resources/application.properties
@@ -1,3 +1,9 @@
 server.port=5002
+
+management.endpoints.web.exposure.include=health, metrics
+management.endpoint.health.show-details=always
+management.health.defaults.enabled=true
+management.endpoint.health.probes.enabled=true
+
 spring.h2.console.enabled=true
 spring.datasource.url=jdbc:h2:mem:exercices
\ No newline at end of file
diff --git a/application/module-language-school/src/main/resources/application.properties b/application/module-language-school/src/main/resources/application.properties
index 08d8fcc5..db1fd4ab 100644
--- a/application/module-language-school/src/main/resources/application.properties
+++ b/application/module-language-school/src/main/resources/application.properties
@@ -1,5 +1,10 @@
 server.port=5000
 
+management.endpoints.web.exposure.include=health, metrics
+management.endpoint.health.show-details=always
+management.health.defaults.enabled=true
+management.endpoint.health.probes.enabled=true
+
 spring.jpa.open-in-view=false
 spring.datasource.url=jdbc:h2:mem:social-network;MODE=PostgreSQL
 spring.datasource.driverClassName=org.h2.Driver
diff --git a/application/module-mail/src/main/resources/application.properties b/application/module-mail/src/main/resources/application.properties
index bbd88e6a..44b7f743 100644
--- a/application/module-mail/src/main/resources/application.properties
+++ b/application/module-mail/src/main/resources/application.properties
@@ -1,4 +1,10 @@
 server.port=5003
+
+management.endpoints.web.exposure.include=health, metrics
+management.endpoint.health.show-details=always
+management.health.defaults.enabled=true
+management.endpoint.health.probes.enabled=true
+
 spring.mail.host=smtp.gmail.com
 spring.mail.port=587
 spring.mail.username=sprachschul@gmail.com
diff --git a/application/pom.xml b/application/pom.xml
index 15b19af1..81c06568 100644
--- a/application/pom.xml
+++ b/application/pom.xml
@@ -94,6 +94,11 @@
             <artifactId>mapstruct</artifactId>
             <version>${org.mapstruct.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
     </dependencies>
 
     <build>
-- 
GitLab