init.sh 6.63 KB
Newer Older
1 2 3 4 5
#!/bin/sh 
DEMO="Red Hat Decision Manager Install Demo"
AUTHORS="Andrew Block, Eric D. Schabell"
PROJECT="git@github.com:bpmworkshop/rhdm-install-demo.git"
PRODUCT="Red Hat Decision Manager"
Eric D. Schabell's avatar
Eric D. Schabell committed
6
JBOSS_HOME=./target/jboss-eap-7.2
7 8 9 10 11 12
SERVER_DIR=$JBOSS_HOME/standalone/deployments/
SERVER_CONF=$JBOSS_HOME/standalone/configuration/
SERVER_BIN=$JBOSS_HOME/bin
SRC_DIR=./installs
SUPPORT_DIR=./support
PRJ_DIR=./projects
Eric D. Schabell's avatar
Eric D. Schabell committed
13 14 15
VERSION_EAP=7.2.0
VERSION=7.3.0
EAP=jboss-eap-$VERSION_EAP.zip
16
RHDM=rhdm-$VERSION-decision-central-eap7-deployable.zip
Eric D. Schabell's avatar
Eric D. Schabell committed
17
KIESERVER=rhdm-$VERSION-kie-server-ee8.zip
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

# wipe screen.
clear 

echo
echo "#############################################################"
echo "##                                                         ##"   
echo "##  Setting up the ${DEMO}   ##"
echo "##                                                         ##"   
echo "##                                                         ##"   
echo "##         ####  ##### ####     #   #  ###  #####          ##"
echo "##         #   # #     #   #    #   # #   #   #            ##"
echo "##         ####  ###   #   #    ##### #####   #            ##"
echo "##         #  #  #     #   #    #   # #   #   #            ##"
echo "##         #   # ##### ####     #   # #   #   #            ##"
echo "##                                                         ##"   
34 35 36 37 38
echo "##     ####  #####  #### #####  #### #####  ###  #   #     ##"   
echo "##     #   # #     #       #   #       #   #   # ##  #     ##"   
echo "##     #   # ###   #       #    ###    #   #   # # # #     ##"   
echo "##     #   # #     #       #       #   #   #   # #  ##     ##"   
echo "##     ####  #####  #### ##### ####  #####  ###  #   #     ##"   
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
echo "##                                                         ##"   
echo "##       #   #  ###  #   #  ###  ##### ##### ####          ##"
echo "##       ## ## #   # ##  # #   # #     #     #   #         ##"
echo "##       # # # ##### # # # ##### #  ## ###   ####          ##"
echo "##       #   # #   # #  ## #   # #   # #     #  #          ##"
echo "##       #   # #   # #   # #   # ##### ##### #   #         ##"
echo "##                                                         ##"   
echo "##                                                         ##"   
echo "##  brought to you by,                                     ##"   
echo "##             ${AUTHORS}              ##"
echo "##                                                         ##"   
echo "##  ${PROJECT}       ##"
echo "##                                                         ##"   
echo "#############################################################"
echo

# make some checks first before proceeding.	
56 57 58 59 60 61 62 63 64
if [ -r $SUPPORT_DIR ] || [ -L $SUPPORT_DIR ]; then
        echo "Support dir is presented..."
        echo
else
        echo "$SUPPORT_DIR wasn't found. Please make sure to run this script inside the demo directory."
        echo
        exit
fi

65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
if [ -r $SRC_DIR/$EAP ] || [ -L $SRC_DIR/$EAP ]; then
	echo "Product EAP sources are present..."
	echo
else
	echo "Need to download $EAP package from https://developers.redhat.com/products/eap/download"
	echo "and place it in the $SRC_DIR directory to proceed..."
	echo
	exit
fi

if [ -r $SRC_DIR/$RHDM ] || [ -L $SRC_DIR/$RHDM ]; then
	echo "Product RHDM sources are present..."
	echo
else
	echo "Need to download $RHDM from https://developers.redhat.com/products/red-hat-decision-manager/download"
	echo "and place it in the $SRC_DIR directory to proceed..."
	echo
	exit
fi

if [ -r $SRC_DIR/$KIESERVER ] || [ -L $SRC_DIR/$KIESERVER ]; then
	echo "Product RHDM Kie Server sources are present..."
	echo
else
	echo "Need to download $KIESERVER from https://developers.redhat.com/products/red-hat-decision-manager/download"
	echo "and place it in the $SRC_DIR directory to proceed..."
	echo
	exit
fi

# Remove the old JBoss instance, if it exists.
if [ -x $JBOSS_HOME ]; then
	echo "  - removing existing installation directory..."
	echo
	rm -rf $JBOSS_HOME
fi

# Installation.
echo "JBoss EAP installation running now..."
echo
mkdir -p ./target
unzip -qo $SRC_DIR/$EAP -d ./target

if [ $? -ne 0 ]; then
	echo
	echo Error occurred during JBoss EAP installation!
	exit
fi

echo "Red Hat Decision Manager installation running now..."
echo
unzip -qo $SRC_DIR/$RHDM -d ./target 

if [ $? -ne 0 ]; then
	echo Error occurred during $PRODUCT installation
	exit
fi

echo "Red Hat Decision Manager KIE Server installation running now..."
echo
unzip -qo $SRC_DIR/$KIESERVER -d $JBOSS_HOME/standalone/deployments 

if [ $? -ne 0 ]; then
	echo Error occurred during $PRODUCT installation
	exit
fi

# Set deployment Kie Server.
touch $JBOSS_HOME/standalone/deployments/kie-server.war.dodeploy

echo "  - enabling demo accounts role setup..."
echo
$JBOSS_HOME/bin/add-user.sh -a -r ApplicationRealm -u erics -p redhatdm1! -ro analyst,admin,manager,user,kie-server,kiemgmt,rest-all --silent 
echo "  - User 'erics' password 'redhatdm1!' setup..."
echo
140 141
$JBOSS_HOME/bin/add-user.sh -a -r ApplicationRealm -u kieserver -p kieserver1! -ro kie-server --silent
echo "  - Management user 'kieserver' password 'kieserver1!' setup..."
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
echo

echo "  - setting up standalone-full.xml configuration adjustments..."
echo
cp $SUPPORT_DIR/standalone-full.xml $SERVER_CONF/standalone.xml

echo "  - setup email notification users..."
echo
cp $SUPPORT_DIR/userinfo.properties $SERVER_DIR/decision-central.war/WEB-INF/classes/

# Add execute permissions to the standalone.sh script.
echo "  - making sure standalone.sh for server is executable..."
echo
chmod u+x $JBOSS_HOME/bin/standalone.sh

echo "==========================================================================="
echo "=                                                                         ="
159
echo "=  $PRODUCT $VERSION setup complete.                         ="
160 161 162 163 164 165 166 167 168 169 170 171 172
echo "=                                                                         ="
echo "=  You can now start the $PRODUCT with:                   ="
echo "=                                                                         ="
echo "=                         $SERVER_BIN/standalone.sh        ="
echo "=                                                                         ="
echo "=  Login to Red Hat Decision Manager to start developing rules projects:  ="
echo "=                                                                         ="
echo "=  http://localhost:8080/decision-central                                 ="
echo "=                                                                         ="
echo "=  [ u:erics / p:redhatdm1! ]                                             ="
echo "=                                                                         ="
echo "==========================================================================="
echo