Instantly share code, notes, and snippets.

@aeisele aeisele/startCI.sh
Last active Aug 29, 2015

Embed
What would you like to do?
#!/bin/bash
set -e
buildDir="/build"
buildSize="2G"
buildEntry="tmpfs $buildDir tmpfs noatime,nodev,nosuid,size=$buildSize 0 0"
tcParent="/opt"
tcHome="$tcParent/TeamCity"
tcArchive="TeamCity-8.1.2.tar.gz"
tcUrl="http://download.jetbrains.com/teamcity/${tcArchive}"
function setupBuildDir {
if [ ! -d $buildDir ]; then
mkdir /build
fi
if grep -q -E "^tmpfs[[:blank:]]+${buildDir}" /etc/fstab; then
echo "fstab seems to already contain an entry for $buildDir"
else
echo $buildEntry >> /etc/fstab
fi
mount $buildDir
}
function installTc {
wget $tcUrl
tar xfz $tcArchive
mv TeamCity $tcParent
}
function setupAgent {
mkdir -p $buildDir/agent/{work,temp}
sed -i "s|\(workDir=\).*\$|\1${buildDir}/agent/work|" $tcHome/buildAgent/conf/buildAgent.properties
sed -i "s|\(tempDir=\).*\$|\1${buildDir}/agent/temp|" $tcHome/buildAgent/conf/buildAgent.properties
}
if mount | grep $buildDir > /dev/null; then
echo "$buildDir seems to be mounted already"
else
setupBuildDir
fi
if [ ! -d $tcHome ]; then
installTc
fi
if [ ! -d $buildDir/agent ]; then
setupAgent
fi
cd $tcHome
bin/runAll.sh start
echo "TeamCity (with ramdisk agent) is running at http://localhost:8111 - have fun"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment