Feat: Configuration, azd support, proxy API
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:
- running just frontend - using PAT
- running frontend with backend - using GitHub App
fixes #25 and #30
Is there anything I can do to help get this approved? Would really like to deploy this internally
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'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"
ok, I'll test it. The API Proxy is designed to work with GH app registration rather than hardcoded token
@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! 🙏🏼
sure, I need to resolve the conflicts - will fix it this weekend
@martedesco @dcieslak19973 I resolved conflicts and updated the readme. you can run the project in few different ways
- 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
- 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 , 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 🙏🏼
Feel free to ping me on teams - we can sync about this solution
@martedesco were you able to test this?
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?
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:
- Use the fork and follow this readme (now in dedicated file: https://github.com/karpikpl/copilot-metrics-viewer/blob/feature/configuration/DEPLOYMENT.md
- Deploy image build from https://github.com/github-copilot-resources/copilot-metrics-viewer using guidance in #95