Got some problems with setting up drone with my gitea instance and because there are so much different guides with different configs over the past years for different environment variables for drone, i cannot setup this the way it works for me.
And yes, i do know, they explicitly stated *"We strongly recommend installing Drone on a dedicated instance. We do not offer end-user support for installing Drone and Gitea on the same instance. We do not offer end-user support for troubleshooting network complications resulting from single-instance installations."* but i think there must be a way to install it on the same server?

my current setup
----------------

* [jwilder nginx automated proxy](https://github.com/jwilder/nginx-proxy)
* [lets encrypt companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion)
* [gitea](https://github.com/go-gitea/gitea)
* [drone](https://github.com/drone/drone)

drone docker-compose.yaml
-------------------------

```
version: "3.7"
services:
  drone_server:
    image: drone/drone
    container_name: drone_server
    ports:
      - 127.0.0.1:8091:80
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /srv/drone:/var/lib/drone/
    restart: always
    environment:
      - DRONE_GITEA_SERVER=https://gitea.mydomain.tld
      - DRONE_GITEA_CLIENT_ID=$GITEA_CLIENT_ID
      - DRONE_GITEA_CLIENT_SECRET=$GITEA_CLIENT_SECRET
      - DRONE_SERVER_HOST=drone.mydomain.tld
      - DRONE_SERVER_PROTO=https
      - DRONE_LOGS_DEBUG=true
      - DRONE_RPC_SECRET=$DRONE_SECRET
      - VIRTUAL_HOST=drone.mydomain.tld
      - LETSENCRYPT_HOST=drone.mydomain.tld
    networks:
      - proxy

networks:
  proxy:
    external:
      name: proxy_default

```

corresponding (autogenerated) nginx config for drone
----------------------------------------------------

(gitea is equal, but with different subdomian)

```
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
  default $http_x_forwarded_proto;
  ''      $scheme;
}
map $http_x_forwarded_port $proxy_x_forwarded_port {
  default $http_x_forwarded_port;
  ''      $server_port;
}
map $http_upgrade $proxy_connection {
  default upgrade;
  '' close;
}
server_names_hash_bucket_size 128;
ssl_dhparam /etc/nginx/dhparam/dhparam.pem;
map $scheme $proxy_x_forwarded_ssl {
  default off;
  https on;
}
gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
log_format vhost '$host $remote_addr - $remote_user [$time_local] '
                 '"$request" $status $body_bytes_sent '
                 '"$http_referer" "$http_user_agent"';
access_log off;
        ssl_protocols TLSv1.2 TLSv1.3;
        ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
        ssl_prefer_server_ciphers off;
resolver 127.0.0.11;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl;
proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port;

# drone.mydomain.tld
upstream drone.mydomain.tld {
            ## Can be connected with "proxy_default" network
            # drone_server
            server 172.22.0.8:80;
            # Cannot connect to network of this container
            server 127.0.0.1 down;
}
server {
    server_name drone.mydomain.tld;
    listen 80 ;
    access_log /var/log/nginx/access.log vhost;
    return 301 https://$host$request_uri;
}
server {
    server_name drone.mydomain.tld;
    listen 443 ssl http2 ;
    access_log /var/log/nginx/access.log vhost;
    ssl_session_timeout 5m;
    ssl_session_cache shared:SSL:50m;
    ssl_session_tickets off;
    ssl_certificate /etc/nginx/certs/drone.mydomain.tld.crt;
    ssl_certificate_key /etc/nginx/certs/drone.mydomain.tld.key;
    ssl_dhparam /etc/nginx/certs/drone.mydomain.tld.dhparam.pem;
    ssl_stapling on;
    ssl_stapling_verify on;
    ssl_trusted_certificate /etc/nginx/certs/drone.mydomain.tld.chain.pem;
    add_header Strict-Transport-Security "max-age=31536000" always;
    include /etc/nginx/vhost.d/default;
    location / {
        proxy_pass http://drone.mydomain.tld;
    }
}

```

the gitea\_client\_id and secret are created via gitea webinterface, the redirect url is set to `https://drone.mydomain.tld/login`

here is what i am seeing visiting drone.mydomain.tld
----------------------------------------------------

[![drone auth](https://i.stack.imgur.com/3zpwC.png)](https://i.stack.imgur.com/3zpwC.png)

After clicking authorize application the the url in my browser request changes to <https://drone.mydomain.tld/login?XXXXXXXX> and it just loads until nginx throws a 502. After this initial authorization, every request just results in the following logs and erorr. 

### nginx logs

```
nginx.1    | 2019/11/08 10:44:16 [warn] 3762#3762: *47660 upstream server temporarily disabled while reading response header from upstream, client: 111.111.111.111, server: drone.mydomain.tld, request: "GET /login?XXXXXXXX HTTP/2.0", upstream: "http://172.22.0.8:80/login?XXXXXXXX", host: "drone.mydomain.tld", referrer: "https://drone.mydomain.tld/"
nginx.1    | 2019/11/08 10:44:16 [error] 3762#3762: *47660 upstream timed out (110: Operation timed out) while reading response header from upstream, client: 111.111.111.111, server: drone.mydomain.tld, request: "GET /login?XXXXXXXX  HTTP/2.0", upstream: "http://172.22.0.8:80/login?XXXXXXXX", host: "drone.mydomain.tld", referrer: "https://drone.mydomain.tld/"
nginx.1    | 2019/11/08 10:44:16 [error] 3762#3762: *47660 no live upstreams while connecting to upstream, client: 111.111.111.111, server: drone.mydomain.tld, request: "GET /login?XXXXXXXX HTTP/2.0", upstream: "http://drone.mydomain.tld/login?XXXXXXXX", host: "drone.mydomain.tld", referrer: "https://drone.mydomain.tld/"

```

### drone logs

```
{"level":"debug","msg":"api: authentication required","request-id":"1TKR8MAfIewZpiiwn2YkUNEqBrt","time":"2019-11-08T09:50:39Z"}
{"level":"debug","msg":"api: guest access","request-id":"1TKR8MAfIewZpiiwn2YkUNEqBrt","time":"2019-11-08T09:50:39Z"}
{"fields.time":"2019-11-08T09:50:39Z","latency":109385,"level":"debug","method":"GET","msg":"","remote":"172.22.0.2:60330","request":"/api/user","request-id":"1TKR8MAfIewZpiiwn2YkUNEqBrt","time":"2019-11-08T09:50:39Z"}
{"fields.time":"2019-11-08T09:50:39Z","latency":64377,"level":"debug","method":"GET","msg":"","remote":"172.22.0.2:60332","request":"/login","request-id":"1TKR8IicJybGXkQf3ebpiGV4VXi","time":"2019-11-08T09:50:39Z"}
{"level":"debug","msg":"events: stream opened","request-id":"1TKR8Jv7zQrCQSzRyCFbeRLeC8M","time":"2019-11-08T09:50:39Z"}
{"level":"debug","msg":"events: stream cancelled","request-id":"1TKR8Jv7zQrCQSzRyCFbeRLeC8M","time":"2019-11-08T09:51:39Z"}
{"level":"debug","msg":"events: stream closed","request-id":"1TKR8Jv7zQrCQSzRyCFbeRLeC8M","time":"2019-11-08T09:51:39Z"}
{"level":"debug","msg":"api: guest access","request-id":"1TKR8Jv7zQrCQSzRyCFbeRLeC8M","time":"2019-11-08T09:51:39Z"}
{"fields.time":"2019-11-08T09:51:39Z","latency":60182954972,"level":"debug","method":"GET","msg":"","remote":"172.22.0.2:60334","request":"/api/stream","request-id":"1TKR8Jv7zQrCQSzRyCFbeRLeC8M","time":"2019-11-08T09:51:39Z"}
{"level":"error","msg":"oauth: cannot exchange code: ysvAfRKVkRz4ZtN9zX635Vd-mnB__oXW7Rmqpra1VGU=: Post https://gitea.mydomain.tld/login/oauth/access_token: dial tcp 144.76.155.172:443: connect: connection timed out","time":"2019-11-08T09:52:32Z"}
{"level":"debug","msg":"cannot authenticate user: Post https://gitea.mydomain.tld/login/oauth/access_token: dial tcp 144.76.155.172:443: connect: connection timed out","time":"2019-11-08T09:52:32Z"}

```

### gitea logs

```
[Macaron] 2019-11-08 10:50:21: Started GET /login/oauth/authorize?client_id=$GITEA_CLIENT_ID&redirect_uri=https%3A%2F%2Fdrone.mydomain.tld%2Flogin&response_type=code&state=c697f48392907a0 for 134.96.216.2
[Macaron] 2019-11-08 10:50:21: Completed GET /login/oauth/authorize?client_id=$GITEA_CLIENT_ID&redirect_uri=https%3A%2F%2Fdrone.mydomain.tld%2Flogin&response_type=code&state=c697f48392907a0 302 Found in 58.954698ms
[Macaron] 2019-11-08 10:50:39: Started GET /login/oauth/authorize?client_id=$GITEA_CLIENT_ID&redirect_uri=https%3A%2F%2Fdrone.mydomain.tld%2Flogin&response_type=code&state=68255aaf95e94627 for 134.96.216.2
[Macaron] 2019-11-08 10:50:39: Completed GET /login/oauth/authorize?client_id=$GITEA_CLIENT_ID&redirect_uri=https%3A%2F%2Fdrone.mydomain.tld%2Flogin&response_type=code&state=68255aaf95e94627 302 Found in 78.11159ms

```

### page source

this is what my browser is showing while, obviously, javascript is activated

```html
<!DOCTYPE html>
<html lang=en>

<head>
    <meta charset=utf-8>
    <meta http-equiv=X-UA-Compatible content="IE=edge">
    <meta name=viewport content="width=device-width,initial-scale=1,user-scalable=0">
    <link id=favicon rel=icon href=/favicon.png type=image/png>
    <title>Drone | Continuous Integration</title>
    <link href=/css/app.835f40e0.css rel=preload as=style>
    <link href=/js/app.2c99ed98.js rel=preload as=script>
    <link href=/js/chunk-vendors.f5840117.js rel=preload as=script>
    <link href=/css/app.835f40e0.css rel=stylesheet>
</head>

<body>
    <noscript><strong>We're sorry but Drone does not work properly without JavaScript enabled. Please enable it to continue.</strong></noscript>
    <div id=app></div>
    <script src=/js/chunk-vendors.f5840117.js></script>
    <script src=/js/app.2c99ed98.js></script>
</body>

</html>

```

is there any configuration i missed or any environment variable which is outdated (i followed different guides, but in the end checked everything with the [drone docs](https://docs.drone.io/installation/providers/gitea/))? is there anybody out there who is running a similar setup who can share his config with me? i tried pretty much every combination of http/https combination and different outdated env vars for drone, but never got to the actual webfrontend.
['https://Stackoverflow.com/questions/58764751', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9239809/']
Try:

```
import matplotlib.pyplot as plt
ax = df.plot.bar(y='Profile_ID Count')
plt.show()

```
```
# Importing the requisite libraries
import pandas as pd
import matplotlib.pyplot as plt

# Creating the DataFrame
df = pd.DataFrame({'Creation Date':['2016-06-01','2016-06-03','2016-06-04'],'Profile_ID Count':[150,3,20]})

# Creating the bar chart below.
fig, ax = plt.subplots()
ax.bar(df['Creation Date'],df['Profile_ID Count'], color='red', width = 0.5)   
fig.autofmt_xdate()   # This tilts the dates displayed along X-axis.
ax.set_title('Creation Date vs. Profile ID Count')
ax.set_xlabel('Creation Date')
ax.set_ylabel('Profile ID Count')
plt.show()

```

[![Bar-Chart](https://i.stack.imgur.com/FInW9.png)](https://i.stack.imgur.com/FInW9.png)