Add service discovery and health fixes: configure Consul registration, update health-check paths and ports, expand scanBasePackages, and ensure consistent service startup across modules.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
spring:
|
||||
application:
|
||||
name: billing-service
|
||||
datasource:
|
||||
url: ${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/pg-meldestelle-db}
|
||||
username: ${SPRING_DATASOURCE_USERNAME:pg-user}
|
||||
password: ${SPRING_DATASOURCE_PASSWORD:pg-password}
|
||||
cloud:
|
||||
consul:
|
||||
host: ${CONSUL_HOST:localhost}
|
||||
port: ${CONSUL_PORT:8500}
|
||||
discovery:
|
||||
enabled: true
|
||||
register: true
|
||||
health-check-path: /actuator/health
|
||||
health-check-interval: 10s
|
||||
|
||||
server:
|
||||
port: ${SERVER_PORT:${BILLING_SERVICE_PORT:8087}}
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info,metrics,prometheus
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
+1
-1
@@ -11,7 +11,7 @@ fun main(args: Array<String>) {
|
||||
runApplication<EntriesServiceApplication>(*args)
|
||||
}
|
||||
|
||||
@SpringBootApplication(scanBasePackages = ["at.mocode.entries", "at.mocode.billing"])
|
||||
@SpringBootApplication(scanBasePackages = ["at.mocode.entries", "at.mocode.billing", "at.mocode.infrastructure.security"])
|
||||
@EnableAspectJAutoProxy
|
||||
class EntriesServiceApplication {
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ spring:
|
||||
discovery:
|
||||
enabled: true
|
||||
register: true
|
||||
prefer-ip-address: true
|
||||
health-check-path: /actuator/health
|
||||
health-check-interval: 10s
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ dependencies {
|
||||
implementation(libs.spring.boot.starter.validation)
|
||||
implementation(libs.spring.boot.starter.security)
|
||||
implementation(libs.spring.boot.starter.oauth2.resource.server)
|
||||
implementation(libs.spring.boot.starter.actuator)
|
||||
implementation(libs.spring.cloud.starter.consul.discovery)
|
||||
|
||||
implementation(libs.exposed.core)
|
||||
implementation(libs.exposed.jdbc)
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
server:
|
||||
port: ${SERVER_PORT:${IDENTITY_SERVICE_PORT:8088}}
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: identity-service
|
||||
datasource:
|
||||
url: ${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/pg-meldestelle-db}
|
||||
username: ${SPRING_DATASOURCE_USERNAME:pg-user}
|
||||
password: ${SPRING_DATASOURCE_PASSWORD:pg-password}
|
||||
cloud:
|
||||
consul:
|
||||
host: ${CONSUL_HOST:localhost}
|
||||
port: ${CONSUL_PORT:8500}
|
||||
discovery:
|
||||
enabled: true
|
||||
register: true
|
||||
prefer-ip-address: true
|
||||
health-check-path: /actuator/health
|
||||
health-check-interval: 10s
|
||||
security:
|
||||
oauth2:
|
||||
resourceserver:
|
||||
jwt:
|
||||
issuer-uri: ${SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI:http://localhost:8180/realms/meldestelle}
|
||||
jwk-set-uri: ${SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI:http://localhost:8180/realms/meldestelle/protocol/openid-connect/certs}
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info,metrics,prometheus
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
@@ -22,7 +22,7 @@ spring:
|
||||
prefer-ip-address: true # Nutze IP im Docker-Netzwerk
|
||||
health-check-path: /actuator/health
|
||||
health-check-interval: 10s
|
||||
health-check-port: ${server.port} # Health Check läuft auf Spring Port
|
||||
health-check-port: 8086 # Spring Boot Port (Tomcat), NICHT Ktor (8091)
|
||||
instance-id: ${spring.application.name}:${server.port}:${random.uuid}
|
||||
service-name: ${spring.application.name}
|
||||
port: ${masterdata.http.port} # Ktor API Port registrieren
|
||||
|
||||
@@ -19,13 +19,14 @@ spring:
|
||||
discovery:
|
||||
enabled: ${CONSUL_ENABLED:true}
|
||||
register: ${CONSUL_ENABLED:true}
|
||||
prefer-ip-address: true
|
||||
health-check-path: /actuator/health
|
||||
health-check-interval: 10s
|
||||
instance-id: ${spring.application.name}-${server.port}-${random.uuid}
|
||||
service-name: ${spring.application.name}
|
||||
|
||||
server:
|
||||
port: 8088
|
||||
port: ${SERVER_PORT:${RESULTS_SERVICE_PORT:8084}}
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
|
||||
Reference in New Issue
Block a user