Skip to content

Commit a237978

Browse files
committed
Update Actuator Config to add Info
Removed Heroku related config files since this newer versions are no longer supported to deploy on Heroku since it is FREE anymore
1 parent f7ef42d commit a237978

File tree

14 files changed

+76
-53
lines changed

14 files changed

+76
-53
lines changed

.directory

Lines changed: 0 additions & 6 deletions
This file was deleted.

Procfile

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Docker JVM Build](https://img.shields.io/github/actions/workflow/status/RawSanj/spring-redis-websocket/docker-jvm-image.yml?style=flat-square&logo=docker&label=jvm%20build)](https://github.com/RawSanj/spring-redis-websocket/actions/workflows/docker-jvm-image.yml)
44
[![Docker GraalVM Native Build](https://img.shields.io/github/actions/workflow/status/RawSanj/spring-redis-websocket/docker-graalvm-native-image.yml?style=flat-square&logo=docker&label=graalvm%20build)](https://github.com/RawSanj/spring-redis-websocket/actions/workflows/docker-graalvm-native-image.yml)
5-
[![Docker Pulls](https://img.shields.io/docker/pulls/rawsanj/spring-redis-websocket?style=flat-square&logo=docker&color=orange)](https://hub.docker.com/repository/docker/rawsanj/spring-redis-websocket/general)
5+
[![Docker Pulls](https://img.shields.io/docker/pulls/rawsanj/spring-redis-websocket?style=flat-square&logo=docker&color=orange)](https://hub.docker.com/r/rawsanj/spring-redis-websocket)
66
[![Discord Server](https://img.shields.io/discord/465093591002513418?style=flat-square&logo=discord&label=discord)](https://discord.gg/4ebNhud)
77
[![GitHub License](https://img.shields.io/github/license/rawsanj/spring-redis-websocket?style=flat-square&logo=apache&logoColor=red)](https://github.com/RawSanj/spring-redis-websocket?tab=Apache-2.0-1-ov-file)
88
[![Spring Chat Website](https://img.shields.io/website?url=https%3A%2F%2Fchat.apps.dedyn.io%2Factuator%2Fhealth&up_message=online&up_color=green&down_message=offline&down_color=red&style=flat-square&logo=signal&logoColor=white&label=DEMO%20Chat&labelColor=purple)](https://chat.apps.dedyn.io)

app.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

pom.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
<properties>
2222
<java.version>21</java.version>
23+
<git-commit-id-maven-plugin.version>7.0.0</git-commit-id-maven-plugin.version>
2324
<registry.image.name>rawsanj/spring-redis-websocket</registry.image.name>
2425
<skipNativeImage>true</skipNativeImage>
2526
</properties>
@@ -104,6 +105,34 @@
104105
</execution>
105106
</executions>
106107
</plugin>
108+
<plugin>
109+
<groupId>io.github.git-commit-id</groupId>
110+
<artifactId>git-commit-id-maven-plugin</artifactId>
111+
<version>${git-commit-id-maven-plugin.version}</version>
112+
<executions>
113+
<execution>
114+
<goals>
115+
<goal>revision</goal>
116+
</goals>
117+
</execution>
118+
</executions>
119+
<configuration>
120+
<failOnNoGitDirectory>true</failOnNoGitDirectory>
121+
<failOnUnableToExtractRepoInfo>true</failOnUnableToExtractRepoInfo>
122+
<generateGitPropertiesFile>true</generateGitPropertiesFile>
123+
<commitIdGenerationMode>full</commitIdGenerationMode>
124+
<includeOnlyProperties>
125+
<includeOnlyProperty>^git.branch$</includeOnlyProperty>
126+
<includeOnlyProperty>^git.build.version</includeOnlyProperty>
127+
<includeOnlyProperty>^git.build.time</includeOnlyProperty>
128+
<includeOnlyProperty>^git.commit.id.abbrev$</includeOnlyProperty>
129+
<includeOnlyProperty>^git.commit.message.short</includeOnlyProperty>
130+
<includeOnlyProperty>^git.commit.time</includeOnlyProperty>
131+
<includeOnlyProperty>^git.commit.user.name</includeOnlyProperty>
132+
<includeOnlyProperty>^git.total.commit.count</includeOnlyProperty>
133+
</includeOnlyProperties>
134+
</configuration>
135+
</plugin>
107136
</plugins>
108137
</build>
109138

src/main/docker/Dockerfile.jvm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM maven:3.8.8-eclipse-temurin-21 as build
1+
FROM maven:3.8.8-eclipse-temurin-21 AS build
22
WORKDIR /app
33
COPY ../../.. ./
44
RUN mvn clean package --file pom.xml

src/main/docker/Dockerfile.native

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ghcr.io/graalvm/native-image-community:21 as build
1+
FROM ghcr.io/graalvm/native-image-community:21 AS build
22
WORKDIR /app
33
COPY ../../.. ./
44
RUN ./mvnw -Pnative clean package -DskipNativeImage=false --file pom.xml

src/main/java/com/github/rawsanj/config/RuntimeHintsConfig.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.github.rawsanj.model.ChatMessage;
44
import com.github.rawsanj.model.Message;
5-
import com.github.rawsanj.model.Platform;
65
import org.springframework.aot.hint.RuntimeHints;
76
import org.springframework.aot.hint.RuntimeHintsRegistrar;
87
import org.springframework.context.annotation.ImportRuntimeHints;
@@ -18,8 +17,7 @@ static class SerdeRuntimeHints implements RuntimeHintsRegistrar {
1817
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
1918
hints.serialization()
2019
.registerType(ChatMessage.class)
21-
.registerType(Message.class)
22-
.registerType(Platform.class);
20+
.registerType(Message.class);
2321
}
2422
}
2523
}

src/main/java/com/github/rawsanj/handler/WebHttpHandler.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
import com.github.rawsanj.messaging.RedisChatMessagePublisher;
44
import com.github.rawsanj.model.Message;
5-
import com.github.rawsanj.model.Platform;
65
import org.springframework.beans.factory.annotation.Value;
76
import org.springframework.context.annotation.Bean;
87
import org.springframework.context.annotation.Configuration;
9-
import org.springframework.core.env.Environment;
108
import org.springframework.core.io.Resource;
119
import org.springframework.http.MediaType;
1210
import org.springframework.web.reactive.function.server.RouterFunction;
@@ -21,14 +19,11 @@ public class WebHttpHandler {
2119

2220
@Bean
2321
public RouterFunction<ServerResponse> htmlRouter(@Value("classpath:/static/index.html") Resource html,
24-
RedisChatMessagePublisher redisChatMessagePublisher, Environment environment) {
22+
RedisChatMessagePublisher redisChatMessagePublisher) {
2523
return route(GET("/"), request -> ServerResponse.ok().contentType(MediaType.TEXT_HTML).bodyValue(html))
2624
.andRoute(POST("/message"), request -> request.bodyToMono(Message.class)
2725
.flatMap(message -> redisChatMessagePublisher.publishChatMessage(message.getMessage()))
2826
.flatMap(aLong -> ServerResponse.ok().bodyValue(new Message("Message Sent Successfully!.")))
29-
)
30-
.andRoute(
31-
GET("/platform"), request -> ServerResponse.ok().bodyValue(new Platform(environment.getProperty("RUNTIME_PLATFORM", "JVM")))
3227
);
3328
}
3429

src/main/java/com/github/rawsanj/model/Platform.java

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/main/resources/application.yaml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,46 @@ spring:
55
port: 6379
66
application:
77
name: spring-redis-reactive-websocket
8+
89
management:
10+
endpoints:
11+
web:
12+
base-path: /management
13+
exposure:
14+
include:
15+
- configprops
16+
- env
17+
- health
18+
- info
19+
- logfile
20+
- loggers
21+
- threaddump
922
endpoint:
1023
health:
11-
access: read_only
1224
show-details: always
25+
group:
26+
liveness:
27+
include: livenessState
28+
readiness:
29+
include: readinessState
30+
info:
31+
git:
32+
mode: full
33+
env:
34+
enabled: true
35+
health:
36+
redis:
37+
enabled: true
38+
metrics:
39+
enable:
40+
http: true
41+
jvm: true
42+
logback: true
43+
process: true
44+
system: true
45+
distribution:
46+
percentiles-histogram:
47+
all: true
48+
percentiles:
49+
all: 0, 0.5, 0.75, 0.95, 0.99, 1.0
50+

src/main/resources/static/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,13 @@ $(document).ready(function () {
177177

178178
function initPlatform() {
179179
$.ajax({
180-
url: "/platform",
180+
url: "/management/info",
181181
type: "GET",
182182
dataType: "json",
183183
contentType: "application/json",
184184
success: function (response) {
185185
console.log(response);
186-
$("#platform").text(response.name);
186+
$("#platform").text(response.platform);
187187
},
188188
error: function (err) {
189189
console.log(err);

src/test/java/com/github/rawsanj/config/RuntimeHintsConfigTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.github.rawsanj.model.ChatMessage;
44
import com.github.rawsanj.model.Message;
5-
import com.github.rawsanj.model.Platform;
65
import org.junit.jupiter.api.Test;
76
import org.springframework.aot.hint.RuntimeHints;
87
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
@@ -16,7 +15,6 @@ void registerHintsTest() {
1615
RuntimeHints hints = new RuntimeHints();
1716
new RuntimeHintsConfig.SerdeRuntimeHints().registerHints(hints, getClass().getClassLoader());
1817
assertThat(RuntimeHintsPredicates.serialization().onType(ChatMessage.class)).accepts(hints);
19-
assertThat(RuntimeHintsPredicates.serialization().onType(Message.class)).accepts(hints);
20-
assertThat(RuntimeHintsPredicates.serialization().onType(Platform.class)).accepts(hints);
18+
assertThat(RuntimeHintsPredicates.serialization().onType(Message.class)).accepts(hints);;
2119
}
2220
}

system.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)