[ch6331] | Abhishek | Add health checks
This commit is contained in:
@@ -37,7 +37,29 @@
|
||||
"endpoint": "$SERVICE_ENDPOINT"
|
||||
}
|
||||
],
|
||||
"allowEgress": []
|
||||
"allowEgress": [],
|
||||
"healthChecks": {
|
||||
"readinessCheck": {
|
||||
"type": "http",
|
||||
"port": "serviceport",
|
||||
"path": "/health",
|
||||
"successThreshold": 1,
|
||||
"initialDelaySeconds": 90,
|
||||
"periodSeconds": 30,
|
||||
"failureThreshold": 3,
|
||||
"httpHeaders": []
|
||||
},
|
||||
"livenessCheck": {
|
||||
"type": "http",
|
||||
"port": "metrics",
|
||||
"path": "/actuator/health",
|
||||
"successThreshold": 1,
|
||||
"initialDelaySeconds": 90,
|
||||
"periodSeconds": 30,
|
||||
"failureThreshold": 3,
|
||||
"httpHeaders": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"extraResources": {
|
||||
"environment": "$ENVIRONMENT",
|
||||
|
||||
@@ -6,7 +6,8 @@ services:
|
||||
depends_on:
|
||||
- postgres
|
||||
ports:
|
||||
- 9090:9090
|
||||
- 8090:8080
|
||||
- 4001:4001
|
||||
|
||||
deployment_portal_frontend_service:
|
||||
build: ../deployment-portal-frontend
|
||||
|
||||
31
pom.xml
31
pom.xml
@@ -57,6 +57,32 @@
|
||||
<artifactId>json-schema-validator</artifactId>
|
||||
<version>2.2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
<version>2.2.4.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-core</artifactId>
|
||||
<version>1.3.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-prometheus</artifactId>
|
||||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>lombok</artifactId>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>logstash-logback-encoder</artifactId>
|
||||
<groupId>net.logstash.logback</groupId>
|
||||
<version>6.2</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.github.fge/jackson-coreutils -->
|
||||
<dependency>
|
||||
<groupId>com.github.fge</groupId>
|
||||
@@ -108,11 +134,6 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.okta.spring</groupId>-->
|
||||
<!-- <artifactId>okta-spring-boot-starter</artifactId>-->
|
||||
|
||||
16
src/main/java/com/DeploymentPortal/api/LoginController.java
Normal file
16
src/main/java/com/DeploymentPortal/api/LoginController.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.DeploymentPortal.api;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class LoginController {
|
||||
|
||||
@GetMapping("/health")
|
||||
public String health() {
|
||||
log.info("Status is healthy");
|
||||
return "Healthy";
|
||||
}
|
||||
}
|
||||
@@ -22,13 +22,11 @@ class OktaOAuth2WebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapte
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.csrf().disable()
|
||||
.cors()
|
||||
.and()
|
||||
.authorizeRequests()
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
.oauth2ResourceServer().jwt();
|
||||
http.csrf().disable().cors()
|
||||
.and().authorizeRequests()
|
||||
.mvcMatchers("/actuator","/actuator/*","/health")
|
||||
.permitAll()
|
||||
.anyRequest().authenticated();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,14 @@ spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect
|
||||
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
|
||||
spring.jpa.show-sql=true
|
||||
spring.jpa.properties.hibernate.format_sql=true
|
||||
server.port=9090
|
||||
server.port=8080
|
||||
#security.oauth2.resource.jwk.key-set-uri=https://btech-christuniversity.okta.com/oauth2/v1/keys
|
||||
spring.main.allow.bean-definition-overriding=true
|
||||
#okta.oauth2.localTokenValidation=false
|
||||
#okta.oauth2.localTokenValidation=false
|
||||
|
||||
#Metrics related configurations
|
||||
management.endpoint.metrics.enabled=true
|
||||
management.endpoints.web.exposure.include=*
|
||||
management.endpoint.prometheus.enabled=true
|
||||
management.metrics.export.prometheus.enabled=true
|
||||
management.server.port=4001
|
||||
@@ -7,11 +7,18 @@ spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect
|
||||
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
|
||||
spring.jpa.show-sql=true
|
||||
spring.jpa.properties.hibernate.format_sql=true
|
||||
server.port=9090
|
||||
server.port=8080
|
||||
#spring.main.allow.bean-definition-overriding=true
|
||||
#security.oauth2.resource.jwk.key-set-uri=https://btech-christuniversity.okta.com/oauth2/v1/keys
|
||||
#okta.oauth2.audience=http://localhost:8080
|
||||
|
||||
#okta.oauth2.groups-claim=groups
|
||||
#okta.oauth2.redirect-uri=/authorization-code/callback
|
||||
#okta.oauth2.localTokenValidation=false
|
||||
#okta.oauth2.localTokenValidation=false
|
||||
|
||||
#Metrics related configurations
|
||||
management.endpoint.metrics.enabled=true
|
||||
management.endpoints.web.exposure.include=*
|
||||
management.endpoint.prometheus.enabled=true
|
||||
management.metrics.export.prometheus.enabled=true
|
||||
management.server.port=4001
|
||||
Reference in New Issue
Block a user