TeamCity setup in linux

Table of Contents

  1. Overview
  2. Setup
    • Preparation
    • Installation
    • Auto/Manual start
    • Create user and project
    • Build agent
      • General setting
      • Version Control Settings
      • Build Steps
  3. Troubleshooting


Technologies used
Linux Mint 14 64bit
JDK 1.6.0_33
TeamCity Version 7.1.4 (build 24331)


1. TeamCity
TeamCity is a user-friendly continuous integration (CI) server for developers and build engineers. It is trivial to setup, manage and use.

It scales perfectly for a company or a team of any size. And importantly it is absolutely free for small teams.

2. Setup
2.1. Preparation
Download latest TeamCity version from here. You can either choose free professional edition or enterprise edition with 60 days trial.

2.2. Installation
Unzip/extract the downloaded file to directory where TeamCity will be installed, I’ve mine extracted to “/usr/sw/TeamCity/”.

Change the owner of installation directory from root to user. And create a directory named ‘logs’ if it doesn’t exists inside TeamCity installation directory and assign appropriate permissions. The logs directory will contain all log files generated by TeamCity. These logs will be very helpful if something goes wrong.

2.3. Auto/Manual start
Next, we can create a init script that’ll start the TeamCity when system’ll boot.

The script iteself is simple and basic, contains start and stop command for TeamCity.

#!/bin/sh
# /etc/init.d/teamcity -  startup script for teamcity
export TEAMCITY_DATA_PATH="/var/TeamCity/.BuildServer"

case $1 in
start)
start-stop-daemon --start --exec /usr/sw/TeamCity/bin/teamcity-server.sh start
;;
stop)
start-stop-daemon --start --exec  /usr/sw/TeamCity/bin/teamcity-server.sh stop
;;
esac
exit 0

This init script should be updated and register to system. Now TeamCity will start automatically everytime the daemon starts.

sudo update-rc.d teamcity defaults

Or, we can run TeamCity by executing commands in terminal. By executing the command “./teamcity-server.sh start” from will start the TeamCity server.

$ /usr/sw/TeamCity/bin/./teamcity-server.sh start

2.4 Create user and project
Since, it’s first time TeamCity is running, configuration will take sometime, so have patience.

When the configuration is done, it’ll ask you to create a administrator level user. Enter a username, password and confirm it, admin user is created.

Provide project name and description to create your first project. Creating project is first step but TeamCity won’t start building the project just yet. We need to add configuration that will checkout project from VCS, manage build artifact paths, build counter, build tool etc. It is called build agent in general.

2.5 Build Agent
A Build Agent is a piece of software that actually executes a build process. TeamCity can have numbers of these build agent as per team and project requirements.
2.5.1 General setting

Name: Test Build
Build number format: {0}
Build counter: 1
Artifact paths: test-project/war/Root.war
build/build.properties

For more on build number format, look here
For more on artifact paths, look here

2.5.2 Version Control Settings
Click ‘Create and attach new VCS root’ to setup in which version control system project is hosted, where and branch name that should be checkout for build.

Type of VCS: Mercurial
VCS Root Name: Test Project
Pull Changes From: http://localhost:90/hg/test-project
Default Branch: default
Checking interval: use global server setting (60 seconds)

Test connection if the TeamCity can find the mentioned VCS and project, and save the changes.

2.5.3 Build Steps

Runner type: Maven
Execute step: Only if all previous steps were successfull
Goals: clean install compile

Save the changes.
For more on which execute steps to choose, look here

3. Troubleshooting:
1. Running TeamCity with 64 bits JVM might lead to perm gem space issue. Either increase the perm gem size or refer to here

Leave a comment

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.