Skip to content

Instantly share code, notes, and snippets.

@bbeck
Created June 27, 2012 03:53
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save bbeck/3001272 to your computer and use it in GitHub Desktop.
Save bbeck/3001272 to your computer and use it in GitHub Desktop.
Setup Asgard on Ubuntu 12.04
#################
# Update packages
#################
DEBIAN_FRONTEND="noninteractive" sudo apt-get --assume-yes update
DEBIAN_FRONTEND="noninteractive" sudo apt-get --assume-yes upgrade
########################
# Install the Oracle JDK
########################
JDK_URL="http://download.oracle.com/otn-pub/java/jdk/6u32-b05/jdk-6u32-linux-x64.bin"
wget --quiet --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" "${JDK_URL}"
chmod +x "jdk-6u32-linux-x64.bin"
yes | ./jdk-6u32-linux-x64.bin
sudo mkdir -p /usr/lib/jvm/
sudo mv jdk1.6.0_32 /usr/lib/jvm/
for binary in $(ls /usr/lib/jvm/jdk1.6.0_32/bin/j*); do
name=$(basename $binary)
sudo update-alternatives --install /usr/bin/${name} ${name} ${binary} 1
sudo update-alternatives --set ${name} ${binary}
done
rm "jdk-6u32-linux-x64.bin"
################
# Install Tomcat
################
TOMCAT_URL="http://mirror.symnds.com/software/Apache/tomcat/tomcat-7/v7.0.28/bin/apache-tomcat-7.0.28.tar.gz"
wget --quiet --no-cookies "${TOMCAT_URL}"
tar xvfz "apache-tomcat-7.0.28.tar.gz"
mv "apache-tomcat-7.0.28" "tomcat"
rm "apache-tomcat-7.0.28.tar.gz"
# "undeploy" the ROOT war...
rm -rf tomcat/webapps/ROOT
################
# Install Asgard
################
ASGARD_URL="https://github.com/downloads/Netflix/asgard/asgard.war"
wget --quiet --no-cookies "${ASGARD_URL}"
mv "asgard.war" "tomcat/webapps/ROOT.war"
# Need to up the heap that tomcat uses
cat <<-EOF > "tomcat/bin/setenv.sh"
if [ "\$1" == "start" ]; then
export JAVA_OPTS=" \\
-verbose:sizes \\
-Xmx4g -Xms4g \\
-Xmn2g \\
-XX:MaxPermSize=128m \\
-XX:+HeapDumpOnOutOfMemoryError \\
-XX:-UseGCOverheadLimit \\
-XX:+ExplicitGCInvokesConcurrent \\
-XX:+PrintGCDateStamps -XX:+PrintGCDetails \\
-XX:+PrintTenuringDistribution \\
-XX:+CMSClassUnloadingEnabled \\
-XX:+UseConcMarkSweepGC \\
"
else
export JAVA_OPTS=""
fi
EOF
################
# Startup Tomcat
################
tomcat/bin/startup.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment