Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

线下环境 portal 无法访问线上环境 meta service #5083

Closed
3 tasks done
revolyw opened this issue Jan 29, 2024 · 4 comments
Closed
3 tasks done

线下环境 portal 无法访问线上环境 meta service #5083

revolyw opened this issue Jan 29, 2024 · 4 comments

Comments

@revolyw
Copy link

revolyw commented Jan 29, 2024

描述bug

简洁明了地描述一下bug
由于 portal 部署了线下、线上两套环境,但是线下的 portal 在一部分 meta services 时会报错,而且由于健康检查的机制,虽然不影响功能,但是这个报错日志会不停地刷,影响开发调试,所以希望探讨一下如何优化,支持一下这种场景下的使用。
具体场景是:portal 部署了线下、线上两套环境,分别支持了 4 套 Envs(DEV、TEST、UAT、PRD),可以按部署逻辑分为两组:线下(DEV、TEST)、线上(UAT、PRD),线下线上对应的 meta service 不同且网络是不互通的(这是无法访问的原因)

复现

通过如下步骤可以复现:

  1. 部署 4 个 env:DEV、TEST、UAT、PRD 的 adminservice 和 configservice,DEV、TEST 用一个 meta service、UAT、PRD 用另一个 meta service ,网络不互通
  2. 部署一个 portal 和 DEV、TEST 所在环境网络互通
  3. 启动 portal

期望

简介明了地描述你希望正常情况下应该发生什么
不产生报错异常和堆栈日志

截图

如果可以,附上截图来描述你的问题

额外的细节和日志

  • 版本:1.8.6
  • 错误日志:见截图
  • 配置:无
  • 平台和操作系统:ubuntu 18.04.6 LTS
@revolyw
Copy link
Author

revolyw commented Jan 29, 2024

目前 portal 在线下线上部署时会有不同的环境参数,例如 spring.profiles.active。
因此我目前的想法是,针对线下环境,通过环境参数在加载 env 和健康检查时屏蔽掉现在的 env(UAT、PRD)
但是这样会使原来的代码变得复杂,所以我想知道是否有更好的办法满足这种场景

Copy link

dosubot bot commented Jan 29, 2024

🤖

Hello @revolyw! Great to see you again in the Apollo repository. Hope you're doing well and your projects are thriving. Let's dive into this issue you're facing.

Based on the scenario you've described, it seems that the issue lies in the configuration of the meta service URLs for each environment in the apollo-env.properties file. This file is used by Apollo to determine the correct meta service to connect to for each environment.

Given that your offline and online environments are not interconnected, you should ensure that the URLs for the meta services in the offline environment are correctly set in this file. For example, if the offline environment's meta service for the DEV environment is running at http://offline-dev-meta:8080, you should set dev.meta=http://offline-dev-meta:8080 in the apollo-env.properties file. Similarly, you should set the fat.meta, uat.meta, lpt.meta, and pro.meta properties to the correct URLs for the offline environment's meta services.

Here is an example of how you might modify the apollo-env.properties file:

local.meta=http://localhost:8080
dev.meta=http://offline-dev-meta:8080
fat.meta=http://offline-fat-meta:8080
uat.meta=http://offline-uat-meta:8080
lpt.meta=http://offline-lpt-meta:8080
pro.meta=http://offline-pro-meta:8080

This solution should not complicate the original code as it only involves modifying configuration files, not the code itself. You can find more information about this in the apollo-env.properties file in the Apollo repository.

Please try this solution and let me know if it resolves your issue or if you need further assistance.

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@nobodyiam
Copy link
Member

portal 线上和线下是两套环境的话,portal 数据库是一套还是两套?
如果 portal 数据库是一套,可以通过指定不同的 apollo.portal.envs 来让线下的 portal 只启用线下环境,线上的 portal 只启用线上环境。
如果 portal 数据库是两套,那就完全独立了,各自配置即可。

@revolyw
Copy link
Author

revolyw commented Jan 30, 2024

portal 线上和线下是两套环境的话,portal 数据库是一套还是两套? 如果 portal 数据库是一套,可以通过指定不同的 apollo.portal.envs 来让线下的 portal 只启用线下环境,线上的 portal 只启用线上环境。 如果 portal 数据库是两套,那就完全独立了,各自配置即可。

我的 portal 数据库是一套。 通过 apollo.portal.envs 满足了我的场景,谢谢您的解答。

@revolyw revolyw closed this as completed Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants