Last active
August 29, 2015 14:05
-
-
Save all4miller/1a8706998b86d324e161 to your computer and use it in GitHub Desktop.
Torquebox install script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
if [ -z "$1" ]; then | |
echo 'You need to supply a torquebox version param (e.g) "3.1.1"' | |
exit 1 | |
fi | |
# params | |
TORQUEBOX_VERSION=$1 | |
# set working dir | |
cd /tmp | |
# install dependecies | |
apt-get install git unzip nodejs openjdk-7-jre-headless wget | |
# download torquebox | |
wget http://torquebox.org/release/org/torquebox/torquebox-dist/$TORQUEBOX_VERSION/torquebox-dist-$TORQUEBOX_VERSION-bin.zip | |
unzip torquebox-dist-$TORQUEBOX_VERSION-bin.zip | |
# copy torquebox to dest dir | |
if [ -d "/opt/torquebox" ]; then | |
read -p "/opt/torquebox already exists, would you like to continue and overwrite it? " prompt | |
if [ $prompt = y ]; then | |
rm -rf /opt/torquebox | |
else | |
exit 1 | |
fi | |
fi | |
mv torquebox-$TORQUEBOX_VERSION/ /opt/torquebox | |
# add torquebox user | |
if id -u torquebox >/dev/null 2>&1; then | |
echo "torquebox user already exists... skipping user creation" | |
else | |
useradd torquebox -s /bin/bash -m | |
chpasswd <<EOL | |
torquebox:torquebox | |
EOL | |
fi | |
chown torquebox.torquebox -R /opt/torquebox/ | |
# set env | |
cat >/etc/profile.d/torquebox.sh <<EOL | |
export TORQUEBOX_HOME=/opt/torquebox | |
export JBOSS_HOME=\$TORQUEBOX_HOME/jboss | |
export JRUBY_HOME=\$TORQUEBOX_HOME/jruby | |
export PATH=\$JRUBY_HOME/bin:$PATH | |
EOL | |
# test | |
. /etc/profile.d/torquebox.sh | |
jruby -v | |
cd /opt/torquebox | |
rake torquebox:upstart:install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment