Apache无法通过ProxyPass显示Drone

时间:2017-07-14 14:50:11

标签: windows apache docker cloudflare drone.io

问题

我遵循了这个Drone Setup Tutorial,但我没有设法通过Apache服务器正确设置Drone CI:

  • 当我尝试通过某个请求访问时,Drone会对任何请求做出响应 IP。 (在我的情况下:http://192.168.99.100:8000/
  • 但我无法通过Apache访问域名地址上的Drone。 (例如:https://drone.suriyaa.tk/

截图

Windows 10上Docker Quickstart终端下调试模式下drone-agent_1的输出:

Output from <code>drone-agent_1</code> in debug mode

无人机与IP完美配合:

Drone under an IP

但无法在域名地址下使用Apache来提供和显示无人机:

Drone under a domain address

有关配置的信息

我的docker-compose.yml文件:

version: '2'

services:
  drone-server:
    image: drone/drone:0.5
    environment:
      DRONE_ADMIN: <an_admin_user>
    ports:
      - 8000:8000
    volumes:
      - C:\Users\Suriyaa\Downloads\DRONE\var\lib\drone:/var/lib/drone/
    restart: always
    environment:
      - DRONE_HOST=http://192.168.99.100
      - DRONE_OPEN=true
      - DRONE_GITHUB=true
      - DRONE_GITHUB_URL=https://github.com
      - DRONE_GITHUB_CLIENT=<github_client_id>
      - DRONE_GITHUB_SECRET=<github_secret>
      - DRONE_GITHUB_SCOPE=repo,repo:status,user:email,read:org
      - DRONE_GITHUB_CONTEXT=continuous-integration/drone
      - DRONE_GITHUB_SKIP_VERIFY=false
      - DRONE_SECRET=<secret>

  drone-agent:
    image: drone/drone:0.5
    command: agent
    restart: always
    depends_on: [ drone-server ]
      - C:\Users\Suriyaa\Downloads\DRONE\var\run\docker.sock:/var/run/docker.sock
    environment:
      - DRONE_SERVER=ws://192.168.99.100:8000/ws/broker
      - DRONE_SECRET=<secret>

我在Apache下的虚拟主机配置:

<VirtualHost *:80>
    ServerName drone.suriyaa.tk
    ServerAlias drone.suriyaa.tk
    ServerAdmin <an_email_address>

    BufferedLogs On

    ProxyPreserveHost On
    ProxyRequests off

    RequestHeader set X-Forwarded-Proto "https"

    ProxyPass /ws/ ws://192.168.99.100:8000/ws/
    ProxyPassReverse /ws/ ws://192.168.99.100:8000/ws/

    ProxyPass / http://192.168.99.100:8000/ retry=1 acquire=3000 timeout=600 Keepalive=On
    ProxyPassReverse / http://192.168.99.100:8000/
</VirtualHost>

我已为Drone启用了重要的Apache模块:

  • mod_headers
  • mod_proxy
  • mod_proxy_http
  • mod_proxy_wstunnel
  

那么我该如何解决这个问题?

修改

我在https://drone.suriyaa.tk/http://192.168.99.100:8000/获得相同的HTML内容:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<meta content="ie=edge" http-equiv="x-ua-compatible"/>
<script src="/cdn-cgi/apps/head/IS7ZAp3ID1yi0rZxe4CgzJCotFY.js"></script><script type="text/javascript">
//<![CDATA[
try{if (!window.CloudFlare) {var CloudFlare=[{verbose:0,p:0,byc:0,owlid:"cf",bag2:1,mirage2:0,oracle:0,paths:{cloudflare:"/cdn-cgi/nexp/dok3v=1613a3a185/"},atok:"650990d51d5b296f966a090423ea0b35",petok:"e2464cb008caccfc151874ac4f4f22d0e2b688b9-1500812575-1800",zone:"suriyaa.tk",rocket:"a",apps:{}}];document.write('<script type="text/javascript" src="//ajax.cloudflare.com/cdn-cgi/nexp/dok3v=85b614c0f6/cloudflare.min.js"><'+'\/script>');}}catch(e){};
//]]>
</script>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet"/>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet"/>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
<link href="/static/app.css" rel="stylesheet"/>
<link href="/static/favicon.ico" rel="icon" type="image/x-icon"/>
</head>
<body>
<div id="app"></div>
<script type="text/rocketscript">
  window.STATE_FROM_SERVER={"csrf":"","user":null};
</script>
<script data-rocketsrc="https://code.getmdl.io/1.1.3/material.min.js" type="text/rocketscript"></script>
<script data-rocketsrc="/static/app.js" type="text/rocketscript"></script>
</body>
</html>

以下是我的浏览器的调试输出: Debug the Console (in Firefox Aurora) Debug the Network (in Firefox Aurora)

  

我认为Cloudflare会阻止内容。

有用的资源

1 个答案:

答案 0 :(得分:0)

在docker-compose文件集的drone-server部分DRONE_HOST

DRONE_HOST=drone.suriyaa.tk

此外,您应该在代理配置中使用DRONE_SERVER=ws://drone-server:8000/ws/broker