Skip to content

Commit

Permalink
build($Eureka): simplify Eureka configuration
Browse files Browse the repository at this point in the history
The difference between each every one of environments is
the
'eureka.client.serviceUrl.defaultZone'

instance-id:

${spring.cloud.client.hostname}:${spring.cloud.client.ip-address}:${server.port}

status-page-url-path:
/

BREAKING CHANGE: redefine 'instance-id'
  • Loading branch information
johnnymillergh committed May 15, 2020
1 parent 741261e commit b74c761
Show file tree
Hide file tree
Showing 21 changed files with 82 additions and 90 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://172.16.1.20:8760/eureka/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://localhost:8760/eureka/

Expand Down
13 changes: 13 additions & 0 deletions api-portal/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ spring:
# The default is 0. We set it as 0 too.
file-size-threshold: 0

eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
status-page-url-path: /
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
instance-id: ${spring.cloud.client.hostname}:${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true
client:
registryFetchIntervalSeconds: 5

feign:
client:
config:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://172.16.1.20:8760/eureka/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://localhost:8760/eureka/

Expand Down
13 changes: 13 additions & 0 deletions auth-center/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ spring:
# The default is 0. We set it as 0 too.
file-size-threshold: 0

eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
status-page-url-path: /
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
instance-id: ${spring.cloud.client.hostname}:${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true
client:
registryFetchIntervalSeconds: 5

feign:
client:
config:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://172.16.1.20:8760/eureka/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://localhost:8760/eureka/

Expand Down
13 changes: 13 additions & 0 deletions exercise-mis/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ spring:
# The default is 0. We set it as 0 too.
file-size-threshold: 0

eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
status-page-url-path: /
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
instance-id: ${spring.cloud.client.hostname}:${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true
client:
registryFetchIntervalSeconds: 5

feign:
client:
config:
Expand Down
7 changes: 0 additions & 7 deletions gateway/src/main/resources/application-development-docker.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://172.16.1.20:8760/eureka/

Expand Down
7 changes: 0 additions & 7 deletions gateway/src/main/resources/application-development-local.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://localhost:8760/eureka/

Expand Down
13 changes: 13 additions & 0 deletions gateway/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ spring:
enabled: true
lower-case-service-id: true

eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
status-page-url-path: /
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
instance-id: ${spring.cloud.client.hostname}:${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true
client:
registryFetchIntervalSeconds: 5

management:
endpoints:
web:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://172.16.1.20:8760/eureka/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://localhost:8760/eureka/

Expand Down
13 changes: 13 additions & 0 deletions muscle-mis/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ spring:
sampler:
probability: 1.0

eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
status-page-url-path: /
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
instance-id: ${spring.cloud.client.hostname}:${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true
client:
registryFetchIntervalSeconds: 5

feign:
client:
config:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
eureka:
instance:
prefer-ip-address: true
client:
service-url:
defaultZone: http://172.16.1.20:${server.port}/eureka/
defaultZone: http://${spring.cloud.client.ip-address}:${server.port}/eureka/
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
eureka:
instance:
hostname: localhost
client:
service-url:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
defaultZone: http://localhost:${server.port}/eureka/
2 changes: 2 additions & 0 deletions service-registry/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ spring:
time-zone: GMT+8

eureka:
instance:
prefer-ip-address: true
client:
register-with-eureka: false
fetch-registry: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://172.16.1.20:8760/eureka/
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: http://localhost:8760/eureka/
13 changes: 13 additions & 0 deletions spring-boot-admin/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ spring:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8

eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /actuator/health
status-page-url-path: /
metadata-map:
# needed to trigger info and endpoint update after restart
startup: ${random.int}
instance-id: ${spring.cloud.client.hostname}:${spring.cloud.client.ip-address}:${server.port}
prefer-ip-address: true
client:
registryFetchIntervalSeconds: 5

management:
endpoints:
web:
Expand Down

0 comments on commit b74c761

Please sign in to comment.