-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update for https and add dev mode command
- Loading branch information
Charro Gruver
committed
Oct 12, 2023
1 parent
53f5268
commit 23d1b38
Showing
3 changed files
with
59 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [[ ! -d ${PROJECTS_ROOT}/env-tmp]] | ||
set -x | ||
|
||
OC=/projects/bin/oc | ||
|
||
while [[ ! -f /home/user/.kube/config ]] | ||
do | ||
printf '.' | ||
sleep 2 | ||
done | ||
|
||
if [[ -f ${PROJECTS_ROOT}/env-tmp/set-env.sh ]] | ||
then | ||
mkdir -p ${PROJECTS_ROOT}/env-tmp | ||
rm ${PROJECTS_ROOT}/env-tmp/set-env.sh | ||
touch ${PROJECTS_ROOT}/env-tmp/set-env.sh | ||
else | ||
if [[ ! -d ${PROJECTS_ROOT}/env-tmp ]] | ||
then | ||
mkdir -p ${PROJECTS_ROOT}/env-tmp | ||
fi | ||
touch ${PROJECTS_ROOT}/env-tmp/set-env.sh | ||
fi | ||
|
||
API_ROUTE=https://$(oc get route ${DEVWORKSPACE_ID}-${CONTAINER_NAME}-${TARGET_PORT}-${ENDPOINT_NAME} -o jsonpath={.spec.host}) | ||
APP_URL=https://$(${OC} --kubeconfig=/home/user/.kube/config get route ${DEVWORKSPACE_ID}-dev-tools-3000-pelorus-metrics -o jsonpath={.spec.host}) | ||
KEYCLOAK_URL=https://$(${OC} --kubeconfig=/home/user/.kube/config get route ${DEVWORKSPACE_ID}-keycloak-8081-keycloak -o jsonpath={.spec.host}) | ||
|
||
echo "export NEXTAUTH_URL=${APP_URL}" >> ${PROJECTS_ROOT}/env-tmp/set-env.sh | ||
echo "export APP_ROOT=${APP_URL}" >> ${PROJECTS_ROOT}/env-tmp/set-env.sh | ||
echo "export NEXTAUTH_SECRET=\"+03/pWr4sFvxrcm29hwnXLREWjFfmW2toTCUyNcLytc=\"" >> ${PROJECTS_ROOT}/env-tmp/set-env.sh | ||
echo "export KEYCLOAK_ISSUER=${KEYCLOAK_URL}/realms/pelorus" >> ${PROJECTS_ROOT}/env-tmp/set-env.sh | ||
echo "export KEYCLOAK_ID=pelorus-client" >> ${PROJECTS_ROOT}/env-tmp/set-env.sh | ||
echo "export KEYCLOAK_SECRET=null" >> ${PROJECTS_ROOT}/env-tmp/set-env.sh | ||
echo "export KCADM=/opt/keycloak/bin/kcadm.sh" >> ${PROJECTS_ROOT}/env-tmp/set-env.sh | ||
echo "export KCADM_CONFIG=/tmp/kcadm.config" >> ${PROJECTS_ROOT}/env-tmp/set-env.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
KCADM=/opt/keycloak/bin/kcadm.sh | ||
KCADM_CONFIG=/tmp/kcadm.config | ||
APP_ROOT=http://cgruver-pelorus-workspace-pelorus-metrics.apps.sno-2.clg.lab | ||
echo "Wait for env config" | ||
while [[ ! -f ${PROJECTS_ROOT}/env-tmp/set-env.sh ]] | ||
do | ||
printf '.' | ||
sleep 2 | ||
done | ||
. ${PROJECTS_ROOT}/env-tmp/set-env.sh | ||
|
||
echo "Waiting for KeyCloak to start" | ||
while ! ${KCADM} config credentials --server http://localhost:8081 --realm master --user admin --password admin --config ${KCADM_CONFIG} | ||
do | ||
printf '.' | ||
sleep 5 | ||
sleep 2 | ||
done | ||
|
||
${KCADM} create realms -s realm=pelorus -s enabled=true -o --config ${KCADM_CONFIG} | ||
${KCADM} create users -r pelorus -s username=pelorus-metrics -s enabled=true --config ${KCADM_CONFIG} | ||
${KCADM} set-password -r pelorus --username pelorus-metrics --new-password pelorus --config ${KCADM_CONFIG} | ||
${KCADM} create users -r pelorus -s username=pelorus -s enabled=true --config ${KCADM_CONFIG} | ||
${KCADM} set-password -r pelorus --username pelorus --new-password pelorus --config ${KCADM_CONFIG} | ||
${KCADM} create clients -r pelorus -s clientId=pelorus-client -s publicClient="true" -s "redirectUris=[\"${APP_ROOT}/*\"]" -s enabled=true -s "rootUrl=${APP_ROOT}" -s "webOrigins=[\"+\"]" --config ${KCADM_CONFIG} | ||
${KCADM} create roles -r pelorus -s name=pelorus-metrics --config ${KCADM_CONFIG} | ||
${KCADM} add-roles --uusername pelorus-metrics --rolename pelorus-metrics -r pelorus --config ${KCADM_CONFIG} | ||
${KCADM} add-roles --uusername pelorus --rolename pelorus-metrics -r pelorus --config ${KCADM_CONFIG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters