Posted by Will on Tuesday, April 29, 2008 at 4:12 PM

Previously on Adventures of a Lead Programmer in a One-man Shop -
"No, please, I can't take it anymore.  I'll do it.  I'll put my code in source control.  I can't bear the .zip file shame any longer.  Just leave me enough money for milk and crackers.  What?  It's free?!?  And easy?!?  You had me at free..."

It's official.  I've begun wriggling out of my inferiority complex and scrambling up toward a shinny, new Superiority Complex.  In my previous post I said that I wanted to couple my source control solution to a Continuous Integration server that will compile my latest bugs edits into a software release.  When researching continuous integration solutions the two that I heard mentioned most often were CruiseControl.NET, an open source project from ThoughtWorks, and TeamCity from JetBrains.  CC.NET is free and JetBrains offers a free professional version so they both passed the first test.  My sense from snooping around on the web though was that TeamCity would be easier to configure.  I can't say if TeamCity was easier than CC.NET because I didn't try both, but I can say that TeamCity was easy.  There were a couple of points I found confusing though.  I've detailed them in the guide below.  I went through the actual setup twice, but if you find any errors to fix or tips to add please let me know. 

This guide is intended to be used in conjunction with the TeamCity documentation.  I have included the relevant links below.  The guide covers installation of TeamCity and installation and configuration of MySQL (also free, of course) to serve as a back end for TeamCity.  For completeness I've included the Subversion setup steps at the beginning.  Refer to Craig Shoemaker's Subversion episode for more details.  On the first run through I set up TeamCity on an instance of Windows 2003 running locally on Virtual Server 2005 R2.  The second setup was on a remote Windows 2003 server that will be used for production.  Windows 2003 is not a requirement.  All of this can be configured on a single machine (i.e., your desktop machine). 

  1. Installed Subversion using SVN 1-Click Setup option. NOTE: During the install I skipped the Tortoise installation step because the bundled version is not the most current.
  2. Installed the current version of Tortoise.
  3. Installed TeamCity 3.1 Profession Edition following their installation documentation.
    • During the setup I chose 8080 as the port because I already had IIS installed using port 80.
    • For the rest of the installation I clicked through, accepting all of the defaults including for the Build Configuration dialog at the end.
    • Logged in for the first time to accept the license agreement and create the administrative account.
  4. Setup MySQL for TeamCity following their documentation.
    • Downloaded MySQL Community Server.  I chose the default typical installation type.
    • At the end of the installation when prompted with the database configuration I chose Detailed Configuration. 
    • I accepted the defaults until I reached the Concurrent Connections option.  I chose Manual Setting and set the value to 5.  Nothing magical, I just picked the lowest one since I'll only be using this for TeamCity.  You can also manually enter any number.
    • On the Default Character Set option page of the wizard I chose the Manual option and set the value to utf8, as suggested in the TeamCity docs. 
    • On the security screen I checked the box to allow remote access.
    • I accepted the default settings on the rest of the pages in the setup wizard.
    • If you make a mistake or want to change the settings later the configuration wizard can be accessed from the start menu (Programs > MySQL > MySQL Server 5.0 > MySQL Server Instance Configuration Wizard).
  5. Downloaded and installed SQLyog MySQL GUI - Community Edition.  Yep, it's free.  I've used it before and recommend it.  This will be used to create and manage databases in your installation of MySQL. 
    • After installation I connected to my instance of MySQL with SQLyog using the root credentials that I specified in the setup.
    • I created a new database for use with TeamCity (DB > Create Database).  I named it...wait for it... TeamCity and set the character set to utf8.
    • I used the User Manager of SQLyog to create an account on the MySQL instance under which TeamCity will access the database.  The User Manager is found in the Tools menu or by clicking the User Manager button on the toolbar.  I set the account name to...you guessed it... teamcityuser and granted full permissions because at the time I had no idea which privileges were necessary.  Certainly it will need Select, Insert, Update, Delete, and Create to create the supporting tables.  I wasn't sure if it would need Drop, Alter, and Grant for the setup as well.  I'll restrict them later once I've got everything working. 
    • At this point I connected to my instance of MySQL using the new credentials to verify everything was working.  If you're following along notice that the tables directory in the newly created teamcity database is empty.
  6. Downloaded and configured the MySQL JDBC driver.  The JDBC driver allows TeamCity to connect to the MySQL database.
    • The TeamCity documentation says to put the MySQL connector jar in the WEB-INF/lib of TeamCity's web application.  The MySQL connector jar file name is mysql-connector-java-5.1.6-bin.jar and is found at the root of the unzipped directory.  I copied it to C:\TeamCity\webapps\ROOT\WEB-INF\lib of my installation. 
    • The next step is to modify the database.mysql.properties file which is found in the C:\Documents and Settings\<account name>\.BuildServer\config directory.  Before renaming and modifying the file as directed in the setup I made a copy of the file as a backup.  I opened the renamed file in notepad and made the following changes:
      1. connectionUrl=jdbc:mysql://localhost/teamcity
      2. connectionProperties.user=teamcityuser
      3. connectionProperties.password=the password I chose
      4. uncommented the connectionProperties.characterEncoding=UTF-8 line by removing the leading # character
    • Saved the changes and closed the file. 

After making the changes I restarted the server.  I opened a web browser on the server and navigated to localhost:8080.  I was prompted to accept the license agreement again and had to recreate the administration account because the old local data store had now been successfully replaced with MySQL.  You'll also notice at this point if you've followed along that SQLyog will show the supporting tables have been created in the database you made for TeamCity.

Now what? 

Next I need to configure TeamCity to automatically perform a build of the code from my source control repository.  I'll cover that in the next thrilling Adventure of a Lead Programmer in a One-Man Shop.

Comments [2]     Categories: Continuous Integration | Source Control              
Friday, July 18, 2008 9:52:47 PM (GMT Standard Time, UTC+00:00)
Why on earth could they not publish this article, as is, in the documentation settings! Brilliant article, thanks for taking the time but where is the second part?
Saturday, July 19, 2008 2:37:56 PM (GMT Standard Time, UTC+00:00)
Glad you found the article useful. That makes it worth it. The follow ups are in Episode 4 and Episode 5.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview