Wednesday, February 27, 2013

Install TEAMCITY Server on Ubuntu 12.04 LTS

Install teamcity on Ubuntu 12.04 LTS

#adduser --system --shell /bin/bash --gecos 'TeamCity Build Control' --group --disabled-password --home /opt/teamcity teamcity
http://download.jetbrains.com/teamcity/TeamCity-7.1.4.tar.gz
tar -xzvf TeamCity-7.1.4.tar.gz
Ensure you have JRE or JDK installed and JAVA_HOME environment variable is pointing to the Java installation directory. Latest Oracle Java 1.6 update is recommended.

teamcity@teamcity:~/TeamCity$ which java
teamcity@teamcity:~/TeamCity$

//nothing comes :) - go to oracle site and download JDK 1.6 (and not 1.7) , please do not install openJDK

http://www.oracle.com/technetwork/java/javase/downloads/index.html
Select the version of java you want to install
for our case we will install Java SE 6 Update 41 (JDK) though JRE is just fine for TC server part (Agents though need JDK only)

chmod +x jdk-6u41-linux-x64.bin
root@teamcity:/var/local# ./jdk-6u41-linux-x64.bin

root@teamcity:/var/local# ls
jdk1.6.0_41  jdk-6u41-linux-x64.bin
root@teamcity:/var/local#
sudo mkdir -p /usr/lib/jvm/
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_41/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_41/bin/javac" 1

root@teamcity:/usr/lib/jvm# which java
/usr/bin/java
root@teamcity:/usr/lib/jvm# java -version
java version "1.6.0_41"
Java(TM) SE Runtime Environment (build 1.6.0_41-b02)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01, mixed mode)
root@teamcity:/usr/lib/jvm#

if you have multiple version of java then you can choose the one that you may want to use for your application
sudo update-alternatives --config java

Setting up the Database

sudo apt-get install mysql-server
root@teamcity:/usr/lib/jvm# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.

Installation:



Create an empty database for TeamCity in MySQL and grant permissions to modify this database to a user from which TeamCity will work with this database.
mysql> create database teamcity;
mysql> create user 'tcclient'@'localhost' identified by 'your_password_here';
mysql> grant all privileges on teamcity.* to 'tcclient'@'localhost' with grant option;
mysql> exit;



http://hostname:8111/mnt

Please review the settings below before proceeding with the first TeamCity start.

TeamCity stores configuration settings on disk in a Data Directory which is empty or does not contain TeamCity settings right now.

Location of the Data Directory: /opt/teamcity/.BuildServer

Proceed to use the directory and start with a fresh installation.

Press "Proceed"
It will create the database  and ask for license agreement
Then create a userAccount individually or Configure LDAP






It will create a .BuildServer directory  under teamcity user home directory.
drwxrwxr-x  6 teamcity teamcity 4096 Feb 27 18:16 .BuildServer

drwxr-xr-x 12 teamcity teamcity 4096 Feb 27 18:14 TeamCity
-rw-------  1 teamcity teamcity  849 Feb 27 18:12 .viminfo

teamcity@teamcity:~/.BuildServer/config$ cp -a database.mysql.properties.dist database.properties
teamcity@teamcity:~/.BuildServer/config$ vim database.properties

# Database: MySQL 

connectionUrl=jdbc:mysql://localhost:3306/teamcity
connectionProperties.user=tcclient
connectionProperties.password=xxxxxxxxxx



TeamCity Data Directory is the directory on the file system used by TeamCity server to store configuration settings, build results and current operation files. The directory is the primary storage for all the configuration settings and holds the data critical to the TeamCity installation.

Download the MySQL JDBC driver from http://dev.mysql.com/downloads/connector/j/.
Install MySQL connector driver jar (mysql-connector-java-*-bin.jar from the downloaded archive).
tar -xvf mysql-connector-java-5.1.22.tar


You will need to download the Java driver and put it into .BuildServer/lib/jdbc directory (create it if necessary).
teamcity@teamcity:~/.BuildServer/lib/jdbc$ ls
mysql-connector-java-5.1.22-bin.jar


If you want to connect the Teamcity Server with the ldap server then use the file ldap-config.properties which is under
teamcity@teamcity:~/.BuildServer/config$


main-config.xml Configuration
Configure login-module settings of /config/main-config.xml as follows:


   
   
    Welcome to TeamCity, your team building environment!
   
   



=========Performance===========
If you need a high performing Teamcity environment then you may want to look for few things like

- User external database (mySql) , use InnoDB as database engine.
-TC is I/O intensive and  high speed disk drives are good for performance  e.g SAS 15K RPM or SSD
- Separate OS and Teamcity installation drive . RAID 1 is Pretty good.
-multiple CPU are good bet as Teamcity supports multi thread env.
-RAM - 32 GB-64 GB . More tests you are running per build more RAM you are going to need.
-Git is more memory intensive on server side in comparison to SVN.
- Giga bit LAN is a plus :)


Sizing the Generations
  • The -Xmx value determines the size of the heap to reserve at JVM initialization.
  • The -Xms value is the space in memory that is committed to the VM at init. The JVM can grow to the size of -Xmx.
  • The difference between -Xmx and -Xms is virtual memory (virtually committed)
Total Heap
  • Total available memory is the most important factor affecting GC performance
  • By default the JVM grows or shrinks the heap at each GC to keep the ratio of free space to live objects at each collection within a specified range.
    • -XX:MinHeapFreeRatio - when the percentage of free space in a generation falls below this value the generation will be expanded to meet this percentage. Default is 40
    • -XX:MaxHeapFreeRatio - when the percentage of free space in a generation exceeded this value the generation will shrink to meet this value. Default is 70
  • For server applications
    • Unless you have problems with pauses grant as much memory as possible to the JVM
    • Set -Xms and -Xmx close to each other or equal for a faster startup (removes constant resizing of JVM). But if you make a poor choice the JVM can't compensate for it.
    • Increase memory sa you increase # of processors because memory allocation can be parallelized.
  • Types of Collectors
    • Everything to this point talks about the default garbage collector, there are other GC's you can use
    • Throughput Collector - Uses a parallel version of the young generation collector
      • -XX:+UseParallelGC
      • Tenured collector is the same as in default
    • Concurrent Low Pause Collector
      • Collects tenured collection concurrently with the execution of the app.
      • The app is paused for short periods during collection
      • -XX:+UseConcMarkSweepGC
      • To enable a parallel young generation GC with the concurrent GC add -XX:+UseParNewGC to the startup. Don't add -XX:+UseParallelGC with this option.
    • Incremental Low Pause Collector
      • Sometimes called Train Collector
      • Collects a portion of the tenured generation at each minor collection.
      • Tries to minimize large pause of major collections
      • Slower than the default collector when considering overall throughput
      • Good for client apps (my observation)
      • -Xincgc
    • Don't mix these options, JVM may not behave as expected
  •  Measurements with the Incremental Collector
    • -verbose:gc and -XX:+PrintGCDetails
  • If the garbage collector has become a bottleneck, you may wish to customize the generation sizes. Check the verbose garbage collector output, and then explore the sensitivity of your individual performance metric to the garbage collector parameters.






===============================================
http://www.delcomproducts.com/products_usblmp.asp

CCTRAY API:
http://tc.loyal3.com/httpAuth/app/rest/cctray/projects.xml

DOCS:
http://confluence.jetbrains.com/display/TW/REST+API+Plugin#RESTAPIPlugin-BuildStatusIcon

No comments:

Post a Comment