apolloconfig / apollo-quick-start

Apollo Quick Start
691 stars 1.85k forks source link

feat:(sh) Change apollo config `eureka.instance.ip-address` #102

Closed anigkus closed 1 year ago

anigkus commented 1 year ago

It is recommenbed that if you are useing default built-in registration center,add -Deureka.instance.ip-address=127.0.0.1 parameter. Because the current IP is used by default,it is currently the internal IP of the container(172.17.0.1/24), which is okay it can not be provided to outside calls. Useing scenarios such as (javasdk/openapi), it is vert useful to verify these functions. Because the RemoteConfigRepository in apollo-client uses the registration address of the service to send the request. Then get the relavant configuration infomation.

The log is as follows:

Success: Long polling from http://127.0.0.1:8080/notifications/v2?cluster=default&appId=SampleApp&ip=192.168.12.113&。。。

Fail: Long polling from http://172.17.0.3:8080/notifications/v2?cluster=default&appId=SampleApp&ip=192.168.12.113&。。。

Note

You need to rebuild the apollo-quick-start container.

docker build -t nobodyiam/apollo-quick-start . -f ./Dockerfile

nobodyiam commented 1 year ago

This is a valid point. However, I believe that changing the IP address to 127.0.0.1 directly may lead to some unforeseen issues. For instance, if the demo operates without Docker, it could be accessed by other machines within the same local area network, but this would no longer be possible after making the change. Additionally, in the Docker scenario, it is likely that apollo-portal would be unable to access apollo-adminservice.

Having said that, I still think we can make improvements. For example, we could add a demo configuration to the JAVA_OPTS section and include some explanatory comments.

anigkus commented 1 year ago

Okay,then you can only change the “docker-compose.yml “file.

stale[bot] commented 1 year ago

This pull request has been automatically marked as stale because it has not had activity in the last 21 days. It will be closed in 14 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

stale[bot] commented 1 year ago

This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!