Comments (8)
I found that application get registered in Eureka with the docker container IP rather than the IP I have used in the configuration.
from steeltoe.
@Isuama :
I pushed a Fortune Teller sample solution that has Docker enabled that should help you understand how to set this up. The sample was created using the built-in Visual Studio tooling for Docker and Docker compose. I added the Eureka service to the docker compose file so it starts up when you run the Fortune Teller sample using Docker compose.
https://github.com/SteeltoeOSS/Samples/tree/dev/Discovery/src/AspDotNetCoreDocker
Hope that helps.
Dave
from steeltoe.
Thank you @dtillman. I guess what you have done was, exposing the same port inside the docker container and consuming the same port from outside.
What I have found out, it was an issue from Steeltoe Discover Client as it always takes the host IP rather than the ipAddress mentioned in yml. It doesn't make any sense registering the IP, but in our case we needed it badly.
If we run docker command with the -h it solves the problem. But it is a workaround for us until Steeltoe fixes that. Appreciate your response.
from steeltoe.
If you need to control what is registered in eureka, then you can set registrationMethod=hostName and then put a value in the hostName setting (DNS or IP address). That is what will end up getting registered in the eureka server and ultimately retrieved and used by the client.
As a FYI, in the sample I used docker-compose (DC) to run the FORTUNE-TELLER-UI, the FORTUNE-TELLER-SERVICE, and the Eureka server ( I just used a standard VS2017 project with Docker compose enabled).
DC creates a network with all those services running with-in it and makes networking very easy so you don't have to worry about the details. The DC network has a built-in hostname resolution service so all the registration/lookup happens on the DC network using names and addresses defined there. I also exposed each of the services(UI, eureka, etc) to the host using port mapping so you can access each container from a browser on the host. I probably could have not exposed the F-T-Service to the host since the communications from the UI to the F-T-Services is done on the DC network...but I elected to do so for testing.
Let me know if the above "hostName" doesn't work for you! Doc Link for registrationMethod
Dave
from steeltoe.
I also encountered the same problem.
from steeltoe.
If you need to control what is registered in eureka, then you can set registrationMethod=hostName and then put a value in the hostName setting (DNS or IP address). That is what will end up getting registered in the eureka server and ultimately retrieved and used by the client.
As a FYI, in the sample I used docker-compose (DC) to run the FORTUNE-TELLER-UI, the FORTUNE-TELLER-SERVICE, and the Eureka server ( I just used a standard VS2017 project with Docker compose enabled).
DC creates a network with all those services running with-in it and makes networking very easy so you don't have to worry about the details. The DC network has a built-in hostname resolution service so all the registration/lookup happens on the DC network using names and addresses defined there. I also exposed each of the services(UI, eureka, etc) to the host using port mapping so you can access each container from a browser on the host. I probably could have not exposed the F-T-Service to the host since the communications from the UI to the F-T-Services is done on the DC network...but I elected to do so for testing.
Let me know if the above "hostName" doesn't work for you! Doc Link for registrationMethod
Dave
Dear Dave, Could you please explain then why they have a property like preferIpAddress and ipAddress. As per my understanding if we set preferIpAddress =true and set an IP it should work, isn't it. But trust me, It doesn't work.
from steeltoe.
This is worth investigating further and trying to address in a later release.
from steeltoe.
I'm pretty confident this works as expected, after #1280 has been merged. I've added a test to verify:
[Fact]
public async Task ExplicitlyConfiguredIPAddressIsPreserved()
{
var appSettings = new Dictionary<string, string?>
{
["Eureka:Instance:hostName"] = "ignored-host-name",
["Eureka:Instance:ipAddress"] = "192.168.10.20",
["Eureka:Instance:preferIpAddress"] = "true"
};
WebApplicationBuilder builder = WebApplication.CreateBuilder();
builder.Configuration.AddInMemoryCollection(appSettings);
builder.Services.AddEurekaDiscoveryClient();
await using WebApplication webApplication = builder.Build();
var appManager = webApplication.Services.GetRequiredService<EurekaApplicationInfoManager>();
appManager.Instance.IPAddress.Should().Be("192.168.10.20");
appManager.Instance.HostName.Should().Be("192.168.10.20");
}
Please let me know if this is still causing problems.
from steeltoe.
Related Issues (20)
- Revisit Tracing integrations
- Mirror project readme into nugets
- Only the first label is being processed HOT 5
- [QUESTION] Using Microsoft.Extensions.Logging with Config Server HOT 2
- Libraries should have a strong name HOT 7
- System.InvalidOperationException: ValueFactory attempted to access the Value property of this instance HOT 2
- Schemas for Eureka should be extracted & become public HOT 1
- Implementation of Eureka LeaseInfo timestamp HOT 6
- Eureka service registration occurring for the wrong port. HOT 4
- Requests to /cloudfoundryapplication possibly return results for /actuator HOT 1
- Environment is being used rather than active profiles for config server HOT 2
- 2 step import not happening HOT 2
- Configuration properties sections are case sensitive HOT 6
- When eureka registration is occuring the app name is empty in the payload HOT 7
- Port information is not transferred as part of body request HOT 5
- Mappings endpoint should return parameters for url HOT 1
- Using steeltoe connectors with EasyNetQ is awkward. HOT 3
- V4 Connectors usage pattern is too intrusive HOT 3
- Implementation of distributed tracing
- Remove IFileProvider overload on ConfigureCertificateOptions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from steeltoe.