首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >drone.io apache的使用说明是否过时了?

drone.io apache的使用说明是否过时了?
EN

Stack Overflow用户
提问于 2018-08-16 10:32:00
回答 2查看 352关注 0票数 1

Drone.io 0.8的release notes说“请注意,grpc使用的是http/2,不能通过反向代理(即nginx)进行路由。如果你使用nginx,你必须绕过代理,直接连接到服务器上。”但是Apache setup instructions使用"ProxyPassReverse“设置。

我认为这种不一致是导致这个错误的原因:

代码语言:javascript
复制
user@host:~/drone $ docker-compose up
Recreating drone_drone-server_1

ERROR: for drone-server  Cannot start service drone-server: driver failed programming external connectivity on endpoint drone_drone-server_1 (30c01687260914ed6f3e3be7fab392a2dd8ea01e679dfe123e9faf9d6284e607):  (COMMAND_FAILED: '/sbin/iptables -w2 -t nat -A DOCKER -p tcp -d 0/0 --dport 9000 -j DNAT --to-destination 172.19.0.2:9000 ! -i br-b4723086fd08' failed: )
ERROR: Encountered errors while bringing up the project.

*这是我的~/docker-compose.yaml:*

代码语言:javascript
复制
version: '2'

services:
  drone-server:
    image: drone/drone:0.8

    ports:
      - 8000:8000
      - 9000:9000
    volumes:
      - /var/lib/drone:/var/lib/drone/
    restart: always
    environment:
      - DRONE_OPEN=true
      - DRONE_ADMIN=gogs
      - DRONE_HOST=http://<hostname>:8000
      - DRONE_GOGS=true
      - DRONE_GOGS_URL=http://<hostname>:3000
      - DRONE_SECRET=${DRONE_SECRET}
      - DRONE_GOGS_SKIP_VERIFY=true

  drone-agent:
    image: drone/agent:0.8

    command: agent
    restart: always
    depends_on:
      - drone-server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DRONE_SERVER=drone-server:9000
      - DRONE_SECRET=${DRONE_SECRET}

*我的apache文件*

/etc/apache2/ports.conf

代码语言:javascript
复制
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-available/000-default.conf

Listen 80
Listen 8000
<IfModule ssl_module>
        Listen 443
</IfModule>

<IfModule mod_gnutls.c>
        Listen 443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

/etc/apache2/sites enabled/000-default.conf

代码语言:javascript
复制
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>
<VirtualHost *:8000>
        ProxyPreserveHost On

        #from docs.drone.io

        #Requestheader set X-Forwarded-Proto "https"

        #ProxyPass /ws/ ws://localhost:8000/ws/
        #ProxyPassReverse /ws/ ws://localhost:8000/ws/

        ProxyPass / http://127.0.0.1:8000/
        ProxyPassReverse / http://127.0.0.1:8000/
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

所有这些都是在树莓派2上运行的。

EN

回答 2

Stack Overflow用户

发布于 2018-08-18 01:29:06

在您的例子中,8000是普通的老式http,9000是grpc。我希望apache代理能够按照您配置的方式为drone ui端口(8000)工作。我将利用docker-compose的网络特性来允许服务器和代理都通过端口9000进行对话。

如下所示:

代码语言:javascript
复制
version: '2'

services:
  drone-server:
    image: drone/drone:0.8

    ports:
      - 8000:8000
      - 9000:9000
    volumes:
      - /var/lib/drone:/var/lib/drone/
    restart: always
    environment:
      - DRONE_OPEN=true
      - DRONE_ADMIN=gogs
      - DRONE_HOST=http://<hostname>:8000
      - DRONE_GOGS=true
      - DRONE_GOGS_URL=http://<hostname>:3000
      - DRONE_SECRET=${DRONE_SECRET}
      - DRONE_GOGS_SKIP_VERIFY=true
    networks
      - drone

  drone-agent:
    image: drone/agent:0.8

    command: agent
    restart: always
    depends_on:
      - drone-server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DRONE_SERVER=drone-server:9000
      - DRONE_SECRET=${DRONE_SECRET}
    networks
      - drone     

   networks:
     drone:
票数 1
EN

Stack Overflow用户

发布于 2018-08-30 23:51:36

此特定问题的原因是docker容器试图使用的端口已在使用中。这是因为设置了restart: "always",即according to the docs,这意味着有错误的旧版本容器正在使用端口9000和8000,从而阻止我的新容器使用它们。

我用removing all old images and containers修复了这个问题,然后运行sudo docker-compose up

我还是有点问题。不幸的是,在调试docker的过程中,我以某种方式清除了我的apache服务器和samba (网络计算机看不到它们),但这是完全不同的问题。因此,我的docker-compose脚本不能完全工作,但它不再告诉我端口已经在使用中。现在看来问题是阿帕奇不提供gogs服务,所以无人机不能和它说话。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51868844

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档