Use infinispan UserSession provider for docker cluster env. Don't prepare nodes during each fig start

This commit is contained in:
mposolda 2014-10-01 09:52:00 +02:00
parent 72ec9ccb00
commit fd0a000823
3 changed files with 36 additions and 19 deletions

View file

@ -68,5 +68,11 @@
"dataSource": "java:jboss/datasources/KeycloakDS",
"databaseSchema": "update"
}
},
"connectionsInfinispan": {
"default": {
"cacheContainer" : "java:jboss/infinispan/Keycloak"
}
}
}

View file

@ -9,7 +9,7 @@ for I in $(find . | grep .war$); do cp $I /opt/wildfly/standalone/deployments/;
# Explode wars
cd /opt/wildfly/standalone/deployments/
for I in $(ls -d *.war | grep -v auth-server.war); do
echo "Explode dir $I";
echo "Configuring $I";
mkdir $I.tmp;
cd $I.tmp;
unzip -q ../$I;
@ -25,7 +25,6 @@ sed -i -e 's/false/true/' admin-access.war/WEB-INF/web.xml
# Configure other examples
for I in *.war/WEB-INF/keycloak.json; do
echo "Configuring $I";
sed -i -e 's/\"use-hostname-for-local-requests\": false/\"use-hostname-for-local-requests\": true/' $I;
done;

View file

@ -3,6 +3,34 @@
export MYHOST=node$(echo $MYSQL_NAME | awk -F"/dockercluster[^0-9]*|\/mysql" '{print $2 }');
echo "MYHOST is $MYHOST. MYSQL_NAME is $MYSQL_NAME";
function prepareHost
{
if [ -d /keycloak-docker-shared/keycloak-wildfly-$MYHOST ]; then
echo "Node $MYHOST already prepared. Skiping";
return;
fi
echo "Creating keycloak-wildfly-$MYHOST";
cd /opt/wildfly
cp -r /keycloak-docker-cluster/modules ./
# Deploy keycloak
cp -r /keycloak-docker-cluster/deployments/* /opt/wildfly/standalone/deployments/
# Enable Infinispan provider
sed -i "s|keycloak.userSessions.provider:mem|keycloak.userSessions.provider:infinispan|" /opt/wildfly/standalone/deployments/auth-server.war/WEB-INF/classes/META-INF/keycloak-server.json
# Deploy and configure examples
/deploy-examples.sh
# Deploy to volume
rm -rf /keycloak-docker-shared/keycloak-wildfly-$MYHOST
cp -r /opt/wildfly-8.1.0.Final /keycloak-docker-shared/keycloak-wildfly-$MYHOST
chmod -R 777 /keycloak-docker-shared/keycloak-wildfly-$MYHOST
echo "keycloak-wildfly-$MYHOST prepared and copyied to volume";
}
function waitForPreviousNodeStart
{
myHostNumber=$(echo $MYHOST | awk -F"node" '{ print $2 }');
@ -42,23 +70,7 @@ function waitForMySQLStart
done;
}
echo "Creating keycloak-wildfly-$MYHOST";
cd /opt/wildfly
cp -r /keycloak-docker-cluster/modules ./
# Deploy keycloak
cp -r /keycloak-docker-cluster/deployments/* /opt/wildfly/standalone/deployments/
# Deploy and configure examples
/deploy-examples.sh
# Deploy to volume
rm -rf /keycloak-docker-shared/keycloak-wildfly-$MYHOST
cp -r /opt/wildfly-8.1.0.Final /keycloak-docker-shared/keycloak-wildfly-$MYHOST
chmod -R 777 /keycloak-docker-shared/keycloak-wildfly-$MYHOST
echo "keycloak-wildfly-$MYHOST prepared and copyied to volume";
prepareHost;
waitForPreviousNodeStart;
waitForMySQLStart;