From 89052b4284ab315521c38ccf9dfcc630594b3640 Mon Sep 17 00:00:00 2001 From: Trey Chadick Date: Fri, 5 Jan 2024 15:57:38 -0800 Subject: [PATCH] Tweak spring boot properties to allow access to management endpoints (#664) --- server/configs/application.properties | 3 +++ server/embedded/src/org/labkey/embedded/LabKeyServer.java | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server/configs/application.properties b/server/configs/application.properties index 1c82a5030c..320916364b 100644 --- a/server/configs/application.properties +++ b/server/configs/application.properties @@ -46,6 +46,9 @@ mail.smtpUser=@@smtpUser@@ #useLocalBuild#spring.devtools.restart.additional-paths=@@pathToServer@@/build/deploy/modules,@@pathToServer@@/build/deploy/embedded/config +# Make management endpoints accessible with LabKey at ROOT context path +server.servlet.context-path=/actuator +management.endpoints.web.base-path=/ #Enable shutdown endpoint management.endpoint.shutdown.enabled=true # turn off other endpoints diff --git a/server/embedded/src/org/labkey/embedded/LabKeyServer.java b/server/embedded/src/org/labkey/embedded/LabKeyServer.java index 7564446086..ae6d1c33bd 100644 --- a/server/embedded/src/org/labkey/embedded/LabKeyServer.java +++ b/server/embedded/src/org/labkey/embedded/LabKeyServer.java @@ -11,6 +11,7 @@ import org.labkey.filters.ContentSecurityPolicyFilter; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.ApplicationPidFileWriter; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.embedded.tomcat.TomcatWebServer; @@ -56,7 +57,9 @@ public static void main(String[] args) System.setProperty(TERMINATE_ON_STARTUP_FAILURE, "true"); } - SpringApplication.run(LabKeyServer.class, args); + SpringApplication application = new SpringApplication(LabKeyServer.class); + application.addListeners(new ApplicationPidFileWriter("./labkey.pid")); + application.run(args); } @Bean