简体   繁体   English

JHipster - 如何在微服务架构中仅在 Eclipse 中调试一个网关(或微服务)?

[英]JHipster - How to debug in Eclipse only one gateway (or microservice) in a microservices architecture?

Assuming that with JHipster I've generated: - 1 Gateway (with MongoDB + JHipsterRegistry) - 3 Microservices [called A, B and C] (with MongoDB + JHipsterRegistry)假设我使用 JHipster 生成: - 1 个网关(使用 MongoDB + JHipsterRegistry) - 3 个微服务 [称为 A、B 和 C](使用 MongoDB + JHipsterRegistry)

I'm using maven.我正在使用 Maven。

I've composed all in Docker, so the resulting Docker configuration is:我已经在 Docker 中编写了所有内容,因此生成的 Docker 配置是:

  • 1 JHipster Registry 1 JHipster 注册表
  • 1 Gateway 1个网关
  • 1 Gateway MongoDB 1 网关 MongoDB
  • 1 Microservice A 1 微服务 A
  • 1 Microservice A MongoDB 1 微服务 A MongoDB
  • 1 Microservice B 1 微服务B
  • 1 Microservice B MongoDB 1 微服务 B MongoDB
  • 1 Microservice C 1 微服务 C
  • 1 Microservice C MongoDB 1 微服务 C MongoDB

All works fine: from the Gateway I can see entities from each Microservice.一切正常:从网关我可以看到来自每个微服务的实体。

Now I need to implement some features on Gateway (UI pages etc), and I need to debug with Eclipse during development.现在我需要在网关(UI 页面等)上实现一些功能,并且我需要在开发过程中使用 Eclipse 进行调试。

How can I achieve this?我怎样才能做到这一点?

A) Do I need to run all manually, so running: A)我是否需要手动全部运行,所以运行:

  • all components manually with ./mvnw使用 ./mvnw 手动所有组件
  • the JHipsterRegistry from a .jar .jar 中的 JHipsterRegistry
  • the Gateway from Eclipse running the debugger executing the main Application来自 Eclipse 的网关运行调试器执行主应用程序

B) Or can I use somehow docker for all "static" components and run only the Gateway from eclipse? B) 或者我可以以某种方式对所有“静态”组件使用 docker 并且只从 eclipse 运行网关?

C) Any other suggestion? C) 还有其他建议吗?

If (A):如果一个):

  • I need to start also all MongoDB manually?我还需要手动启动所有 MongoDB 吗?
  • How?如何?
  • May the used ports collide?使用的端口可能会冲突吗?
  • Do I need to change configurations?我需要更改配置吗?

If (B):如果(B):

  • How to run all "static" components in docker?如何在 docker 中运行所有“静态”组件?
  • How to configure the Gateway to reach other components?如何配置网关以访问其他组件?

I did something similar as follows, duplicate your docker-compose directory我做了如下类似的事情,复制你的docker-compose目录
create docker-compose-dev创建docker-compose-dev

edit the new docker-compose.yml remove the gateway service编辑新docker-compose.yml删除网关服务

edit your hosts file create an entry as follows:编辑您的主机文件,创建一个条目,如下所示:
127.0.0.1 jhipster-registry

run this setup docker compose up -d运行此设置docker compose up -d
It should start without issues then you can run your gateway它应该开始没有问题然后你可以运行你的网关
from the command line terminals using mvnw and npm start从命令行终端使用mvnwnpm start

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM