copilot-metrics-viewer icon indicating copy to clipboard operation
copilot-metrics-viewer copied to clipboard

Feat: Configuration, azd support, proxy API

Open karpikpl opened this issue 1 year ago • 12 comments

This PR contains changes from @jycr since I needed those to make container configurable.

Need to update documentation but from my testing it looks like both options still work:

  1. running just frontend - using PAT
  2. running frontend with backend - using GitHub App

fixes #25 and #30

karpikpl avatar Jun 26 '24 05:06 karpikpl

Is there anything I can do to help get this approved? Would really like to deploy this internally

dcieslak19973 avatar Aug 06 '24 16:08 dcieslak19973

We're working on that internally, if you wanted to deploy it (to Azure) - there's a one click deploy here: https://github.com/karpikpl/copilot-metrics-viewer/tree/feature/configuration?tab=readme-ov-file#azure-deployment

karpikpl avatar Aug 06 '24 18:08 karpikpl

I've tried deploying both the copilot-metrics-viewer and copilot-metrics-viewer-with-api images and cannot seem to get either to work. For the copilot-metrics-viewer, I've set

VUE_APP_SCOPE=enterprise VUE_APP_GITHUB_ENT=[REDACTED] VUE_APP_GITHUB_TOKEN=[REDACTED]

I've verified both inside the container and outside that:

curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer $VUE_APP_GITHUB_TOKEN" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/enterprises/$VUE_APP_GITHUB_ENT/copilot/usage

returns reasonable data. When I browse via the container, there's an error message "404 Not Found - is the enterprise [REDACTED] correct"

dcieslak19973 avatar Aug 07 '24 13:08 dcieslak19973

ok, I'll test it. The API Proxy is designed to work with GH app registration rather than hardcoded token

karpikpl avatar Aug 07 '24 20:08 karpikpl

@karpikpl , thanks so much for your contribution! This is a great PR. Do you mind rebasing with latest changes from main? I will them review it and merge. Thank you! 🙏🏼

martedesco avatar Aug 08 '24 06:08 martedesco

sure, I need to resolve the conflicts - will fix it this weekend

karpikpl avatar Aug 09 '24 03:08 karpikpl

@martedesco @dcieslak19973 I resolved conflicts and updated the readme. you can run the project in few different ways

  1. With hardcoded token - that's hidden by the proxy
docker run -it --rm -p 3000:3000 \
-e VUE_APP_SCOPE=enterprise \
-e VUE_APP_GITHUB_API=/api/github  \
-e VUE_APP_GITHUB_ENT=<enterprise name> \
-e VUE_APP_GITHUB_TOKEN=<github PAT> \
-e SESSION_SECRET=<random string>  \
ghcr.io/karpikpl/copilot-metrics-viewer-with-proxy

or

docker run -it --rm -p 3000:3000 \
-e VUE_APP_SCOPE=organization \
-e VUE_APP_GITHUB_API=/api/github  \
-e VUE_APP_GITHUB_ORG=<org name> \
-e VUE_APP_GITHUB_TOKEN=<github PAT> \
-e SESSION_SECRET=<random string>   \
ghcr.io/karpikpl/copilot-metrics-viewer-with-proxy
  1. With GitHub Authentication - that authenticates and authorizes the user with GitHub App registration
docker run -it --rm -p 3000:3000 \
-e VUE_APP_SCOPE=organization \
-e VUE_APP_GITHUB_API=/api/github  \
-e VUE_APP_GITHUB_ORG=<org name> \
-e GITHUB_CLIENT_ID=<client id> \
-e GITHUB_CLIENT_SECRET=<client secret for the GH App> \
-e SESSION_SECRET=<random string>  \
ghcr.io/karpikpl/copilot-metrics-viewer-with-proxy

karpikpl avatar Aug 12 '24 01:08 karpikpl

@karpikpl , thanks for the recent commits! I had to release the 1.7 without this for now as there was much demand for the Team metrics availability. I will have to run some tests on the content of this PR so this one should be prioritized next! Please bear with me 🙏🏼

martedesco avatar Aug 15 '24 21:08 martedesco

Feel free to ping me on teams - we can sync about this solution

karpikpl avatar Aug 16 '24 15:08 karpikpl

@martedesco were you able to test this?

karpikpl avatar Sep 20 '24 13:09 karpikpl

We're working on that internally, if you wanted to deploy it (to Azure) - there's a one click deploy here: https://github.com/karpikpl/copilot-metrics-viewer/tree/feature/configuration?tab=readme-ov-file#azure-deployment

I'm interested in the azure deploy but am not sure how to deploy it based on this information. How would I go about doing that?

DBH1986 avatar Sep 25 '24 18:09 DBH1986

We're working on that internally, if you wanted to deploy it (to Azure) - there's a one click deploy here: https://github.com/karpikpl/copilot-metrics-viewer/tree/feature/configuration?tab=readme-ov-file#azure-deployment

I'm interested in the azure deploy but am not sure how to deploy it based on this information. How would I go about doing that?

Apology for stale link. You have several options here:

  1. Use the fork and follow this readme (now in dedicated file: https://github.com/karpikpl/copilot-metrics-viewer/blob/feature/configuration/DEPLOYMENT.md
  2. Deploy image build from https://github.com/github-copilot-resources/copilot-metrics-viewer using guidance in #95

karpikpl avatar Sep 25 '24 21:09 karpikpl