How to deploy Applications (EAR) using scripts/linux (CLI) for JBoss EAP/Wildfly
Hi all,
I would like to show you how to deploy and undeploy EAR into JBoss or Wildfly...
Let's see:
- Standalone
#cd /opt/sample
# vim sample-jboss.sh
IP = localhost
if [ "x$JBOSS_HOME" = "x" ]; then
JBOSS_HOME="/opt/jboss/jboss-eap-6.4"
echo "JBOSS_HOME set up... "
fi
echo "Undeploy...sample.ear"
if $JBOSS_HOME/bin/jboss-cli.sh -c --controller=$IP:9999 --commands="undeploy sample.ear, quit" then
echo "Undeploy OK!"
else
echo "[ERROR]: Undeploy failed!"
fi
echo ""
echo "Deploy...sample.ear"
if $JBOSS_HOME/bin/jboss-cli.sh -c --controller=$IP:9999 --commands="deploy sample.ear --force, deployment-info --name=sample.ear, quit" then
echo "Deploy OK!"
else
echo "[ERROR]: Deploy failed!"
fi
echo ""
:wq
# ./sample-jboss.sh
So, fill the username and password for JBoss Admin (Security RBAC or Property settings)
- Domain
IP = localhost
JBOSS_USER = admin
JBOSS_PWD = <password>
echo "Undeploy..."
if $JBOSS_HOME/bin/jboss-cli.sh -c --controller=$IP:9999 --user=$JBOSS_USER --password=$JBOSS_PWD --commands="undeploy sample.ear --all-relevant-server-groups, quit" then
echo "Undeploy OK!"
else
echo "[ERROR]: Failed!"
echo "Deploy..."
if $JBOSS_HOME/bin/jboss-cli.sh -c --controller=$IP:9999 --user=$JBOSS_USER --password=$JBOSS_PWD --commands="deploy sample.ear --server-groups=<group> --name=sample.ear, quit" then
echo "Deploy OK!"
else
echo "[ERROR]: Failed!"
fi
echo ""
#JBoss Info...(cli command)
echo "############### STATUS #################"
$JBOSS_HOME/bin/jboss-cli.sh -c --controller=$IP:9999 --user=$JBOSS_USER --password=$JBOSS_PWD --commands="/server-group=*/deployment=*/:read-resource(recursive=false,proxies=true,include-runtime=true,include-defaults=true"
Thanks all, see you next time...
No comments:
Post a Comment