Skip to content

Commit

Permalink
Keycloak (#138)
Browse files Browse the repository at this point in the history
* Upgrade Keycloak

* Export config
  • Loading branch information
Fosol authored Aug 12, 2024
1 parent 59c54ce commit 5d1cb61
Show file tree
Hide file tree
Showing 17 changed files with 880 additions and 1,191 deletions.
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/
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
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

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 \
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

0 comments on commit 5d1cb61

Please sign in to comment.