woodpecker-ci / woodpecker

Woodpecker is a simple yet powerful CI/CD engine with great extensibility.
https://woodpecker-ci.org
Apache License 2.0
3.88k stars 345 forks source link

Can't Log into Woodpecker #519

Closed xSTUDDSx closed 1 year ago

xSTUDDSx commented 2 years ago

I have Woodpecker setup with Gitea and have established the Client and Secret. When I click login on Woodpecker, I get directed to Gitea and I login, however, after Authorizing I get dumped back to Woodpecker's main login page with this URL...

I can't seem to get into Woodpecker at all. There are no errors in the logs of the server, but I do see this error in the log of the agent.

{"level":"error","error":"rpc error: code = Unavailable desc = connection closed before server preface received","time":"2021-11-19T14:47:03Z","message":"grpc error: done(): code: Unavailable: rpc error: code = Unavailable desc = connection closed before server preface received"}

Here is my docker-compose...

version: '3'

networks:
  reverse-proxy:
    external:
      name: reverse-proxy

services:
  woodpecker-server:
    image: woodpeckerci/woodpecker-server:latest
    container_name: woodpecker-server
    networks:
      - reverse-proxy
    ports:
      - 8000:8000
    volumes:
      - woodpecker-server-data:/var/lib/woodpecker/
    environment:
      - WOODPECKER_OPEN=true
      - WOODPECKER_HOST=https://woodpecker.mydomain.com
      - WOODPECKER_GITEA=true
      - WOODPECKER_GITEA_URL=https://gitea.mydomain.com
      - WOODPECKER_GITEA_CLIENT=<GITEA_CLIENT>
      - WOODPECKER_GITEA_SECRET=<GITEA_SECRET>
      - WOODPECKER_AGENT_SECRET=<AGENT_SECRET>

  woodpecker-agent:
    image: woodpeckerci/woodpecker-agent:latest
    container_name: woodpecker-agent
    command: agent
    restart: always
    depends_on:
      - woodpecker-server
    networks:
      - reverse-proxy
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - WOODPECKER_SERVER=woodpecker-server:8000
      - WOODPECKER_AGENT_SECRET=<AGENT_SECRET>

volumes:
  woodpecker-server-data:
f97-2308 commented 2 years ago

Same me, anyone have solution? 😢

corgijan commented 2 years ago

@f97 @xSTUDDSx Have you set up oAuth with /authorize? Ive written a little blog how to set it up with github ....maybe it helps: https://www.corgis.ml/woodpecker

6543 commented 2 years ago

@xSTUDDSx the agent does conect via gRPC so you need port :9000

xSTUDDSx commented 2 years ago

@Iamjava Yes I have setup the OAuth using this guide since I'm using gitea.

@6543 I originally had 9000, but it wasn't working so I changed it to 8000 thinking the documentation here had a typo.

Either way, I re-verified the OAuth setup and also tried both ports 8000 and 9000 mentioned on the WOODPECKER_SERVER variable and I still end up with the same result.

anbraten commented 2 years ago

Woodpecker uses two ports. Port 8000 is used for the web-UI and port 9000 for the agent communication via grpc.

anbraten commented 2 years ago

Agent logs / errors should be independent from your login problems.

Could you verify the callback address you inserted into Gitea, please. It should be in the form of: https://your-woodpecker.tld/authorize

xSTUDDSx commented 2 years ago

Yes, verified that it has my domain with /authorize at the end.

Gitea_Woodpecker_OAuth

xSTUDDSx commented 2 years ago

For a little more information, out of curiosity I attempted to setup Drone to see if I was also experiencing the same issue with that app. However, I had zero issues setting it up. I am able to use OAuth in Gitea to authorize the Drone app and successfully log in where I can then see Drone is pulling the repo information from my Gitea server.

Therefore, this seems to be an issue with Woodpecker after the fork and not something carried over from Drone. Either that or if it was in Drone, they have fixed it post-fork.

6543 commented 2 years ago

Thanks for your tests, ... I'm kind a confused how i'm able to reproduce the issue :/

I'll give it a try today again...lets see

xSTUDDSx commented 2 years ago

@6543 So I've figured out the issue is with the reverse proxy. If I get rid of my reverse-proxy network and use just the IP:Port instead of my public domain for Woodpecker, then it works.

I think #176 will fix this once it gets merged.

6543 commented 2 years ago

Ah thats a good hint!

anbraten commented 2 years ago

Could you provide some context about your reverse proxy setup. In general it should work without problems behind a reverse-proxy. The official woodpecker instance of this project for example is using Caddy in a reverse-proxy setup. Caddyfile, our docker-compose config.

xSTUDDSx commented 2 years ago

@anbraten I'm using nginx proxy manager. I'm not familiar with Caddy, but looking at your compose compared to mine in the original post it looks pretty much the same in regards to handling the network.

f97-2308 commented 2 years ago

@6543 I was back to droneio and drone works okay so I think it's a bug by woodpecker.

6543 commented 2 years ago

It's sad to hear, but what works best for you ...

PS: I cant reproduce it atm - but I'll let this issue open to see if we can hunt it down at some point

6543 commented 2 years ago

ok it looks like "nginx proxy manager" and woodpecker do not like to work together, can you test if it works whit caddy or plain nginx?

anbraten commented 1 year ago

Seems to be related to the specific setup in this case. So closing for now as I don't see a way Woodpecker could be adjusted here.