Jenkins Slave 连接到在 Apache 后面运行的 Jenkins Master

问题描述 投票:0回答:1

以下是我的设置:

  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”->“配置全局安全”下,从站配置为在固定 TCP 端口 9020 上运行。

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

  6. 下载 JNLP 启动从站后,连接到主站的小从站代理窗口仍然停留在“正在连接到 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 master 或 apache HTTPD 中才能让从属设备连接?小 Jenkins 从属代理窗口仍然停留在“连接到 jenkins.master.proxy:9020 (重试:11)”上。也许我需要在 apache HTTPD 中添加另一个 VirtualHost 来监听端口 9020?我尝试过这样做,但没有成功。

想法将不胜感激。

apache jenkins jnlp jenkins-agent
1个回答
2
投票
看看这篇文章:

Jenkins:如何在 Nginx 反向代理后面配置 Jenkins 以便 JNLP 从站连接

我通过在码头配置上将系统属性

hudson.TcpSlaveAgentListener.hostName 设置为 jenkins.master.host 解决了这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.