codecov / feedback

A place to discuss feedback about the pull request and web product experience.
36 stars 6 forks source link

[self-hosted] Login github faile #213

Open McDonald755 opened 6 months ago

McDonald755 commented 6 months ago

same https://github.com/codecov/feedback/discussions/169

Overview

Logging in with the "Login with GitHub" button goes through the auth flow, but ends by redirecting to localhost/gh.

Context

Here is the chain of redirects:

http://mydomain.com/login/gh http://github.com/login/oauth/authorize http://mydomain.com/login/github?code=x&state=x http://mydomain.com/login/gh

here is my codecov.yml

setup:
  codecov_url: "http://xxx.xx.xx.xx:8080"
  enterprise_license: "F5O0Fu5ASFTPtWXM51BK8YQlq7IM2s+8TBGULrf9Um7wHjfPwI+Z3E4PfF/dPs6Uc5A+MLti+2etHq5dnFEfZgoiIVCLZ8x+0BVmUSWwPS42vJXnf1veY9Bglang4mDIhmfWfp5l6AT6cxmAVFpGrwobiK6OcN9pjWx4iWabazmsOiF9LM++v0WtuHNvhgzRcKmnJPgqahEB7qqF6KQ1hg=="

  admins:
    - service: github
      username: "McDonald755"

  http:
    cookie_secret: "test"
  timeseries:
    enabled: true
github:
  client_id: "Iv1.xxx"
  client_secret: "9xxx"
  webhook_secret: "123456"
  integration:
    id: "774317"
    pem: /config/codecovdem.pem
  global_upload_token: "<upload-token>"
services:
  redis_url: "redis://redis:6379"
  database_url: "postgres://postgres:testpassword@postgres:5432/postgres"
  timeseries_database_url: "postgres://postgres:testpassword@timescale:5432/postgres"
  minio:
    host: minio
    port: 9000

my docker-compose.yml

version: "3"

services:
  gateway:
    image: codecov/self-hosted-gateway:latest-calver #note: this is for setup purposes only, be sure to pin to the latest release from our changelog: https://docs.codecov.io/changelog
    volumes:
      - ./config:/config
      - ./codecovdem.pem:/config/codecovdem.pem
    ports:
      - "${CODECOV_PORT-8080}:8080"
    environment:
      - CODECOV_GATEWAY_MINIO_ENABLED=true
    networks:
      - codecov
    depends_on:
      - api
      - frontend

  frontend:
    image: codecov/self-hosted-frontend:latest-calver #note: this is for setup purposes only, be sure to pin to the latest release from our changelog: https://docs.codecov.io/changelog
    environment:
      - CODECOV_BASE_HOST=xxx.xx.xx.xx:8080
      - CODECOV_API_HOST=1xxx.xx.xx.xx:8080
      - CODECOV_IA_HOST=xxx.xx.xx.xx3:8080
      - CODECOV_SCHEME=http
    volumes:
      - ./config:/config
      - ./codecovdem.pem:/config/codecovdem.pem
    ports:
      - "8080"
    networks:
      - codecov

  api:
    image: codecov/self-hosted-api:latest-calver #note: this is for setup purposes only, be sure to pin to the latest release from our changelog: https://docs.codecov.io/changelog
    volumes:
      - ./config:/config
      - ./codecovdem.pem:/config/codecovdem.pem
    networks:
      - codecov
    depends_on:
      - minio
      - timescale
      - postgres
      - redis

  worker:
    image: codecov/self-hosted-worker:latest-calver #note: this is for setup purposes only, be sure to pin to the latest release from our changelog: https://docs.codecov.io/changelog
    environment:
      - RUN_ENV=ENTERPRISE
    volumes:
      - ./config:/config
      - ./codecovdem.pem:/config/codecovdem.pem
      - archive-volume:/archive
    networks:
      - codecov
    depends_on:
      - minio
      - redis
      - postgres
      - timescale

  redis:
    image: redis:6-alpine
    volumes:
      - redis-volume:/data
    networks:
      - codecov

  postgres:
    image: postgres:14-alpine
    environment:
      - POSTGRES_PASSWORD=testpassword
      - POSTGRES_USER=postgres
      - POSTGRES_DB=postgres
    volumes:
      - postgres-volume:/var/lib/postgresql/data
    ports:
      - "9432:5432"
    networks:
      - codecov

  timescale:
    image: timescale/timescaledb-ha:pg14-latest
    environment:
      - POSTGRES_PASSWORD=testpassword
      - POSTGRES_USER=postgres
      - POSTGRES_DB=postgres
    volumes:
      - timescale-volume:/var/lib/postgresql/data
    ports:
      - "8432:5432"
    networks:
      - codecov

  minio:
    image: minio/minio:RELEASE.2020-04-15T00-39-01Z
    command: server /export
    ports:
      - "${CODECOV_MINIO_PORT-9000}:9000"
    environment:
      - MINIO_ACCESS_KEY=codecov-default-key
      - MINIO_SECRET_KEY=codecov-default-secret
    volumes:
      - archive-volume:/export
    networks:
      - codecov

volumes:
  postgres-volume:
  timescale-volume:
  redis-volume:
  archive-volume:

networks:
  codecov:
    driver: bridge

and my github app call back url is "myip:8080/logib/github"

drazisil-codecov commented 6 months ago

That issue was solved by https://github.com/codecov/feedback/issues/170#issuecomment-1833982446

Does that work for you?

McDonald755 commented 5 months ago

该问题已由#170 解决(评论)

那对你有用吗?

No, I can make sure my file is correct.

it return this error {"message": "Unable to log in due to problem on Github", "asctime": "2024-01-22 03:15:47,351", "name": "codecov_auth.views.github", "levelname": "WARNING", "lineno": 117, "pathname": "/app/codecov_auth/views/github.py", "funcName": "actual_login_step", "threadName": "MainThread", "exc_info": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.9/site-packages/httpcore/backends/asyncio.py\", line 109, in connect_tcp\n stream: anyio.abc.ByteStream = await anyio.connect_tcp(\n File \"/usr/local/lib/python3.9/site-packages/anyio/_core/_sockets.py\", line 218, in connect_tcp\n await event.wait()\n File \"/usr/local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py\", line 662, in aexit\n raise exceptions[0]\n File \"/usr/local/lib/python3.9/site-packages/anyio/_core/_sockets.py\", line 164, in try_connect\n stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)\n File \"/usr/local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py\", line 1691, in connect_tcp\n await get_running_loop().create_connection(\n File \"/usr/local/lib/python3.9/asyncio/base_events.py\", line 1050, in create_connection\n sock = await self._connect_sock(\n File \"/usr/local/lib/python3.9/asyncio/base_events.py\", line 961, in _connect_sock\n await self.sock_connect(sock, address)\n File \"/usr/local/lib/python3.9/asyncio/selector_events.py\", line 500, in sock_connect\n return await fut\nasyncio.exceptions.CancelledError\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py\", line 8, in map_exceptions\n yield\n File \"/usr/local/lib/python3.9/site-packages/httpcore/backends/asyncio.py\", line 109, in connect_tcp\n stream: anyio.abc.ByteStream = await anyio.connect_tcp(\n File \"/usr/local/lib/python3.9/site-packages/anyio/_core/_tasks.py\", line 118, in exit\n raise TimeoutError\nTimeoutError\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py\", line 60, in map_httpcore_exceptions\n yield\n File \"/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py\", line 353, in handle_async_request\n resp = await self._pool.handle_async_request(req)\n File \"/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py\", line 253, in handle_async_request\n raise exc\n File \"/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py\", line 237, in handle_async_request\n response = await connection.handle_async_request(request)\n File \"/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py\", line 86, in handle_async_request\n raise exc\n File \"/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py\", line 63, in handle_async_request\n stream = await self._connect(request)\n File \"/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py\", line 111, in _connect\n stream = await self._network_backend.connect_tcp(kwargs)\n File \"/usr/local/lib/python3.9/site-packages/httpcore/backends/auto.py\", line 29, in connect_tcp\n return await self._backend.connect_tcp(\n File \"/usr/local/lib/python3.9/site-packages/httpcore/backends/asyncio.py\", line 109, in connect_tcp\n stream: anyio.abc.ByteStream = await anyio.connect_tcp(\n File \"/usr/local/lib/python3.9/contextlib.py\", line 137, in exit\n self.gen.throw(typ, value, traceback)\n File \"/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py\", line 12, in map_exceptions\n raise to_exc(exc)\nhttpcore.ConnectTimeout\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.9/site-packages/shared/torngit/github.py\", line 208, in make_http_call\n res = await client.request(method, url, kwargs)\n File \"/usr/local/lib/python3.9/site-packages/httpx/_client.py\", line 1527, in request\n return await self.send(request, auth=auth, follow_redirects=follow_redirects)\n File \"/usr/local/lib/python3.9/site-packages/httpx/_client.py\", line 1614, in send\n response = await self._send_handling_auth(\n File \"/usr/local/lib/python3.9/site-packages/httpx/_client.py\", line 1642, in _send_handling_auth\n response = await self._send_handling_redirects(\n File \"/usr/local/lib/python3.9/site-packages/httpx/_client.py\", line 1679, in _send_handling_redirects\n response = await self._send_single_request(request)\n File \"/usr/local/lib/python3.9/site-packages/httpx/_client.py\", line 1716, in _send_single_request\n response = await transport.handle_async_request(request)\n File \"/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py\", line 353, in handle_async_request\n resp = await self._pool.handle_async_request(req)\n File \"/usr/local/lib/python3.9/contextlib.py\", line 137, in exit\n self.gen.throw(typ, value, traceback)\n File \"/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py\", line 77, in map_httpcore_exceptions\n raise mapped_exc(message) from exc\nhttpx.ConnectTimeout\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/app/codecov_auth/views/github.py\", line 113, in actual_login_step\n user_dict = self.fetch_user_data(code)\n File \"/usr/local/lib/python3.9/site-packages/asgiref/sync.py\", line 240, in call\n return call_result.result()\n File \"/usr/local/lib/python3.9/concurrent/futures/_base.py\", line 439, in result\n return self.get_result()\n File \"/usr/local/lib/python3.9/concurrent/futures/_base.py\", line 391, in get_result\n raise self._exception\n File \"/usr/local/lib/python3.9/site-packages/asgiref/sync.py\", line 306, in main_wrap\n result = await self.awaitable(*args, **kwargs)\n File \"/app/codecov_auth/views/github.py\", line 79, in fetch_user_data\n authenticated_user = await repo_service.get_authenticated_user(code)\n File \"/usr/local/lib/python3.9/site-packages/shared/torngit/github.py\", line 422, in get_authenticated_user\n response = await self.make_http_call(\n File \"/usr/local/lib/python3.9/site-packages/shared/torngit/github.py\", line 229, in make_http_call\n raise TorngitServerUnreachableError(\nshared.torngit.exceptions.TorngitServerUnreachableError: GitHub was not able to be reached.", "logger.name": "codecov_auth.views.github", "logger.thread_name": "MainThread", "level": "WARNING"}