github-copilot-resources / copilot-metrics-viewer

Tool to visualize the Copilot metrics provided via the Copilot Business Metrics API (current in public beta)
https://copilot-metrics-viewer-gthcc5cmd9ebf2ff.westeurope-01.azurewebsites.net/
MIT License
258 stars 126 forks source link

Deploying app via docker not passing environmental variables correctly #95

Open DBH1986 opened 23 hours ago

DBH1986 commented 23 hours ago

Hello, love the app and I'm wanting to use it on a server. I built and ran the app successfully locally with npm but when I'm trying to run it via docker it starts up okay but hitting localhost throws the below console error

image

My environmental variable is set

image

So it looks like since its working with NPM, the environmental variable isn't being passed along correctly in docker. Looking online this might be due to the EOF characters being different between windows and linux, but changing between the two then redeploying gives the same error.

Ultimately, I'd like to get this image deployed to Azure App Services by following https://learn.microsoft.com/en-us/azure/app-service/quickstart-custom-container?tabs=dotnet&pivots=container-linux-vscode. I've tried this a few times (thinking the docker container error may be a local error), but am getting the same error. This may just be a lack of docker knowledge on my part, but any suggestions for how to get this app running via docker locally and via Azure?

Thanks!

karpikpl commented 3 hours ago

Hi, what environment variables have you configured on the app service?

I've build another docker image that helps with hiding GitHub token when deployed.

AZD deployment scripts and "deploy to Azure" buttons are available here: https://github.com/github-copilot-resources/copilot-metrics-viewer/pull/55

DBH1986 commented 1 hour ago

Hey Piotr, hadn't configured them on the app service itself. I just tried that

image and got the same error after restarting the app service image

I'll check out the deploy to azure branch too. I'm also wondering why its not working via docker locally on my dev machine so wondering if you have any thoughts on that.

Thanks for the quick response!

karpikpl commented 49 minutes ago

Hey, I've just tested with a web app:

  1. Deployment center -> registry settings:
    1. Registry Source: Private Registry
    2. Server URL: https://ghcr.io
    3. Full Image Name and Tag: github-copilot-resources/copilot-metrics-viewer:latest
  2. Environment variables: App settings:
    1. VUE_APP_GITHUB_ORG : your-org-name
    2. VUE_APP_SCOPE : organization
    3. VUE_APP_GITHUB_TOKEN: github_pat_xxx - token with copilot billing read access in the your-org-name

keep in mind that your toke will be exposed in the browser unless you look at that PR that I've provided which has means to hide it.