-
Install
TeamCity.conf
andTeamCityAgent.conf
in /etc/init/ -
Create TeamCity in /etc/default/TeamCity
-
Make sure TEAMCITY_DATA_PATH and TEAMCITY_SERVER_PATH are owned by www-data
-
Start TeamCity
sudo service TeamCity start
-
Start TeamCityAgent
sudo service TeamCityAgent start
Last active
July 20, 2018 09:52
-
-
Save ismell/6284563 to your computer and use it in GitHub Desktop.
Ubuntu Upstart Script for Team City
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
# TeamCity Configuration Options | |
TEAMCITY_SERVER_ENABLED=yes | |
TEAMCITY_SERVER_PATH="/var/lib/TeamCity/8.0.3" | |
TEAMCITY_SERVER_MEM_OPTS="-Xms750m -Xmx750m -XX:MaxPermSize=270m" | |
TEAMCITY_DATA_PATH="/var/lib/TeamCity/BuildServer" | |
TEAMCITY_SERVER_OPTS="" | |
TEAMCITY_AGENT_ENABLED=yes | |
TEAMCITY_AGENT_PATH="/var/lib/TeamCity/8.0.3/buildAgent" | |
TEAMCITY_AGENT_MEM_OPTS="-Xmx384m" | |
TEAMCITY_AGENT_CONFIG_FILE="/var/lib/TeamCity/BuildAgent/buildAgent.properties" | |
TEAMCITY_AGENT_LOG_DIR="/var/lib/TeamCity/BuildAgent/logs" | |
TEAMCITY_AGENT_OPTS="" |
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
description "TeamCity Server" | |
start on runlevel [2345] | |
stop on runlevel [016] | |
# TeamCity can take a while to shutdown | |
kill timeout 30 | |
respawn | |
pre-start script | |
[ ! -f /etc/default/TeamCity ] && { stop; exit 0; } | |
. /etc/default/TeamCity | |
[ "$TEAMCITY_SERVER_ENABLED" != "yes" ] && { stop; exit 0; } | |
exit 0 | |
end script | |
script | |
. /etc/default/TeamCity | |
CATALINA_OPTS="$CATALINA_OPTS $TEAMCITY_SERVER_OPTS -server $TEAMCITY_SERVER_MEM_OPTS -Dlog4j.configuration=\"file:${TEAMCITY_SERVER_PATH}/conf/teamcity-server-log4j.xml\" -Dteamcity_logs=${TEAMCITY_SERVER_PATH}/logs -Djava.awt.headless=true" | |
export CATALINA_OPTS | |
export TEAMCITY_DATA_PATH | |
exec start-stop-daemon --start -c www-data --exec "${TEAMCITY_SERVER_PATH}/bin/catalina.sh" -- run | |
end 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
description "TeamCity Build Agent" | |
start on runlevel [2345] | |
stop on runlevel [016] | |
# TeamCity can take a while to shutdown | |
kill timeout 30 | |
respawn | |
pre-start script | |
[ ! -f /etc/default/TeamCity ] && { stop; exit 0; } | |
. /etc/default/TeamCity | |
[ "$TEAMCITY_AGENT_ENABLED" != "yes" ] && { stop; exit 0; } | |
[ ! -f "${TEAMCITY_AGENT_PATH}/bin/agent.sh" ] && { stop; exit 0; } | |
exit 0 | |
end script | |
script | |
. /etc/default/TeamCity | |
export TEAMCITY_AGENT_MEM_OPTS | |
export TEAMCITY_AGENT_OPTS | |
export CONFIG_FILE="${TEAMCITY_AGENT_CONFIG_FILE}" | |
export LOG_DIR="${TEAMCITY_AGENT_LOG_DIR}" | |
exec start-stop-daemon --start -c www-data --exec "${TEAMCITY_AGENT_PATH}/bin/agent.sh" -- run | |
end script |
For TEAMCITY 9.02 edit in /etc/default/TeamCity :
TEAMCITY_AGENT_ENABLED=yes
TEAMCITY_AGENT_PATH="/var/TeamCity/buildAgent"
TEAMCITY_AGENT_MEM_OPTS="-Xmx384m"
TEAMCITY_AGENT_CONFIG_FILE="/var/TeamCity/buildAgent/conf/buildAgent.properties"
TEAMCITY_AGENT_LOG_DIR="/var/TeamCity/buildAgent/logs"
TEAMCITY_AGENT_OPTS=""
You are missing chdir
in start-stop-daemon:
exec start-stop-daemon --start -c teamcity --chdir "${TEAMCITY_SERVER_PATH}/bin" --exec "${TEAMCITY_SERVER_PATH}/bin/catalina.sh" -- run
Otherwise process would try to create velocity.log
in the /
folder and would spam log with access denied errors.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's better to start TeamCity server with teamcity-server.sh, but it need some patching to allow 'run' command ;)