Skip to content

Commit

Permalink
fix the H2 console and the health endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
baixiac committed May 4, 2021
1 parent 59cadf4 commit d1644d0
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 45 deletions.
11 changes: 5 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ configurations {
bootWar {
mainClassName = 'org.radarbase.management.ManagementPortalApp'
launchScript()
// buildInfo()
}

springBoot {
Expand Down Expand Up @@ -177,7 +176,7 @@ dependencies {
implementation "org.hibernate:hibernate-validator:6.2.0.Final"
implementation("org.liquibase:liquibase-core:${liquibase_version}")
implementation "com.mattbertolini:liquibase-slf4j:${liquibase_slf4j_version}"
implementation "org.springframework.boot:spring-boot-actuator"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-autoconfigure"
implementation "org.springframework.boot:spring-boot-loader-tools"
implementation "org.springframework.boot:spring-boot-starter-mail"
Expand All @@ -199,12 +198,12 @@ dependencies {
implementation("org.springframework:spring-jdbc")
implementation "org.springframework.security:spring-security-config"
implementation "org.springframework.security:spring-security-data"
implementation ("org.springframework.security:spring-security-web"){
implementation ("org.springframework.security:spring-security-web") {
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'
}
implementation "org.springframework.security:spring-security-jwt:${spring_security_jwt_versions}"
implementation "org.springframework.security.oauth:spring-security-oauth2:${spring_security_oauth2_version}"
implementation "org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:${spring_security_oauth2_version}"
implementation "org.springframework.cloud:spring-cloud-starter-security"
implementation "org.springframework.cloud:spring-cloud-starter-oauth2"

implementation("io.springfox:springfox-swagger2:${springfox_version}") {
exclude module: 'mapstruct'
}
Expand Down
2 changes: 0 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ node_version=6.10.0
npm_version=4.3.0
prometheus_simpleclient_version=0.0.20
postgresql_version=42.2.14
spring_security_jwt_versions=1.1.1.RELEASE
spring_security_oauth2_version=2.3.8.RELEASE
springfox_version=2.6.1
spring_boot_version=2.3.7.RELEASE
gatling_version=3.3.1
Expand Down
1 change: 0 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
org.gradle.caching=true
org.gradle.parallel=true
8 changes: 4 additions & 4 deletions oauth-client-util/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ dependencies {
implementation group: 'com.fasterxml.jackson.core' , name: 'jackson-databind' , version: jacksonVersion
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: jacksonYamlVersion

testCompile group: 'junit', name: 'junit', version: junitVersion
testCompile group: 'com.github.tomakehurst', name: 'wiremock', version: '2.21.0'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.25.1'
testCompile 'org.glassfish.jersey.core:jersey-common:2.28'
testImplementation group: 'junit', name: 'junit', version: junitVersion
testImplementation group: 'com.github.tomakehurst', name: 'wiremock', version: '2.21.0'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '2.25.1'
testImplementation 'org.glassfish.jersey.core:jersey-common:2.28'
testRuntimeOnly group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.26'
}

Expand Down
8 changes: 4 additions & 4 deletions radar-auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repositories {
}

configurations {
testCompile.extendsFrom shadow
testImplementation.extendsFrom shadow
}

dependencies {
Expand All @@ -35,9 +35,9 @@ dependencies {
shadow group: 'com.fasterxml.jackson.core' , name: 'jackson-databind' , version: jacksonVersion
shadow group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: jacksonYamlVersion

testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'com.github.tomakehurst', name: 'wiremock', version: '2.21.0'
testCompile group: 'com.github.stefanbirkner', name: 'system-rules', version: '1.19.0'
testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation group: 'com.github.tomakehurst', name: 'wiremock', version: '2.21.0'
testImplementation group: 'com.github.stefanbirkner', name: 'system-rules', version: '1.19.0'

testRuntimeOnly group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public void configure(HttpSecurity http) throws Exception {
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
.antMatchers("/oauth/**").permitAll()
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
.antMatchers("/api/authenticate").permitAll()
.antMatchers("/api/register").hasAnyAuthority(AuthoritiesConstants.SYS_ADMIN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public ClassLoaderTemplateResolver emailTemplateResolver() {
ClassLoaderTemplateResolver emailTemplateResolver = new ClassLoaderTemplateResolver();
emailTemplateResolver.setPrefix("mails/");
emailTemplateResolver.setSuffix(".html");
emailTemplateResolver.setTemplateMode("HTML5");
emailTemplateResolver.setTemplateMode("HTML");
emailTemplateResolver.setCharacterEncoding(CharEncoding.UTF_8);
emailTemplateResolver.setOrder(1);
return emailTemplateResolver;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/.h2.server.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#H2 Server Properties
#Fri Jul 27 17:28:49 CEST 2018
#Tue May 04 09:21:28 BST 2021
0=JHipster H2 (Memory)|org.h2.Driver|jdbc\:h2\:mem\:managementportal|ManagementPortal
webAllowOthers=true
webPort=8082
Expand Down
26 changes: 14 additions & 12 deletions src/main/resources/config/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,29 @@ spring:
devtools:
restart:
enabled: true
exclude: .h2.server.properties,static/**,templates/**
livereload:
enabled: false # we use gulp + BrowserSync for livereload
jackson:
serialization.indent_output: true
datasource:
type: com.zaxxer.hikari.HikariDataSource
# url: jdbc:h2:mem:managementportal;DB_CLOSE_DELAY=-1
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/managementportal
# username: ManagementPortal
# password:
username: radarbase
password: radarbase
url: jdbc:h2:mem:managementportal;DB_CLOSE_DELAY=-1
username: ManagementPortal
password:
# driverClassName: org.postgresql.Driver
# url: jdbc:postgresql://localhost:5432/managementportal
# username: radarbase
# password: radarbase
h2:
console:
enabled: false
enabled: true
path: /h2-console
jpa:
# database-platform: org.hibernate.dialect.H2Dialect
database-platform: org.hibernate.dialect.PostgreSQLDialect
# database: H2
database: POSTGRESQL
database-platform: org.hibernate.dialect.H2Dialect
database: H2
# database-platform: org.hibernate.dialect.PostgreSQLDialect
# database: POSTGRESQL
show-sql: true
properties:
hibernate.id.new_generator_mappings: true
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/config/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
# ===================================================================
zuul:
sensitiveHeaders: Cookie,Set-Cookie
routes:
ManagementPortal:
oauth:
path: /oauthserver/oauth/**
url: http://localhost:8080/managementportal/oauth
spring:
Expand Down
21 changes: 12 additions & 9 deletions src/main/resources/config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
# ===================================================================
zuul:
sensitiveHeaders: Cookie,Set-Cookie
host:
max-total-connections: 1000
max-per-route-connections: 100
semaphore:
max-semaphores: 500
retryable: true
routes:
ManagementPortal:
oauth:
path: /oauthserver/oauth/**
url: http://localhost:8080/oauth
ribbon:
Expand All @@ -37,20 +38,22 @@ hystrix:
timeoutInMilliseconds: 60000

management:
security:
roles: ROLE_SYS_ADMIN
enabled: false # disabling security check for health to allow kubernetes to detect the health of the service
context-path: /management
endpoints:
web:
base-path: /management
endpoint:
health:
show-details: "ALWAYS"
health:
diskspace:
enabled: false # disabling diskspace as the standard config, since we have removed security check for health endpoint
mail:
enabled: false # When using the MailService, configure an SMTP server and set this to true
db:
datasource:
enabled: true
management:
endpoint:
metrics:
metrics:
export:
defaults:
enabled: false

spring:
Expand Down
4 changes: 0 additions & 4 deletions src/test/resources/config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ spring:
liquibase:
contexts: test

security:
basic:
enabled: false

server:
port: 10344
address: localhost
Expand Down

0 comments on commit d1644d0

Please sign in to comment.