-
Notifications
You must be signed in to change notification settings - Fork 467
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
Question: Accessing default port when starting RabbitMQ #2484
Comments
Why does it fail? |
Oh you might be running into #844. It's likely you're adding endpoints that already exist to a container and it's blowing up in the WithReference call. An exception and callstack would help pinpoint the issue. |
So the following is what I am currently trying (note: I have tried multiple permutations, this is the simplest): var testmq = builder.AddContainer("test-rabbit", "rabbitmq", "3-management")
.WithAnnotation(new EndpointAnnotation(ProtocolType.Tcp, port:5672, containerPort: 5672))
.WithAnnotation(new EndpointAnnotation(ProtocolType.Tcp, port: 15673, containerPort: 15672, uriScheme: "http"))
.WithEnvironment("RABBITMQ_DEFAULT_USER", "user")
.WithEnvironment("RABBITMQ_DEFAULT_PASS", "yourguessisasgoodasmine"); After a few secs RabbitMq fails. There is a lot going on in the logs but the following snippet seems relevant: ` ` |
That code works for me. Maybe you have another rabbitmq listening on the same port? |
Have tripled checked, no other instances running :-) |
What version of aspire are you using? |
8.0 preview-3 |
Not sure what else it could be here. |
Will keep investigating and will let you know if anything comes up |
@davidfowl I have created a sample project that demonstrates this which can be found here: |
In your example you are adding another endpoint to the existing rabbitmq container instead of changing the port of the existing endpoint. AddRabbitMQContainer has a parameter which is the host port, did you try setting that? |
Yes, tried that and dapr side-cars still failing (have updated the code to reflect that) |
I'm confused. I meant this: builder.AddRabbitMQContainer("messaging", password: "ThisIsAPassword", port: 5672); |
Tried that still no joy. Nor is there host/container port mapping defined in docker |
Try updating to preview 4 I have a hunch there are features that will make this scenario work better. |
Replace AddRabbitMQ with AddContainer. |
Have done this: builder.AddContainer("test-rabbit", "rabbitmq", "3-management")
.WithEnvironment("RABBITMQ_DEFAULT_PASS", "ThisIsAPassword")
.WithEnvironment("RABBITMQ_DEFAULT_USER", "user")
.WithEndpoint(scheme: "tcp", hostPort: 5672, containerPort: 5672, isProxied: false)
.WithEndpoint(scheme: "http", hostPort: 15672, containerPort:15672, isProxied: false); port assignments work, can access admin dashboard. Possibly the issue is with |
Is dapr still not working? cc @karolz-ms |
Short answer, no |
Is the error from the dapr sidecar different? |
To be honest I have be remiss in tracking them 😀. For reference the error message is below:
|
Okay, a couple of interesting side-notes: This is the more interesting one. if I copy the dapr run command from the Aspire console and run it in the command line it successfully runs.
|
@dbreshears I think we should investigate this for p5. I have a hunch this has to do with the DCP proxy and ipv4 and ipv6. We've seen similar issues #2855. |
@wtulloch could you share a repo/solution that demonstrates the problem? That would be super helpful. |
Moving to P6 |
I poked at this a bit; near as I can tell, the issue is down to the fact that the dapr RabbitMQ PubSub component doesn't support retry during dapr init. If the RabbitMQ server isn't already up and running by the time we run the dapr sidecar for an app, it'll error out. To make this work, it seems as though the RabbitMQ dapr component would need to be updated to support retry during initialization in order to connect once the PubSub instance becomes available during Aspire startup. |
@danegsta That is something that I considered. In the Dapr pubsub.yaml for RabbitMQ there is a reconnectWait which I tried but it didn't seem to make a difference. |
I have the same problem. Just for testing, I created another AppHost2 in the same solution and moved rabbitmq from AppHost1 to AppHost2. Then everything works fine (AppHost2 started first and when rabbitmq is ready I run AppHost1). |
I'd suggest opening an issue on the Dapr components issue tracker to request adding retry/resiliency to the initial RabbitMQ PubSub connection on component init. |
Closing this as external. |
Currently I have a project using Dapr pub/sub and RabbitMQ as the message provider, with Aspire being used to spin up the various services. Running the RabbitMQ container seperately this all works fine.
When trying to run RabbitMQ from the Aspire project things don't go so well. The crux of the issue seems to be assigning a host port that is the same as the container port.
For example this the annotation that I have tried using:
.WithAnnotation(new EndpointAnnotation(ProtocolType.Tcp, port:5672, containerPort: 5672))
This causes RabbitMQ to fail and exit. If the port number is changed to something like 5673 RabbitMQ will successfully start.
So why would we want to do use the same port number for host and container?
With RabbitMQ the convention is to expose the container port on the same host number. For example if you run the Docker container the command would like this:
docker run --hostname test-rabbit --name test-rabbit -p 5672:5672 -p 15672:15672 -e RABBITMQ_DEFAULT_USER=user -e RABBITMQ_DEFAULT_PASS=haveaguess rabbitmq:3-management
This convention is also assumed by Dapr.
Now I may have gotten the wrong end of the stick and may have missed something, but I am curious as to why this isn't possible
The text was updated successfully, but these errors were encountered: