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

Issue with Camunda and Keycloak integration in Docker Compose setup #248

Open
dnenadd opened this issue Sep 13, 2024 · 1 comment
Open
Assignees
Labels
kind/question Further information is requested

Comments

@dnenadd
Copy link

dnenadd commented Sep 13, 2024

I am having issues building and running the sso-kubernetes example from the Camunda community repository. Initially, I tried running the example with Minikube, but encountered issues. Since I don't have much Kubernetes experience, I decided to convert the example to Docker Compose.

After converting to Docker Compose, I encountered the same issues. I believe a working Docker Compose example would not only help me but also others who might face similar challenges.

Error Details:

The errors I am receiving in Camunda containder are:
KEYCLOAK-01011 TOKEN request failed: I/O error on POST request for "http://keycloak-combined:8080/auth/realms/camunda/protocol/openid-connect/token": Connect to http://keycloak-combined:8080 [keycloak-combined/172.18.0.2] failed: Connection refused
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'restApiSecurityConfig': Unsatisfied dependency expressed through field 'clientService': Error creating bean with name 'authorizedClientService' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2WebSecurityConfiguration.class]: Unsatisfied dependency expressed through method 'authorizedClientService' parameter 0: Error creating bean with name 'clientRegistrationRepository' defined in class path resource [org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2ClientRegistrationRepositoryConfiguration.class]: Failed to instantiate [org.springframework.security.oauth2.client.registration.InMemoryClientRegistrationRepository
Docker Compose Setup:

This is my docker-compose.yaml file:
version: "3.9"

services:
keycloak-combined:
image: gunnaraccso/keycloak.server:24.0.3
restart: unless-stopped
environment:
TZ: Europe/Berlin
DB_VENDOR: h2
KEYCLOAK_ADMIN: keycloak
KEYCLOAK_ADMIN_PASSWORD: keycloak1!
KC_HTTP_RELATIVE_PATH: /auth
PROXY_ADDRESS_FORWARDING: true
ports:
- "9001:8443"
- "9000:8080"
command:
- start-dev
- --features=admin-fine-grained-authz

camunda:
image: docker.io/gunnaraccso/camunda-showcase-keycloak:7.21.7-SNAPSHOT
environment:
- JDBC_URL=jdbc:postgresql://postgres:5432/camunda
- JDBC_USER=camunda
- JDBC_PASSWORD=camunda1!
- KEYCLOAK_URL_AUTH=http://localhost:9000/auth
- KEYCLOAK_URL_TOKEN=http://keycloak-combined:8080/auth
- KEYCLOAK_URL_PLUGIN=http://keycloak-combined:8080/auth
- KEYCLOAK_CLIENT_ID=camunda-identity-service
- KEYCLOAK_CLIENT_SECRET=0F0yFyCvv2T901fvMSbKlAd7f8QkyxNg
depends_on:
- keycloak-combined
- postgres

postgres:
image: postgres
environment:
- POSTGRES_DB=camunda
- POSTGRES_USER=camunda
- POSTGRES_PASSWORD=camunda1!
ports:
- "5432:5432"
Observations:
The depends_on directive ensures that Keycloak starts before Camunda, but the connection is still refused.
The Camunda container shuts down after the error, likely due to the unresolved dependency related to restApiSecurityConfig.

Expected Outcome:

I would like help resolving the connection issue between Camunda and Keycloak in the Docker Compose environment. Additionally, guidance on the OAuth2 configuration in the Spring Boot application would be appreciated.
Additional context:

Docker Compose version: v2.29.2
Keycloak version: 24.0.3
Camunda version: 7.21.7-SNAPSHOT
Operating system: Windows 10

Any help would be greatly appreciated!

@dnenadd
Copy link
Author

dnenadd commented Sep 13, 2024

Since the content of the Docker Compose file became misformatted, I am now attaching it as a file (YAML).
compose.txt

@VonDerBeck VonDerBeck added the kind/question Further information is requested label Sep 17, 2024
@VonDerBeck VonDerBeck self-assigned this Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants