update
This commit is contained in:
17
roles/cmoa_install/files/05-imxc/scripts/init-api-server.sh
Normal file
17
roles/cmoa_install/files/05-imxc/scripts/init-api-server.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#! /bin/sh
|
||||
|
||||
STATUS_CODE="$(curl -s -o /dev/null -w '%{http_code}' http://imxc-keycloak-http/auth/realms/exem)"
|
||||
|
||||
if [ $STATUS_CODE -eq 200 ]; then
|
||||
JWT_KEY="$(curl -s -XGET http://imxc-keycloak-http/auth/realms/exem | jq -r '.public_key')"
|
||||
export JWT_KEY
|
||||
|
||||
chmod -R 777 /home/cloudmoa/notification/cloudmoa_alert.log
|
||||
|
||||
/sbin/tini -- java -Djava.security.egd=file:/dev/./urandom -jar /app.jar
|
||||
#java -Djava.security.egd=file:/dev/./urandom -jar /app.jar
|
||||
elif [ $STATUS_CODE -eq 404 ]; then
|
||||
echo "not found exem relam. check realm in imxc-keycloak"
|
||||
else
|
||||
echo "not found keycloak. check to install keycloak"
|
||||
fi
|
||||
36
roles/cmoa_install/files/05-imxc/scripts/init-auth-server.sh
Normal file
36
roles/cmoa_install/files/05-imxc/scripts/init-auth-server.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#! /bin/bash
|
||||
|
||||
# 200 -> 서버 및 realm이 있는 경우
|
||||
# 404 -> 서버는 있으나 realm이 없는 경우
|
||||
# 000 -> 서버가 없음
|
||||
STATUS_CODE="$(curl -s -o /dev/null -w '%{http_code}' http://imxc-keycloak-http/auth/realms/exem)"
|
||||
|
||||
if [ $STATUS_CODE -eq 404 ]; then
|
||||
TOKEN="$(curl -s -d "client_id=admin-cli" -d "username=admin" -d "password=admin" -d "grant_type=password" http://imxc-keycloak-http/auth/realms/master/protocol/openid-connect/token | jq -r '.access_token')"
|
||||
|
||||
echo $TOKEN
|
||||
|
||||
echo "create realm and client"
|
||||
# create realm and client
|
||||
curl -s -v POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d "@/tmp/init.json" http://imxc-keycloak-http/auth/admin/realms
|
||||
|
||||
|
||||
echo "create admin and owner"
|
||||
# create admin and owner
|
||||
curl -s -v POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{"firstName":"","lastName":"", "username":"admin","email":"admin@example.com", "enabled":"true","credentials":[{"type":"password","value":"admin","temporary":false}]}' http://imxc-keycloak-http/auth/admin/realms/exem/users
|
||||
curl -s -v POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{"firstName":"","lastName":"", "username":"owner","email":"owner@example.com", "enabled":"true","credentials":[{"type":"password","value":"admin","temporary":false}]}' http://imxc-keycloak-http/auth/admin/realms/exem/users
|
||||
|
||||
JWT_KEY="$(curl -s -XGET http://imxc-keycloak-http/auth/realms/exem | jq -r '.public_key')"
|
||||
export JWT_KEY
|
||||
|
||||
java -Djava.security.egd=file:/dev/./urandom -jar /app.jar
|
||||
elif [ $STATUS_CODE -eq 200 ]; then
|
||||
echo "exist exem relam"
|
||||
|
||||
JWT_KEY="$(curl -s -XGET http://imxc-keycloak-http/auth/realms/exem | jq -r '.public_key')"
|
||||
export JWT_KEY
|
||||
|
||||
java -Djava.security.egd=file:/dev/./urandom -jar /app.jar
|
||||
else
|
||||
echo "not found keycloak. check to install keycloak"
|
||||
fi
|
||||
14
roles/cmoa_install/files/05-imxc/scripts/init-noti-server.sh
Normal file
14
roles/cmoa_install/files/05-imxc/scripts/init-noti-server.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#! /bin/sh
|
||||
|
||||
STATUS_CODE="$(curl -s -o /dev/null -w '%{http_code}' http://imxc-keycloak-http/auth/realms/exem)"
|
||||
|
||||
if [ $STATUS_CODE -eq 200 ]; then
|
||||
JWT_KEY="$(curl -s -XGET http://imxc-keycloak-http/auth/realms/exem | jq -r '.public_key')"
|
||||
export JWT_KEY
|
||||
|
||||
java -Djava.security.egd=file:/dev/./urandom -jar /app.jar
|
||||
elif [ $STATUS_CODE -eq 404 ]; then
|
||||
echo "not found exem relam. check realm in imxc-keycloak"
|
||||
else
|
||||
echo "not found keycloak. check to install keycloak"
|
||||
fi
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
chmod -R 777 /scripts
|
||||
|
||||
sed -i "s/localhost/$REDIRECT_URLS/g" /scripts/init.json
|
||||
cp /scripts/init.json /tmp/init.json
|
||||
2148
roles/cmoa_install/files/05-imxc/scripts/init.json
Normal file
2148
roles/cmoa_install/files/05-imxc/scripts/init.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user