CloudBees Core on Traditional Platform JNLP connectivity Best Practices

Most of the connectivity problems between Operations Center (OC), the Client Masters (CM), and JNLP Agents usually come from the same causes:

  • The JNLP communication is going through intermediate routing elements like HAProxy…/ELB. The main problem on this case, is that usually the configuration is done as if the protocol was HTTP. However, JNLP is a TCP protocol which requires to set-up a timeout of 15 minutes in order to avoid disconnections produced by these intermediate elements. The best approach is explained on this article, which is to bypass this elements.
  • Add in all the CMs the OC hostname under Manage Jenkins -> Manage plugins [Advanced tab] in the No Proxy Host section. If the URL to access OC is http://oc.jenkins.example.com, then it is expected to have just oc.jenkins.example.com in the No Proxy Host section.

Infrastructure

Bypass the intermediate elements in the CloudBees Jenkins platform (CJPOC-CJPCM) communication

The ELB/…/HAProxy is usually not correctly configured for the JNLP port. The recommendation is NOT to use the ELB/…/HAProxy, but instead bypass this intermediate element by: adding this Java Argument in OC -Dhudson.TcpSlaveAgentListener.hostName=<OC_MACHINE_HOSTNAME>. If you don’t want to perform a restart, after adding the Java Argument you can use run in the Script Console TcpSlaveAgentListener.CLI_HOST_NAME="CJOC_HOSTNAME"

Notes:

1. Get the hostname of you instance by Manage Jenkins -> Script Console println java.net.InetAddress.getLocalHost().
2. For dynamic IPs you could use Groovy hook script with TcpSlaveAgentListener.CLI_HOST_NAME=java.net.InetAddress.getLocalHost().

CJPOC Example

To check if the set-up was correctly performed you can run the command below and check that the header X-Jenkins-CLI-Host is present with the value we added.

$curl -I http://cm-1.jenkins.example.com:8080/
HTTP/1.1 200 OK
Date: Thu, 13 Jul 2017 11:49:29 GMT
X-Content-Type-Options: nosniff
Set-Cookie: JSESSIONID.7b40bd3d=hbc0fd3lhh0w1bg9cusqtea8r;Path=/;HttpOnly
Expires: 0
Cache-Control: no-cache,no-store,must-revalidate
X-Hudson-Theme: default
Content-Type: text/html;charset=UTF-8
X-Hudson: 1.395
X-Jenkins: 2.60.1.1
X-Jenkins-Session: 1af0d556
X-Hudson-CLI-Port: 54789
X-Jenkins-CLI-Port: 54789
X-Jenkins-CLI2-Port: 54789
X-Jenkins-CLI-Host: cjpcm-1.jenkins.example.com
X-Frame-Options: sameorigin
X-Instance-Identity: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlx9/b60USmo2Eexm8TBtkcG881tkAP77iBbct0gDlSLaDdhbP7thD86Mu3WQVxmq23Rzqd/WR2VpN+JaQCQYttQ/KdxqnkTPZFO4vYy7n9E0pWgw8VKVZ9WEPfwfDEf4tHm/NmT4i43YrG4oeJvrVrGpwDp7vBviZNzQqOlcxLsr6njOX3+aZMYGkSdkduKgtKB5tV5qJSQxNFw/3I9HuxSZlaWMyni9NhAs1jGJ7EaxKT3Jtix56EY+vIRY43YhLU6YvnU/O6R2H9KdmxyFjthr1H3x8Wjfo1qYqePIL73bjA5guRyZZirbKL+1ep9LjTqJZYpH3EUjGoiBtYeyiwIDAQAB
Content-Length: 17904
Server: Jetty(9.2.z-SNAPSHOT)

Application

Only in case a Proxy is configured in the CloudBees Jenkins platform Client Masters (CJPCM)

In case there is proxy set-up in the CM under Manage Jenkins -> Manage plugins [Advanced tab] you must add the OC hostname into the No Proxy Host section at the CM level. i.e If the URL to access OC is http://oc.jenkins.example.com, then it is expected to have just oc.jenkins.example.com in the No Proxy Host section at the CM level.

Suffering connectivity issues?

Please, file a support ticket on the CloudBees support platform attaching proactively the information requested in:

Have more questions?

0 Comments

Please sign in to leave a comment.