2014-09-30 17:50:17 +00:00
#!/bin/bash
2014-10-02 15:42:11 +00:00
## Deploy and configure all examples
2014-09-30 17:50:17 +00:00
# Deploy examples
cd /keycloak-docker-cluster/examples
2014-10-07 10:33:27 +00:00
for I in $( find . | grep .war$) ; do cp $I $JBOSS_HOME /standalone/deployments/; done ;
2014-09-30 17:50:17 +00:00
# Explode wars
2014-10-07 10:33:27 +00:00
cd $JBOSS_HOME /standalone/deployments/
2014-09-30 17:50:17 +00:00
for I in $( ls -d *.war | grep -v auth-server.war) ; do
2014-10-01 07:52:00 +00:00
echo " Configuring $I " ;
2014-09-30 17:50:17 +00:00
mkdir $I .tmp;
cd $I .tmp;
unzip -q ../$I ;
cd ..
rm $I ;
mv $I .tmp $I ;
touch $I .dodeploy;
done ;
# Configure admin-access.war
sed -i -e 's/false/true/' admin-access.war/WEB-INF/web.xml
2014-10-05 20:12:54 +00:00
# Enforce refreshing token for product-portal and customer-portal war
2014-10-06 11:04:14 +00:00
# sed -i -e 's/\"\/auth\",/&\n \"always-refresh-token\": true,/' customer-portal.war/WEB-INF/keycloak.json;
2014-10-09 16:38:59 +00:00
# sed -i -e 's/\"\/auth\",/&\n \"always-refresh-token\": true,/' product-portal.war/WEB-INF/keycloak.json;
2014-10-05 20:12:54 +00:00
2014-09-30 17:50:17 +00:00
# Configure other examples
for I in *.war/WEB-INF/keycloak.json; do
2014-10-21 11:08:02 +00:00
sed -i -e 's/\"resource\".*: \".*\",/&\n \"auth-server-url-for-backend-requests\": \"http:\/\/\$\{jboss.host.name\}:8080\/auth\",\n \"register-node-at-startup\": true,\n \"register-node-period\": 150,/' $I ;
sed -i -e 's/\"bearer-only\" : true,/&\n \"credentials\" : \{ \"secret\": \"password\" \},/' $I ;
2014-09-30 17:50:17 +00:00
done ;
2014-10-01 09:52:16 +00:00
# Enable distributable for customer-portal
sed -i -e 's/<\/module-name>/&\n <distributable \/>/' customer-portal.war/WEB-INF/web.xml
2014-10-21 11:08:02 +00:00
# Configure testrealm.json - Enable adminUrl to access adapters on local machine, add jboss-logging listener and add secret for database-service application
TEST_REALM = /keycloak-docker-cluster/examples/testrealm.json
sed -i -e 's/\"adminUrl\": \"\/customer-portal/\"adminUrl\": \"http:\/\/\$\{jboss.host.name\}:8080\/customer-portal/' $TEST_REALM
sed -i -e 's/\"adminUrl\": \"\/product-portal/\"adminUrl\": \"http:\/\/\$\{application.session.host\}:8080\/product-portal/' $TEST_REALM
sed -i -e 's/\"adminUrl\": \"\/database/\"adminUrl\": \"http:\/\/\$\{jboss.host.name\}:8080\/database/' $TEST_REALM
sed -i -e 's/\"bearerOnly\": true/&,\n \"secret\": \"password\"/' $TEST_REALM
sed -i -e 's/\"sslRequired\": \"external\",/&\n \"eventsListeners\": \[ \"jboss-logging\" \],/' $TEST_REALM
2014-10-02 15:42:11 +00:00
2014-09-30 17:50:17 +00:00