Jhipster 控制中心不显示应用程序

问题描述 投票:0回答:2

我刚刚创建了一个新的 Jhipster 7.0.1 项目,我正在尝试使用 Jhipster 控制中心。

官方页面,它说:

一旦应用程序在服务器(consul 或 eureka)上注册,它就会 将在列表中可用。

我刚刚启动了我的所有微服务,它们都在 Jhipster 注册表中注册,但它们仍然没有显示在控制中心上。

我是不是忘记做某事了?我没有做任何额外的配置,只是创建项目并启动。

jhipster jhipster-registry
2个回答
1
投票

要使用 JHipster 控制中心,您必须编辑

src/main/docker/jhipster-control-center.yml
将其配置为使用您选择的发现服务(在您的情况下是带有 JHipster 注册表的 Eureka)。

说明在

jhipster-control-center.yml
文件注释中,您必须在
jhipster-control-center.yml
中设置2个环境变量,并从
ports
文件中的
jhipster-registry.yml
中删除“127.0.0.1:”前缀。


0
投票

此处不列出实例信息。我有 jhipster-registry 和 jhipster-control-center 通过 Docker 运行,我的测试服务通过 IntelliJ 运行。我以这种方式配置我的文件,基本上我更改了 EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE 变量以使用容器服务名称,因为它们都位于同一网络上。 jhipster-control-center 没有作为注册实例出现在 eureka 中。

jhipster-registry.yml

# This configuration is intended for development purpose, it's **your** responsibility to harden it for production
name: usuario
services:
  jhipster-registry:
    image: jhipster/jhipster-registry:v7.4.0
    volumes:
      - ./central-server-config:/central-config
    # When run with the "dev" Spring profile, the JHipster Registry will
    # read the config from the local filesystem (central-server-config directory)
    # When run with the "prod" Spring profile, it will read the configuration from a Git repository
    # See https://www.jhipster.tech/jhipster-registry/#spring-cloud-config
    environment:
      - _JAVA_OPTIONS=-Xmx512m -Xms256m
      - SPRING_PROFILES_ACTIVE=dev,api-docs
      - SPRING_SECURITY_USER_PASSWORD=admin
      - JHIPSTER_REGISTRY_PASSWORD=admin
      - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=native
      - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_LOCATIONS=file:./central-config/localhost-config/
      # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_TYPE=git
      # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_URI=https://github.com/jhipster/jhipster-registry/
      # - SPRING_CLOUD_CONFIG_SERVER_COMPOSITE_0_SEARCH_PATHS=central-config
    # If you want to expose these ports outside your dev PC,
    # remove the "127.0.0.1:" prefix
    ports:
      #- 127.0.0.1:8761:8761
      - 8761:8761
    healthcheck:
      test: ['CMD', 'curl', '-f', 'http://localhost:8761/management/health']
      interval: 5s
      timeout: 5s
      retries: 20

jhipster-control-center.yml

## How to use JHCC docker compose
# To allow JHCC to reach JHipster application from a docker container note that we set the host as host.docker.internal
# To reach the application from a browser, you need to add '127.0.0.1 host.docker.internal' to your hosts file.
### Discovery mode
# JHCC support 3 kinds of discovery mode: Consul, Eureka and static
# In order to use one, please set SPRING_PROFILES_ACTIVE to one (and only one) of this values: consul,eureka,static
### Discovery properties
# According to the discovery mode choose as Spring profile, you have to set the right properties
# please note that current properties are set to run JHCC with default values, personalize them if needed
# and remove those from other modes. You can only have one mode active.
#### Eureka
#       - EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE=http://admin:[email protected]:8761/eureka/
#### Consul
#       - SPRING_CLOUD_CONSUL_HOST=host.docker.internal
#       - SPRING_CLOUD_CONSUL_PORT=8500
#### Static
# Add instances to "MyApp"
#       - SPRING_CLOUD_DISCOVERY_CLIENT_SIMPLE_INSTANCES_MYAPP_0_URI=http://host.docker.internal:8081
#       - SPRING_CLOUD_DISCOVERY_CLIENT_SIMPLE_INSTANCES_MYAPP_1_URI=http://host.docker.internal:8082
# Or add a new application named MyNewApp
#       - SPRING_CLOUD_DISCOVERY_CLIENT_SIMPLE_INSTANCES_MYNEWAPP_0_URI=http://host.docker.internal:8080
# This configuration is intended for development purpose, it's **your** responsibility to harden it for production

#### IMPORTANT
# If you choose Consul or Eureka mode:
# Do not forget to remove the prefix "127.0.0.1" in front of their port in order to expose them.
# This is required because JHCC need to communicate with Consul or Eureka.
# - In Consul mode, the ports are in the consul.yml file.
# - In Eureka mode, the ports are in the jhipster-registry.yml file.

name: usuario
services:
  jhipster-control-center:
    image: 'jhipster/jhipster-control-center:v0.5.0'
    command:
      - /bin/sh
      - -c
      # Patch /etc/hosts to support resolving host.docker.internal to the internal IP address used by the host in all OSes
      - echo "`ip route | grep default | cut -d ' ' -f3` host.docker.internal" | tee -a /etc/hosts > /dev/null && java -jar /jhipster-control-center.jar
    environment:
      - _JAVA_OPTIONS=-Xmx512m -Xms256m
      #- SPRING_PROFILES_ACTIVE=prod,api-docs,none
      - SPRING_PROFILES_ACTIVE=dev,api-docs,none
      - SPRING_SECURITY_USER_PASSWORD=admin
      # The token should have the same value than the one declared in you Spring configuration under the jhipster.security.authentication.jwt.base64-secret configuration's entry
      - JHIPSTER_SECURITY_AUTHENTICATION_JWT_BASE64_SECRET=ZTAzMTRiYjlhMjY0YmU2ODJkNWViMGEzOTI0NjU5MWVhOTg1YzdkYzc3MTg1NDlhNWEyN2U4ZjA1MGQ2MTc2YTcwNzM4ZjJmMjkxOTVlZmYzODQ0NjE0NWY0ODBhZWNlNmEwNGNiOWQzNzA3ZjE4ZTY4ZDE5MDRiMDcxY2VjNGI=
      #- EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE=http://admin:[email protected]:8761/eureka/
      - EUREKA_CLIENT_SERVICE_URL_DEFAULTZONE=http://admin:admin@jhipster-registry:8761/eureka/      
      - LOGGING_FILE_NAME=/tmp/jhipster-control-center.log
    # If you want to expose these ports outside your dev PC,
    # remove the "127.0.0.1:" prefix
    ports:
      #- 127.0.0.1:7419:7419
      - 7419:7419
© www.soinside.com 2019 - 2024. All rights reserved.