Eureka service UP, SBA DOWN - spring-boot-admin

I user SBA as discovery client (spring-boot-admin.version 2.1.5) to Eureka server. I see a registered application UP in Eureka server, but the same is DOWN on SBA.SBA app
These is my application.yml
spring:
application:
name: spring-boot-admin-sample-eureka
profiles:
active:
- secure
server:
port : 8091
tag::configuration-eureka[]
eureka: #<1>
instance:
leaseRenewalIntervalInSeconds: 10
statusPageUrlPath: /actuator/info
health-check-url-path: /actuator/health
metadata-map:
startup: ${random.int} #needed to trigger info and endpoint update after restart
management.context-path: /monitor-client/actuator
client:
registryFetchIntervalSeconds: 5
registerWithEureka: false
serviceUrl:
defaultZone: http://localhost:8761/ServicesRepository/eureka
management:
endpoints:
web:
exposure:
include: "*" #<2>
endpoint:
health:
show-details: ALWAYS
security:
enabled: false
end::configuration-eureka[]
spring:
profiles: insecure
spring:
profiles: secure
security:
user:
name: "user"
password: "password"
eureka:
instance:
metadata-map:
user.name: "user" #These two are needed so that the server
user.password: "password" #can access the protected client endpoints
spring:
boot:
admin:
client:
username: user
password: password
instance:
metadata:
user.name: user
user.password: password
Always show details in Health check section
management:
endpoint:
health:
show-details: "ALWAYS"
endpoints:
web:
exposure:
include: "*"

Related

Jhipster Registry Logs Menu not shho in admin menu

In my fresh Jhipster Registry 7.0.4 launch with jar application from github (with dev profile), I can see the logs menu (and all other).
I apply the default configuration files.
Application-dev.yml:
spring:
devtools:
restart:
enabled: false
livereload:
enabled: false
mail:
host: localhost
port: 25
username:
password:
security:
user:
name: admin
password: admin
role: USER,ADMIN
server:
port: 9762
compression:
enabled: true
mime-types: text/html,text/xml,text/plain,text/css, application/javascript, application/json
min-response-size: 1024
eureka:
client:
service-url:
defaultZone: http://admin:admin#localhost:9762/eureka
logging:
file: logs/jhipster-registry.log
level:
ROOT: INFO
io.github.jhipster: INFO
io.github.jhipster.registry: INFO
jhipster:
http:
cache: # Used by the CachingHttpHeadersFilter
timeToLiveInDays: 1461
security:
authentication:
jwt:
token-validity-in-seconds: 86400
token-validity-in-seconds-for-remember-me: 2592000
mail: # specific JHipster mail property, for standard properties see MailProperties
from: JHipsterRegistry#localhost
base-url: http://my-server-url-to-change # Modify according to your server's URL
logging:
logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration
enabled: false
host: localhost
port: 5000
queue-size: 512
cache:
hazelcast:
# application:
registry is OK I can use it but I can't see and configure log level of jhipster of any module registered. How can I see them ?

Netflix Eureka and Spring Boot Admin in one application, not showing clients

i'm trying to add Spring Boot Admin to my Eureka Server, but it looks like there is something wrong somewhere.
I'm using
Spring Boot version 2.1.5.RELEASE (starter parent)
spring-cloud-starter-netflix-eureka-server
spring-boot-admin-starter-server
My Main Class is annotated with
#SpringBootApplication
#EnableAdminServer
#EnableEurekaServer
And this is the application.yml
spring:
application:
name: eureka-server
boot:
admin:
context-path: /admin
security:
basic:
enabled: false
management:
security:
enabled: false
eureka:
client:
register-with-eureka: false
fetch-registry: true
instance:
leaseRenewalIntervalInSeconds: 15
After i started the server, i try to launch a microservice
The application.yaml go the client is the following:
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
leaseExpirationDurationInSeconds: 5
client:
service-url:
default-zone: http://localhost:8761/eureka
healthcheck:
enabled: true
lease:
duration: 5
management:
endpoints:
web:
exposure:
include: '*'
security:
enabled: false
but i see it in eureka as down
and i cannot see anything in SBA

Configure Eureka Server and client with custom port and address

I have a Eureka Server running on default localhost host and port 8761, so i tried to change this default configuration in this way:
server:
port: 6000
servlet:
context-path: /myeureka
eureka:
client:
register-with-eureka: false
fetch-registry: false
But in this way i can't access eureka dashboard, just using default configuration:
server:
port: 8761
eureka:
client:
register-with-eureka: false
fetch-registry: false
In my client same thing occurrs, i can't point to another eureka server different from default (localhost:8761), see my configuration:
server:
port: 7000
servlet:
context-path: /client-eureka
spring:
application:
name: client-eureka
eureka:
instance:
prefer-ip-address: true
client:
eureka-server-port: 6000
eureka-server-u-r-l-context: /myeureka
Lookin in client log i got the following:
2018-09-01 09:19:37.175 INFO 4931 --- [ main] c.n.eureka.cluster.PeerEurekaNodes : Replica node URL: http://localhost:8761/eureka/
No matter what port or host i configure in client, always try to reach the default.
Important:
I'm using eureka in this version: https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-netflix-eureka-server/2.0.1.RELEASE
I used the same dependency version as yours and cannot find the config path server.servlet.contextpath
Instead, you can use either server.servlet-path or server.context-path
With each of the server configuration, you need to update your client application.yml file too. Remember that /eureka is the default REST endpoint used to register Eureka client with Eureka server
Case 1: Use server.servlet-path
Eureka Server:
server:
port: 7000
servlet-path: /myeureka
eureka:
client:
register-with-eureka: false
fetch-registry: false
Eureka Client:
spring:
application:
name: spring-cloud-eureka-client
server:
port: 0
eureka:
client:
service-url:
defaultZone: ${EUREKA_URI:http://localhost:7000/eureka}
instance:
preferIpAddress: true
Case 2: Use server.context-path
Eureka Server:
server:
port: 7000
context-path: /myeureka
eureka:
client:
register-with-eureka: false
fetch-registry: false
Eureka Client:
spring:
application:
name: spring-cloud-eureka-client
server:
port: 0
eureka:
client:
service-url:
defaultZone: ${EUREKA_URI:http://localhost:7000/myeureka/eureka}
instance:
preferIpAddress: true
Updated answer:
Because server.servlet-path and server.context-path were deprecated, eureka server will be configured as following:
server:
port: 7000
servlet:
context-path: /myeureka
eureka:
client:
register-with-eureka: false
fetch-registry: false
Eureka client application.yml will be kept as in Case 2.

Unable to run Spring Cloud Config-Server in Eureka First Bootstrap mode

*****Config Server- Application Service Setup*****
Below is the configuration from application.yml
server:
port: 8882
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
spring:
cloud:
config:
server:
git:uri: https://github.com/appleman/config
Below is the configuration from boostrap.yml
spring:
application:
name: configserver
Starting of this plain spring boot application registers config-server to Eureka.
**General Eureka Server is running on 8761 port
********Below is the Application Client configuration*****
Below is the Application Client configuration in my bootstrap.yml
spring:
application:
name: contractService,envDEV13
cloud:
config:
enabled: true
discovery:
enabled: true
serviceId: configserver
eureka:
instance:
nonSecurePort: ${server.port:8080}
client:
serviceUrl:
defaultZone: http://${eureka.host:localhost}:${eureka.port:8761}/eureka/
Injection of properties in Spring Controller like the below snippet is not working.
#Value("${creditService.eppDbUrl}")
String bar;
Please suggest us if we are doing anything wrong.

Using spring config server with git causing security group issue

I am now trying to set up using spring config server / spring config client and eureka server to do service discovery together. when I was using local file system to save configuration, everything is fine, but as soon as I change to gitHub to save configuration, I can not start spring config client, and I got this error message:
com.netflix.discovery.DiscoveryClient : Can't get a response from http://user:{cipher}AQBdTe9vjgOqANyfi+Ke5HYmhFJnuvsGJ+8FOqLgdMdFInJkVRzy9XngylNp9KlX2lwPI13jT7ceDjBs9w4B6A15akQTHHP1q9rWwMcLtVCCKGFgvXSgQF+WWIItxBmIDGG4bSgDYZ6XQWl66T84PxjTBygErpmAjn+X2BWdtWtVmjXzpMQMaHGpiyLPoGIQYF4j9ZGpl16Jx79+j6et6LStksrT3WxQuanhZwIkqZ827+2mlUB3kd5ocW7R0vC3JMGVZlGNfqYQwJIhSJ19lrq4gxm/zbGroYonW3QSHTiRlhlvOdovEua/0dCl6+s0iEHYZCBllr7jikEWmS5Px7U2TG8/eQkjR8pUbSN6OE+OI2ZZUCNOT+mi75ZeeN1OtdQ=#localhost:8761/eureka/null
Can't contact any eureka nodes - possibly a security group issue?
java.lang.IllegalArgumentException: Illegal character in authority at index 7: http://user:{cipher}AQBdTe9vjgOqANyfi+Ke5HYmhFJnuvsGJ+8FOqLgdMdFInJkVRzy9XngylNp9KlX2lwPI13jT7ceDjBs9w4B6A15akQTHHP1q9rWwMcLtVCCKGFgvXSgQF+WWIItxBmIDGG4bSgDYZ6XQWl66T84PxjTBygErpmAjn+X2BWdtWtVmjXzpMQMaHGpiyLPoGIQYF4j9ZGpl16Jx79+j6et6LStksrT3WxQuanhZwIkqZ827+2mlUB3kd5ocW7R0vC3JMGVZlGNfqYQwJIhSJ19lrq4gxm/zbGroYonW3QSHTiRlhlvOdovEua/0dCl6+s0iEHYZCBllr7jikEWmS5Px7U2TG8/eQkjR8pUbSN6OE+OI2ZZUCNOT+mi75ZeeN1OtdQ=#localhost:8761/eureka/
at java.net.URI.create(URI.java:852)
This is what I have:
In cofig server application.yml:
spring:
application:
name: spirent-config-server
cloud:
config:
server:
git:
uri: https://github.com/spring-cloud-samples/config-repo
#searchPaths: foo,bar*
server:
port: 8888
in config client:
bootstrap.properties:
spring.application.name= foo
spring.profiles.active= development
spring.cloud.config.uri= http://localhost:8888
and application.yml
eureka:
instance:
hostname: ${host.instance.name:frank1}
nonSecurePort: ${host.instance.port:8080}
metadataMap:
instanceId: ${host.instance.instanceid:frank_123}
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
server:
port: ${host.instance.port:8080}
Eureka Server:
application.yml
server:
port: 8761
eureka:
client:
registerWithEureka: false
fetchRegistry: false
server:
waitTimeInMsWhenSyncEmpty: 0
bootstrap.yml:
spring:
application:
name: eureka
cloud:
config:
uri: ${CONFIG_SERVER_URL:http://localhost:8888}
From the exception, it seemed it is because discoverClient is not working, anything special for the configuration?
But if I change from gitHub to local file storage for configuration, everything is fine.
Thanks for your suggestion in advance.
Based on the spring cloud document, I am doing like this:
In application.yml of config server:
spring:
application:
name: spirent-config-server
cloud:
config:
server:
git:
uri: https://github.com/spring-cloud-samples/config-repo
#searchPaths: foo,bar*
encrypt:
key: abc
server:
port: 8888
In application.yml of Eureka Server:
server:
port: 8761
eureka:
instance:
hostname: localhost
client:
registerWithEureka: false
fetchRegistry: false
serviceUrl:
defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
server:
waitTimeInMsWhenSyncEmpty: 0
encrypt:
key: abc
And in application.yml of config client:
eureka:
instance:
hostname: ${host.instance.name:frank1}
nonSecurePort: ${host.instance.port:8080}
leaseRenewalIntervalInSeconds: 5 #default is 30, recommended to keep default
metadataMap:
#instanceId: ${host.instance.instanceid:frank_123}
instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
server:
port: ${host.instance.port:8080}
encrypt:
key: abc
But, the problem is after I started Eureka an config server, it is fine, no exception, but after I started config client, I got this same exception:
Can't contact any eureka nodes - possibly a security group issue?
java.lang.IllegalArgumentException: Illegal character in authority at index 7: http://user:{cipher}AQBdTe9vjgOqANyfi+Ke5HYmhFJnuvsGJ+8FOqLgdMdFInJkVRzy9XngylNp9KlX2lwPI13jT7ceDjBs9w4B6A15akQTHHP1q9rWwMcLtVCCKGFgvXSgQF+WWIItxBmIDGG4bSgDYZ6XQWl66T84PxjTBygErpmAjn+X2BWdtWtVmjXzpMQMaHGpiyLPoGIQYF4j9ZGpl16Jx79+j6et6LStksrT3WxQuanhZwIkqZ827+2mlUB3kd5ocW7R0vC3JMGVZlGNfqYQwJIhSJ19lrq4gxm/zbGroYonW3QSHTiRlhlvOdovEua/0dCl6+s0iEHYZCBllr7jikEWmS5Px7U2TG8/eQkjR8pUbSN6OE+OI2ZZUCNOT+mi75ZeeN1OtdQ=#localhost:8761/eureka/
at java.net.URI.create(URI.java:852)
at com.sun.jersey.api.client.Client.resource(Client.java:433)
at com.netflix.discovery.DiscoveryClient.makeRemoteCall(DiscoveryClient.java:1091)
at com.netflix.discovery.DiscoveryClient.makeRemoteCall(DiscoveryClient.java:1060)
at com.netflix.discovery.DiscoveryClient.getAndStoreFullRegistry(DiscoveryClient.java:835)
Can anyone tell me where is my error? This only happened in using GIT as config server data source, but in local file data source, no error happened.
Thanks
These are my steps to try to resolve the key issues, but failed again:
download the "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files" from Oracle, and follow instructions for installation (essentially replace the 2 policy files in the JRE lib/security directory with the ones that you downloaded).
Now if I run spring encrypt mysecret --key foo, it is successful, this means the JCE is installed correctly;
Creating a Key Store for Testing: using this:
https://github.com/spring-cloud/spring-cloud-config/blob/master/docs/src/main/asciidoc/spring-cloud-config.adoc#creating-a-key-store-for-testing
after updating the application.yml in my config server, the application.yml is this:
spring:
application:
name: spirent-config-server
cloud:
config:
server:
git:
uri: https://github.com/spring-cloud-samples/config-repo
#searchPaths: foo,bar*
encrypt:
keyStore:
location: classpath:/server.jks
password: letmein
alias: abc
secret: changeme
key: abc
server:
port: 8888
adding this to both eureka server and config client application.yml:
encrypt:
key: abc
Run everything:
Result is same nasty error
So what is wrong is my testing? Thanks for your help
It is my fault:
Changing application.yml to this:
spring:
application:
name: configserver
encrypt:
failOnError: false
keyStore:
#location: classpath:keystore.jks
#password: ${KEYSTORE_PASSWORD:foobar} # don't use a default in production
#alias: test
location: classpath:server.jks
password: letmein
alias: mytestkey
secret: changeme
And then using this command to generate the file resolving the issue completely:
keytool -genkeypair -alias mytestkey -keyalg RSA \
-dname "CN=Web Server,OU=Unit,O=Organization,L=City,S=State,C=US" \
-keypass changeme -keystore server.jks -storepass letmein
Thanks