drone.io apache 说明过时了吗?



Drone.io 0.8的发行说明说:"请注意,grpc使用http/2,不能通过反向代理(即nginx(路由。如果您使用的是nginx,则必须绕过代理并将其直接连接到服务器",但是Apache设置说明使用"ProxyPassReverse"设置。

我相信这种不一致导致了这个错误:

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: *

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}

*我的阿帕奇文件 *

/etc/apache2/ports.conf

# 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

<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 上运行

在你的例子中,8000是普通的http,9000是grpc。我希望 apache 代理能够以您配置的方式适用于无人机 ui 端口 (8000(。我将利用 docker-compose 的网络功能来允许服务器和代理都通过端口 9000 进行通信。

像这样:

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:

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

我通过删除所有旧图像和容器,然后运行sudodocker-compose up来解决此问题。

我仍然对此有问题。不幸的是,在调试 docker 的过程中,我以某种方式清除了我的 apache 服务器和 samba (网络计算机看不到它们(,但这完全是一个不同的问题。因此,我的 docker-compose 脚本无法完全工作,但它不再告诉我该端口已被使用。现在看来,问题是Apache没有提供gogs,所以无人机无法与它交谈。

相关内容

  • 没有找到相关文章

最新更新