Hello,
I can’t seem to connect Gitea to Drone with the supported integration. I get errors upon signing in (registering the application works).
I run both applications on Docker behind a reverse proxy with NGINX (more specifically, the linuxserver/swag docker image). I’ve found some people with the same issue but unfortunately their solutions did not help me.
Docker logs:
{"acme":false,"host":"ci.hostname.com","level":"info","msg":"starting the http server","port":":80","proto":"https","time":"2023-03-08T02:11:11Z","url":"https://ci.hostname.com"}
{"interval":"30m0s","level":"info","msg":"starting the cron scheduler","time":"2023-03-08T02:11:11Z"}
{"interval":"24h0m0s","level":"info","msg":"starting the zombie build reaper","time":"2023-03-08T02:11:11Z"}
{"level":"error","msg":"oauth: cannot exchange code: gta_s3vcpazqlhrli3bgyj5z3qjrotghfachf3gxozvc2tshu3dukftq: : ","time":"2023-03-08T02:11:14Z"}
drone nginx conf:
## Version 2023/02/05
# make sure that your drone container is named drone
# make sure that your dns has a cname set for drone
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name ci.*;
include /config/nginx/ssl.conf;
client_max_body_size 0;
# enable for ldap auth (requires ldap-location.conf in the location block)
#include /config/nginx/ldap-server.conf;
# enable for Authelia (requires authelia-location.conf in the location block)
#include /config/nginx/authelia-server.conf;
# enable for Authentik (requires authentik-location.conf in the location block)
#include /config/nginx/authentik-server.conf;
location / {
# enable the next two lines for http auth
#auth_basic "Restricted";
#auth_basic_user_file /config/nginx/.htpasswd;
# enable for ldap auth (requires ldap-server.conf in the server block)
#include /config/nginx/ldap-location.conf;
# enable for Authelia (requires authelia-server.conf in the server block)
#include /config/nginx/authelia-location.conf;
# enable for Authentik (requires authentik-server.conf in the server block)
#include /config/nginx/authentik-location.conf;
proxy_buffering off;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
# proxy_set_header Host $http_host;
include /config/nginx/proxy.conf;
include /config/nginx/resolver.conf;
set $upstream_app drone;
set $upstream_port 80;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
chunked_transfer_encoding off;
}
location ~* /ws {
set $upstream_app drone;
set $upstream_port 80;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Docker-compose configuration:
version: "3"
networks:
proxy:
external: true
services:
gitea:
image: gitea/gitea:1.18.5
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
restart: always
networks:
- proxy
volumes:
- /opt/docker/gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
# - "3000:3000"
- "222:22"
drone:
image: drone/drone:2
container_name: drone
networks:
- proxy
volumes:
- /opt/docker/drone:/data
environment:
- DRONE_GITEA_SERVER=https://git.hostname.com
- DRONE_GITEA_CLIENT_ID=GITEA_CLIENT_ID
- DRONE_GITEA_CLIENT_SECRET=GITEA_CLIENT_SECRET
- DRONE_RPC_SECRET=SUPERSECRETSTRING
- DRONE_SERVER_HOST=ci.hostname.com
- DRONE_SERVER_PROTO=https
Any help would be greatly appreciated