codecov / self-hosted

Example of how to setup Codecov with docker compose
Other
433 stars 34 forks source link

Exposing with a custom URL #12

Closed koltyakov closed 1 year ago

koltyakov commented 1 year ago

Hi and thank you for going OpenSourcing your wonderful product!

I'm trying to lift a POC exposing is via an external URL through ngrok.

ngrok http 8080

image

# ./config/codecov.yml
setup:
  codecov_url: https://a-custom-url-through-ngrok.ngrok-free.app
# with other configurations/license/github app/etc applied
# ./docker-compose.yml
# default one including:
  frontend:
    image: codecov/enterprise-frontend:latest-stable
    environment:
      - CODECOV_BASE_HOST=localhost:8080
      - CODECOV_API_HOST=localhost:8080
      - CODECOV_IA_HOST=localhost:8080
      - CODECOV_SCHEME=http
    volumes:
      - ./config:/config
    ports:
      - "8080"
    networks:
      - codecov

When I'm reaching the URL I'm getting the loading screen (with umbrella animation) and the following errors:

image

So even while having codecov_url provided due something else some calls are sent to http://localhost:8080, if to modify CODECOV_ env vars in frontend in the docker compose the error is exactly the same with same 8080 port.

I can't see anything but /docs/configuration#codecov-url regarding providing a custom URL. Am I missing something obvious?

fmdoe commented 1 year ago

I had to change the environment variables to something like this:

  frontend:
    image: codecov/enterprise-frontend:latest-stable
    environment:
      - CODECOV_BASE_HOST=a-custom-url-through-ngrok.ngrok-free.app
      - CODECOV_API_HOST=a-custom-url-through-ngrok.ngrok-free.app
      - CODECOV_IA_HOST=a-custom-url-through-ngrok.ngrok-free.app
      - CODECOV_SCHEME=https
koltyakov commented 1 year ago

@fmdoe thank you for response!

With external URLs provided to frontent container, the starter page opens, yet when logging in with GitHub redirects it routes to https://a-custom-url-through-ngrok.ngrok-free.app/login/gh (even while /login/github is set up in the callback URL) and it's not available. So setting up setup -> codecov_url and frontent -> envs is not enough.

Did anyone managed exposing recent Codecov (docker compose, images versions)? Which instructions did you follow as cloning current repo and following Self-Hosted Configuration Guide seems not enough?

UPD: Actually, setting frontent -> envs worked. On my first attempt, I missed I did a typo in CODECOV_BASE_HOST which was them cached in the browser.

koltyakov commented 1 year ago

I'm happy to close the issue as resolved. Yet, maybe it's reasonable mapping the frontent container variables from the config?

trent-codecov commented 1 year ago

I agree that would be a nice improvement. The logic that handles this is here. We have not added parsing the yaml at this time but welcome PRs 😄 .

Closing the issue as resolved for now.