Reputation: 1009
The release notes for Drone.io 0.8 say "Please note that grpc uses http/2 and cannot be routed through a reverse proxy (i.e. nginx). If you are using nginx you must bypass and connect the agent directly with the server." but the Apache setup instructions use the "ProxyPassReverse" setting.
I believe this inconsistency is causeing this error:
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.
* here's my ~/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}
* my apache files *
/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
All of this is running on a raspberry pi 2
Upvotes: 1
Views: 458
Reputation: 1009
The cause of this specific problem was the ports the docker container was trying to use were already in use. This was because restart: "always"
was set which, according to the docs, means old versions of the container with errors were using ports 9000 and 8000 preventing my new containers from using them.
I fixed this by removing all old images and containers, then running sudo docker-compose up
.
I'm still having issues with this. Unfortunately, in the process of debugging docker, I wiped out my apache server and samba some how (network computers can't see them), but that's a different question entirely. Due to this, my docker-compose script doesn't work entirely, but it no longer tells me the port is already in use. Now it seems the problem is Apache isn't serving gogs, so drone can't talk to it.
Upvotes: 0
Reputation: 611
In your case 8000 is plain old http and 9000 is grpc. I would expect the apache proxy to work for the drone ui port (8000) the way you have it configured. I would utilize the networks feature of docker-compose to allow the server and agent to both talk over port 9000.
Something like this:
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:
Upvotes: 1