【问题标题】:Jenkins Slave to connect to Jenkins Master which is running behind ApacheJenkins Slave 连接到在 Apache 后面运行的 Jenkins Master
【发布时间】:2017-03-01 15:12:36
【问题描述】:

以下是我的设置:

  1. Jenkins master 在服务器上运行,假设它的域名是 jenkins.master.host,即直接访问 Jenkins master 的 URL 是http://jenkins.master.host:8080

  2. Apache HTTPD 在不同的服务器上运行,假设它的域名是 jenkins.master.proxy。 HTTPD 配置为监听 80 端口并代理到 jenkins master,即通过 apache 访问 Jenkins master,使用 URL http://jenkins.master.proxy

  3. 在“管理 Jenkins”->“配置系统”下,Jenkins URL 被配置为 apache httpd URL,即http://jenkins.master.proxy

  4. 在“管理 Jenkins”->“配置全局安全”下,slave 配置为在固定的 TCP 端口 9020 上运行。

  5. 在“管理 Jenkins”->“管理节点”下,我创建了一个名为“TestSlave”的新节点。

  6. 下载JNLP启动slave后,连接master的小slave代理窗口一直卡在“Connecting to jenkins.master.proxy:9020”

JNLP 如下:

<jnlp codebase="http://jenkins.master.proxy/computer/TestSlave/" spec="1.0+">
    <information>
        <title>Agent for TestSlave</title>
        <vendor>Jenkins project</vendor>
        <homepage href="https://jenkins-ci.org/"/>
    </information>
    <security>
        <all-permissions/>
    </security>
    <resources>
        <j2se version="1.7+"/>
        <jar href="http://jenkins.master.proxy/jnlpJars/remoting.jar"/>
        <property name="hudson.showWindowsServiceInstallLink" value="true"/>
    </resources>
    <application-desc main-class="hudson.remoting.jnlp.Main">
        <argument>*******************************************</argument>
        <argument>TestSlave</argument>
        <argument>-url</argument>
        <argument>http://jenkins.master.proxy/</argument>
    </application-desc>
</jnlp>

Apache HTTPD 配置如下:

<VirtualHost *:80>
    ServerName jenkins.master.proxy
    ProxyPass / http://jenkins.master.host:8080/ nocanon Keepalive=On
    ProxyPassReverse / http://jenkins.master.host:8080/
    AllowEncodedSlashes On
    ErrorLog logs/jenkins/error.log
</VirtualHost>

我需要将一些配置放入 Jenkins 主服务器或 apache HTTPD 中以使从服务器连接吗?小詹金斯奴隶代理窗口仍然停留在“连接到 jenkins.master.proxy:9020 (retrying:11)”。也许我需要在 apache HTTPD 中添加另一个 VirtualHost 来监听端口 9020?我尝试过这样做,但没有成功。

我们将不胜感激。

非常感谢

【问题讨论】:

    标签: apache jenkins jenkins-slave


    【解决方案1】:

    看看这个帖子:Jenkins: How to configure Jenkins behind Nginx reverse proxy for JNLP slaves to connect

    我通过在我的码头配置中将系统属性 hudson.TcpSlaveAgentListener.hostName 设置为 jenkins.master.host 解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-26
      • 2015-07-28
      • 1970-01-01
      • 2012-08-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-24
      相关资源
      最近更新 更多