Drone.io 0.8的release notes说:“请注意,grpc使用http / 2,并且不能通过反向代理(即nginx)进行路由。如果使用nginx,则必须绕过并直接连接代理与服务器。”但Apache setup instructions使用“ 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}
*我的apache文件*
/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上运行
答案 0 :(得分:1)
在您的情况下,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:
答案 1 :(得分:0)
此特定问题的原因是docker容器尝试使用的端口已在使用中。这是因为设置了restart: "always"
,according to the docs表示有错误的旧版本容器正在使用端口9000和8000,从而阻止了我的新容器使用它们。
我通过removing all old images and containers解决了这个问题,然后运行sudo docker-compose up
。
我仍然对此有疑问。不幸的是,在调试docker的过程中,我清除了apache服务器,并对samba做了一些操作(网络计算机看不到它们),但这完全是另一个问题。因此,我的docker-compose脚本无法完全正常运行,但不再告诉我该端口已在使用中。现在看来问题出在阿帕奇(Apache)不在服役,所以无人机无法与之对话。