Spring Boot Admin не разрешает URL-адреса для исправности и управления - PullRequest
0 голосов
/ 12 сентября 2018
  • Версия Spring: 5.0.8.RELEASE
  • Версия зависимостей загрузки Spring: 2.0.4.RELEASE
  • Версия Java: 1.8.0_131

Spring Boot Admin сообщает, что клиент не работает.Однако я вижу, что клиент работает, перейдя к нему в браузере.В подробном представлении для клиента в Sprint Boot Admin сообщение в разделе работоспособности выглядит так: «Не удалось получить исправность, ошибка сети».В заголовке страницы сведений отображаются три URL-адреса:

http://localhost:8090/WorkOrderPrinting
http://localhost:8090/WorkOrderPrinting/manage
http://localhost:8090/WorkOrderPrinting/manage/health

Нажатие на них открывает соответствующие представления.Вот вывод из состояния работоспособности:

{"status":"UP","details":{"diskSpace":{"status":"UP","details":{"total":80482930688,"free":77726302208,"threshold":10485760}},"db":{"status":"UP","details":{"tenantRoutingDataSource":{"status":"UP","details":{"database":"Informix Dynamic Server","hello":104}},"userSetTenantRoutingDS":{"status":"UP","details":{"database":"Informix Dynamic Server","hello":104}},"dataSourceCbCommon":{"status":"UP","details":{"database":"Informix Dynamic Server","hello":104}},"dataSourceCbOrg":{"status":"UP","details":{"database":"Informix Dynamic Server","hello":104}}}}}}

Кажется, он говорит мне, что клиентское приложение запущено и работает.Поэтому я не уверен, почему пользовательский интерфейс Sprint Boot Admin не отражает это.

У меня есть второе приложение, работающее как клиент, и оно работает как положено.Результат работоспособности URL такой же.

{"status":"UP","details":{"diskSpace":{"status":"UP","details":{"total":80482930688,"free":77726248960,"threshold":10485760}},"db":{"status":"UP","details":{"tenantRoutingDataSource":{"status":"UP","details":{"database":"Informix Dynamic Server","hello":104}},"userSetTenantRoutingDS":{"status":"UP","details":{"database":"Informix Dynamic Server","hello":104}},"dataSourceCbCommon":{"status":"UP","details":{"database":"Informix Dynamic Server","hello":104}},"dataSourceCbOrg":{"status":"UP","details":{"database":"Informix Dynamic Server","hello":104}}}}}}

В журнале Spring Boot Admin Server эта ошибка отображается для печати рабочих заданий.Опять же, не уверен, почему URL-адреса работают, но журнал показывает ошибку.

2018-09-13 09:19:19.071 DEBUG 5208 --- [     parallel-2] d.c.b.a.server.services.StatusUpdater    : Update status for Instance(id=6212ad7c5ab4, version=1, registration=Registration(name=Work Order Printing Development, managementUrl=http://localhost:8090/WorkOrderPrinting/manage, healthUrl=http://localhost:8090/WorkOrderPrinting/manage/health, serviceUrl=http://localhost:8090/WorkOrderPrinting, source=http-api), registered=true, statusInfo=StatusInfo(status=DOWN, details={error=Found, status=302}), statusTimestamp=2018-09-13T13:15:08.169Z, info=Info(values={}), endpoints=Endpoints(endpoints={health=Endpoint(id=health, url=http://localhost:8090/WorkOrderPrinting/manage/health)}), buildVersion=null)

Конфигурация Spring Boot Admin Server

server.servlet.context-path=/adminserver
logging.file=/var/log/eti/webui/adminserver.log
logging.level.de.codecentric.boot.admin.server=INFO

Конфигурация сбойного клиента

    #Admin Panel config
    #
    #This is the URL for the admin panel that this application will send its information to
    spring.boot.admin.client.url=http://localhost:8080/adminserver
    #This is required when deploying to Tomcat because the Admin panel cant seem to determine what the URL will be on its own 
    spring.boot.admin.client.instance.service-base-url=http://localhost:8090
    #This is the name that will be displayed in the admin panel for this application
    spring.boot.admin.client.instance.name=Work Order Printing
    # 
    spring.boot.admin.auto-registration=true
    #
    #Actuator config needed to expose endpoints to admin panel
    #
    management.endpoints.web.base-path=/manage
    management.endpoints.web.exposure.include:*
    management.endpoint.health.show-details=always

Конфигурация рабочего клиента

    #Admin Panel config
    #
    #This is the URL for the admin panel that this application will send its information to
    spring.boot.admin.client.url=http://localhost:8080/adminserver
    #This is required when deploying to Tomcat because the Admin panel cant seem to determine what the URL will be on its own 
    spring.boot.admin.client.instance.service-base-url=http://localhost:8085
    #This is the name that will be displayed in the admin panel for this application
    spring.boot.admin.client.instance.name=LaunchPad
    spring.boot.admin.auto-registration=true
    #
    #Actuator config needed to expose endpoints to admin panel
    #
    management.endpoints.web.base-path=/manage
    management.endpoints.web.exposure.include:*
    management.endpoint.health.show-details=always

1 Ответ

0 голосов
/ 13 сентября 2018

Таким образом, проблема оказалась проблемой конфигурации с моей стороны.Журнал Admin Server показывает следующее:

2018-09-13 09:19:19.071 DEBUG 5208 --- [     parallel-2] d.c.b.a.server.services.StatusUpdater    : Update status for Instance(id=6212ad7c5ab4, version=1, registration=Registration(name=Work Order Printing Development, managementUrl=http://localhost:8090/WorkOrderPrinting/manage, healthUrl=http://localhost:8090/WorkOrderPrinting/manage/health, serviceUrl=http://localhost:8090/WorkOrderPrinting, source=http-api), registered=true, statusInfo=StatusInfo(status=DOWN, details={error=Found, status=302}), statusTimestamp=2018-09-13T13:15:08.169Z, info=Info(values={}), endpoints=Endpoints(endpoints={health=Endpoint(id=health, url=http://localhost:8090/WorkOrderPrinting/manage/health)}), buildVersion=null)

В основном говорится, что происходит 302 (перенаправление), поэтому он не может достичь URL.Причина этого в том, что я забыл разрешить доступ к URL-адресам в конфигурации Spring Security.Я мог получить их с помощью браузера, потому что я вошел в систему. Spring Boot Admin не смог, потому что он не вошел в систему.

Я добавил правило, разрешающее доступ к / manage / urls

 public void configure(WebSecurity web) throws Exception
{
    web.ignoring().antMatchers("/css/**", "/fonts/**", "/img/**", "/js/**", "/close", "/webjars/**", "/manage/**");
}
...