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

Keycloak #138

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ bash.exe.stackdump
*.param
.scannerwork/
.sonarqube/
auth/keycloak/config/hsperfdata_jboss/
auth/keycloak/config/*.log
keycloak/config/hsperfdata_jboss/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new keycloak doesn't use the auth path

keycloak/config/*.log
~


Expand Down
Empty file modified do
100644 → 100755
Empty file.
6 changes: 2 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.5'

services:
####################### Database #######################
database:
Expand Down Expand Up @@ -34,7 +32,7 @@ services:
env_file:
- keycloak/.env
volumes:
- ./keycloak/config/realm-export.json:/tmp/realm-export.json
- ./keycloak/config:/opt/keycloak/data/import
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New location for the configuration files

ports:
- ${KEYCLOAK_HTTP_PORT:-30001}:8080
- ${KEYCLOAK_HTTPS_PORT:-30002}:443
Expand All @@ -45,7 +43,7 @@ services:
extra_hosts:
- "host.docker.internal:host-gateway"
healthcheck:
test: curl -s -f http://localhost:8080/auth/realms/hsb || exit 1
test: curl -s -f http://localhost:8080/realms/hsb || exit 1
interval: 5m
timeout: 15s
retries: 3
Expand Down
4 changes: 3 additions & 1 deletion keycloak/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# https://hub.docker.com/r/jboss/keycloak/
FROM jboss/keycloak:16.1.1
FROM keycloak/keycloak:24.0.1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New image because the old one doesn't exist anymore


EXPOSE 8080

COPY ./config/*.json /tmp/

ENTRYPOINT ["/opt/keycloak/bin/kc.sh", "start-dev", "--import-realm"]
13 changes: 13 additions & 0 deletions keycloak/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ docker exec -it {ContainerID} bash

```bash
$ docker exec -it hsb-keycloak bash

# Old jboss image
$ /opt/jboss/keycloak/bin/standalone.sh \
-Dkeycloak.migration.action=export \
-Dkeycloak.migration.provider=singleFile \
Expand All @@ -45,6 +47,10 @@ $ /opt/jboss/keycloak/bin/standalone.sh \
-Djboss.http.port=8888 \
-Djboss.https.port=9999 \
-Djboss.management.http.port=7777

# New Keycloak image
/opt/keycloak/bin/kc.sh \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New export and import commands

export --file /opt/keycloak/data/import/realm-export.json --realm hsb
```

## Import Realm
Expand All @@ -54,18 +60,25 @@ To import a previously exported realm configuration execute the following comman

```bash
$ docker exec -it hsb-keycloak bash

# Old jboss image
$ /opt/jboss/keycloak/bin/standalone.sh \
-Djboss.socket.binding.port-offset=100 \
-Dkeycloak.migration.action=import \
-Dkeycloak.profile.feature.scripts=enabled \
-Dkeycloak.profile.feature.upload_scripts=enabled \
-Dkeycloak.migration.provider=singleFile \
-Dkeycloak.migration.file=/tmp/realm-export.json

# New Keycloak image
/opt/keycloak/bin/kc.sh \
import --file /opt/keycloak/data/import/realm-export.json
```

or

```bash
# Old jboss image
$ docker run -e KEYCLOAK_USER=<USERNAME> -e KEYCLOAK_PASSWORD=<PASSWORD> \
-e KEYCLOAK_IMPORT=/tmp/example-realm.json -v /tmp/example-realm.json:/tmp/example-realm.json jboss/keycloak
```
Expand Down
Loading
Loading