VPN and EC2 cloud agent

Hello everybody,

I've setup an agent on EC2 that connects to my TeamCity server using VPN. Everything is working fine when I manually start the agent instance. The server is communicating with the agent using the agent's internal IP in the 10.0.42.x range. But when the instance is started by TeamCity the server is trying to connect to the agent using its EC2 public IP. This doesn't work since I don't allow access to port 9090 in my EC2 security group (also it defeats the purpose of having a VPN since the communication is no longer encrypted).

From the client logs it seems the agent is reporting its internal IP as first IP even when the instance is started using TeamCity (I replaced some information by *)

INFO - buildServer.AGENT.registration - Registering on server https://www.***.de/teamcity, AgentDetails{Name='EC2-***', AgentId=10, BuildId=3879, AgentOwnAddress='null', AlternativeAddresses=[10.0.42.50, 2001:0:9d38:*:*:*, 10.106.*.*, 54.195.*.*], Port=9090, Version='30101', PluginsVersion='30101-md5-fa151212818c29449df53fb0a8570f82', AvailableRunners=[...], AuthorizationToken='***', PingCode='***'}


I noticed that the only difference to a working registation is the server name. For example this registration works:

INFO - buildServer.AGENT.registration - Registering on server http://10.0.42.1/teamcity ...everything else like before...

Lo and behold when I set Administration > Global Settings > Server URL to "http://10.0.42.1/teamcity/" the server is communicating with the agent using its internal IP.

But of course I don't want the internal IP in the server URL since now the URLs in the mails generated by TeamCity no longer work. So is there a way to prevent the EC2 integration from overwriting the server URL in the client's settings? Or am I just overlooking something obvious?

Thanks for your help,

  Thomas
1 comment
Comment actions Permalink

Hi,

As workaround please try to map hostname (https://www.***.de/teamcity) to IP address (10.0.42.1) in hosts files on the agent instance.

0

Please sign in to leave a comment.