Skip to content

Commit

Permalink
frontend2 including in monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Manna Mahmud committed May 22, 2021
1 parent a9b4f40 commit 71a429f
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 1 deletion.
1 change: 1 addition & 0 deletions edge/ha-swarm/apps-docker-compose-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ services:
extra_hosts:
- "www.mmfb.com:192.168.0.107" #add hostname to /etc/hosts file of docker
environment:
SPRING_CLOUD_CONSUL_HOST: consul-leader
SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_OIDC_ISSUER_URI: "https://www.mmfb.com/auth/realms/mmfb"
SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_OIDC_JWK_SET_URI: "https://www.mmfb.com/auth/realms/mmfb/protocol/openid-connect/certs"
SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_OIDC_REDIRECT_URI: "https://www.mmfb.com/app2/login/oauth2/code/{registrationId}"
Expand Down
12 changes: 12 additions & 0 deletions frontends/frontend2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@
<artifactId>spring-boot-starter-oauth2-client</artifactId>
</dependency>
<!-- END SECURITY -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

@Override
public void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().authenticated().and().oauth2Login();
http.authorizeRequests()
.antMatchers("/management/**").permitAll()
.anyRequest().authenticated().and().oauth2Login();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
server:
port: 8580
spring:
cloud:
consul:
discovery:
prefer-ip-address: true
host: localhost
port: 8500
security:
oauth2:
client:
Expand Down
49 changes: 49 additions & 0 deletions frontends/frontend2/src/main/resources/config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,55 @@ spring:
name: frontend2
profiles:
active: #spring.profiles.active#
cloud:
consul:
discovery:
healthCheckPath: /app2/management/health
instanceId: ${spring.application.name}:${spring.application.instance-id:${random.value}}
service-name: ${spring.application.name}
config:
watch:
enabled: false
management: #https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html
endpoints:
web:
base-path: /management
exposure:
include: ['configprops', 'env', 'health', 'info', 'logfile', 'loggers', 'prometheus', 'threaddump']
endpoint:
health:
show-details: always # when_authorized
# roles: 'ROLE_ADMIN'
info:
git:
mode: full
health:
mail:
enabled: false # When using the MailService, configure an SMTP server and set this to true
metrics:
export:
# Prometheus is the default metrics backend
prometheus:
enabled: true
step: 60
enable:
http: true
jvm: true
logback: true
process: true
system: true
distribution:
percentiles-histogram:
all: true
percentiles:
all: 0, 0.5, 0.75, 0.95, 0.99, 1.0
tags:
application: ${spring.application.name}
web:
server:
request:
autotime:
enabled: true
server:
port: 8580
servlet:
Expand Down

0 comments on commit 71a429f

Please sign in to comment.