4

We have a reasonable-sized Team City installation and currently I am planning to add another 25 agents, 5 agents per machine. So far I was doing the installation manually:

  1. Log into the server
  2. Download and run agentInstaller.exe, add the agent number to the name
  3. Open a command prompt as administrator and run the script to install the service (given a service name with the agent number appended)
  4. Open the Services configuration settings, change the user that the service is running as and start the service

Is there a simple way to script as many of these steps as possible? Ideally I would like to log into the box, and run a single script with agent number to do steps 2-4.

Grzenio
  • 271
  • 2
  • 5
  • 16

1 Answers1

3

How about making Chocolatey do this:

cinst TeamCityAgent -params 'serverurl=http://servername:8081 agentName=Build1'

It seems that you still have to open firewall ports, though. This is from Asger Hallas's comment in the link above:

New-NetFirewallRule -DisplayName "Allow TeamCity" -Direction Inbound -Protocol TCP -LocalPort 9090 -Program "c:\program files\java\jre7\bin\java.exe" -Action Allow

The installation of Chocolatey itself is a PowerShell one-liner, too:

iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

I have yet to find a way for a scripted installation of the TeamCity server, though.

krlmlr
  • 493
  • 1
  • 5
  • 17
  • That looks promising, where can I find the documentation (i.e. list of options) for this package? – Grzenio Feb 11 '15 at 10:48
  • @Grzenio: If you click the "Show" link (close to "tools\chocolateyInstall.ps1") on [the TeamCity package page](https://chocolatey.org/packages/TeamCityAgent), it shows the source code of the installation routine. In particular, you can see that `serverUrl`, `agentDir`, `agentName` and `ownPort` are valid options. I'm not sure if there's better documentation than that. – krlmlr Feb 11 '15 at 12:41
  • @Grzenio: Did this work for you? – krlmlr Feb 12 '15 at 07:31
  • You can do the server, but you need to use some PowerShell to submit the administrator password and database type pages. There is an Azure template I've seen for deploying TeamCity Server in this manner. – dragon788 Mar 11 '17 at 00:02