Skip to content

Commit

Permalink
keycloak stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveDarsa committed Feb 20, 2024
1 parent b631a15 commit e0695ee
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ x-environment: &default-environment
LAGOON_ROUTE: &default-url http://lagoon-ui.docker.amazee.io
# Uncomment if you like to have the system behave like in production
LAGOON_ENVIRONMENT_TYPE: production
GRAPHQL_API: "${GRAPHQL_API:-http://localhost:3000/graphql}"
KEYCLOAK_API: "${KEYCLOAK_API:-http://localhost:8088/auth}"
GRAPHQL_API: "${GRAPHQL_API:-http://0.0.0.0:3000/graphql}"
KEYCLOAK_API: "${KEYCLOAK_API:-http://0.0.0.0:8088/auth}"
LAGOON_UI_TOURS_ENABLED: enabled

services:
Expand Down
4 changes: 3 additions & 1 deletion test/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
- OPENSEARCH_INTEGRATION_ENABLED=false
- DISABLE_CORE_HARBOR=true
- CI=${CI:-true}
- S3_FILES_HOST=http://172.17.0.1:39000
- S3_FILES_HOST=http://0.0.0.0:39000
- S3_BAAS_ACCESS_KEY_ID=minio
- S3_BAAS_SECRET_ACCESS_KEY=minio123
- CONSOLE_LOGGING_LEVEL=trace
Expand All @@ -46,6 +46,8 @@ services:
- '38088:8080'
volumes:
- ./keycloak:/upload
environment:
- KEYCLOAK_FRONTEND_URL=http://0.0.0.0:38088/auth
keycloak-db:
image: testlagoon/keycloak-db:main
local-minio:
Expand Down
12 changes: 6 additions & 6 deletions test/keycloak/configure-keycloak.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function is_keycloak_running {
local http_code=$(curl -s -o /dev/null -w "%{http_code}" http://$(hostname -i):8080/auth/admin/realms)
local http_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/auth/admin/realms)
if [[ $http_code -eq 401 ]]; then
return 0
else
Expand All @@ -15,19 +15,19 @@ function configure_user_passwords {
for i in ${LAGOON_DEMO_USERS[@]}
do
echo Configuring password for $i
/opt/jboss/keycloak/bin/kcadm.sh set-password --config $CONFIG_PATH --username $i -p $i --target-realm Lagoon
/opt/keycloak/bin/kcadm.sh set-password --config $CONFIG_PATH --username $i -p $i --target-realm Lagoon
done

for i in ${LAGOON_DEMO_ORG_USERS[@]}
do
echo Configuring password for $i
/opt/jboss/keycloak/bin/kcadm.sh set-password --config $CONFIG_PATH --username $i -p $i --target-realm Lagoon
/opt/keycloak/bin/kcadm.sh set-password --config $CONFIG_PATH --username $i -p $i --target-realm Lagoon
done
}

function configure_platformowner {
echo Configuring platform owner role
/opt/jboss/keycloak/bin/kcadm.sh add-roles --uusername [email protected] --rolename platform-owner --config $CONFIG_PATH --target-realm Lagoon
/opt/keycloak/bin/kcadm.sh add-roles --uusername [email protected] --rolename platform-owner --config $CONFIG_PATH --target-realm Lagoon
}

function configure_keycloak {
Expand All @@ -37,11 +37,11 @@ function configure_keycloak {
done

# Set the config file path because $HOME/.keycloak/kcadm.config resolves to /opt/jboss/?/.keycloak/kcadm.config for some reason, causing it to fail
CONFIG_PATH=/opt/jboss/keycloak/standalone/data/.keycloak/kcadm.config
CONFIG_PATH=/tmp/kcadm.config

echo Keycloak is running, proceeding with configuration

/opt/jboss/keycloak/bin/kcadm.sh config credentials --config $CONFIG_PATH --server http://$(hostname -i):8080/auth --user $KEYCLOAK_USER --password $KEYCLOAK_PASSWORD --realm master
/opt/keycloak/bin/kcadm.sh config credentials --config $CONFIG_PATH --server http://localhost:8080/auth --user $KEYCLOAK_USER --password $KEYCLOAK_PASSWORD --realm master

configure_user_passwords
configure_platformowner
Expand Down

0 comments on commit e0695ee

Please sign in to comment.