Skip to content

Instantly share code, notes, and snippets.

@rsoika
Last active December 18, 2016 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsoika/2d8bab41b18b9fb133c425277c655af7 to your computer and use it in GitHub Desktop.
Save rsoika/2d8bab41b18b9fb133c425277c655af7 to your computer and use it in GitHub Desktop.
#!/bin/bash
#title :gitbucket-wildfly-install.sh
#description :The script to install Gitbucket on Wildfly 9.x,10.x
#more :https://github.com/gitbucket/gitbucket/wiki/Deployment-to-JEE-and-Servlet-containers
#author :initial: Ralph Soika
#date :20161218
#changes :initial script
#usage :/bin/bash wildfly-install.sh [INSTALLDIR] [GITBUCKET-VERSION]
function usage
{
echo "usage: gitbucket-wildfly-install [[[-v version ] [-d installdir] ]]"
}
GITBUCKET_VERSION=4.7.1
INSTALL_DIR=/opt/wildfly
# read options...
while [ "$1" != "" ]; do
case $1 in
-v | --version ) shift
GITBUCKET_VERSION=$1
;;
-d | --installdir ) shift
INSTALL_DIR=$1
;;
* ) usage
exit 1
esac
shift
done
WILDFLY_FILENAME=wildfly-$WILDFLY_VERSION
GITBUCKET_DOWNLOAD_ADDRESS=https://github.com/gitbucket/gitbucket/releases/download/$GITBUCKET_VERSION/gitbucket.war
WILDFLY_DEPLOYMENT_DIR=$INSTALL_DIR/standalone/deployments
WILDFLY_USER="wildfly"
echo GITBUCKET_VERSION=$GITBUCKET_VERSION
echo INSTALL_DIR=$INSTALL_DIR
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#if [[ $EUID -ne 0 ]]; then
# echo "This script must be run as root."
# exit 1
#fi
echo "Downloading: $GITBUCKET_DOWNLOAD_ADDRESS..."
wget -v $GITBUCKET_DOWNLOAD_ADDRESS
if [ $? -ne 0 ]; then
echo "Not possible to download Gitbucket."
exit 1
fi
echo unzip archive...
mv gitbucket.war _gitbucket.war
unzip _gitbucket.war -d gitbucket.war
rm _gitbucket.war
echo add deplyoment artefacts....
echo "<jboss-deployment-structure>" > jboss-deployment-structure.xml
echo " <deployment>" >> jboss-deployment-structure.xml
echo " <dependencies" >> jboss-deployment-structure.xml
echo " <system export="true">" >> jboss-deployment-structure.xml
echo " <paths> <path name=\"com/sun/net/ssl/internal/ssl\" /> <path name=\"com/sun/net/ssl\" /> </paths>" >> jboss-deployment-structure.xml
echo " </system>" >> jboss-deployment-structure.xml
echo " <module name=\"org.yaml.snakeyaml\"/>" >> jboss-deployment-structure.xml
echo " </dependencies>" >> jboss-deployment-structure.xml
echo " </deployment>" >> jboss-deployment-structure.xml
echo "</jboss-deployment-structure>" >> jboss-deployment-structure.xml
mv jboss-deployment-structure.xml gitbucket.war/WEB-INF/
echo "Starting deplomynet..."
touch gitbucket.war/gitbucket.war.dodeploy
mv gitbucket.war $WILDFLY_DEPLOYMENT_DIR
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment