Keycloak Postgres Aspire networking issues #8054
Unanswered
sdukehart-omnesoft
asked this question in
Q&A
Replies: 2 comments 3 replies
-
They port reported by the dashboard is the port the container is listening to requests from the host network; it’s effectively a port for the user to access the service (it would also be used by any services running on the host to talk to the container). The host and port that you’re seeing in the connection string environment variable are for the internal container network for container to container communication. Service discovery automatically uses container networking for communication between container services. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Utilizing Aspire 9.1.0, I've been working on an extension to try to extend
IResourceBuilder<KeycloakResource>
to be able to utilize the Keycloak image's ability to integrate with a PostgreSQL database.Unfortunately, there seems to be a bit of weirdness that I've had to include in it related to the Aspire-provided connection string and Aspire's networking.
The Aspire-provided connection string here looks something like
Host=localhost;Port=63030;Username=<USERNAME_VALUE>;Password=<PASSWORD_VALUE>;Database=<DATABASE_NAME>
, where the<...>
placeholders have accurate information. Additionally, the Host and Port match with what the Aspire dashboard shows for the given database. However, using these values that correspond to the Aspire proxy in front of the Postgres database fail to permit traffic through.If I go and look at the Aspire dashboard's environment variables for the Keycloak instance, I see a
ConnectionStrings__<DATABASE_NAME>
entry. However, it's value here isHost=postgres;Port=5432;Username=<USERNAME_VALUE>;Password=<PASSWORD_VALUE>;Database=<DATABASE_NAME>
.Using those Host and Port values allows my Keycloak instance to successfully communicate with my Postgres instance.
So ultimately my questions are:
Host=postgres;Port=5432
instead of the proxied endpoint?Thanks for any insights! And hopefully the Postgres extension will be useful to others!
Beta Was this translation helpful? Give feedback.
All reactions