githubtraining / continuous-delivery-azure

Course repository for the Learning Lab course GitHub Actions: Continuous Delivery with Azure
https://lab.github.com/githubtraining/github-actions:-continuous-delivery-with-azure/
Creative Commons Attribution 4.0 International
0 stars 2 forks source link

My deployed application doesn't work and throws an error #29

Open mickeygousset opened 4 years ago

mickeygousset commented 4 years ago

Describe the bug When I navigate to .azurewebsites.net after doing either a staging or a production deployment, the website throws an error.

To Reproduce Steps to reproduce the behavior:

  1. Start the lab
  2. Work through either of the steps to deploy to staging or production
  3. Open the website the app is deployed to.
  4. See error

Expected behavior I expected the Tic Tac Toe game to run

Screenshots image

Desktop (please complete the following information):

hectorsector commented 4 years ago

@mickeygousset was this a timing issue? I remember when taking this course it'd take a little time for the app to be deployed. Assuming everything's still up and running, does it work now?

If it does turn out to be a timing issue, we can fix this issue by adding a note about waiting.

mickeygousset commented 4 years ago

@hectorsector No its not a timing issue. You can see that it is still not working, even after sitting for 24 hours.: https://mickeygousset-ttt-app.azurewebsites.net/

I had the same thing happen to me three times when testing the lab yesterday, so I don't think it was user error. But I haven't tried to dive into what the problem might be yet. I can do that today, to see if I can troubleshoot (with my limited container knowledge). 👍

Looks like some sort of auth issue, based off some logs I could find quickly in Azure. I'm not authenticating to GitHub Package services or something like that. I'll look into it after lunch (when I'm free) and see what I can determine.

2020_07_31_RD0003FF9A53BC_docker.log: 2020-07-31T13:56:01.202Z INFO - Pulling image: docker.pkg.github.com/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt:a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3 2020-07-31T13:56:01.890Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"unauthorized: Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured."}

2020-07-31T13:56:01.890Z ERROR - Pulling docker image docker.pkg.github.com/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt:a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3 failed: 2020-07-31T13:56:01.890Z INFO - Pulling image from Docker hub: docker.pkg.github.com/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt:a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3 2020-07-31T13:56:02.018Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get https://docker.pkg.github.com/v2/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt/manifests/a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3: no basic auth credentials"}

2020-07-31T13:56:02.026Z ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository) 2020-07-31T13:56:02.068Z INFO - Stopping site mickeygousset-ttt-app because it failed during startup. 2020-07-31T13:56:04.949Z INFO - Pulling image: docker.pkg.github.com/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt:a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3 2020-07-31T13:56:05.232Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"unauthorized: Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured."}

2020-07-31T13:56:05.232Z ERROR - Pulling docker image docker.pkg.github.com/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt:a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3 failed: 2020-07-31T13:56:05.232Z INFO - Pulling image from Docker hub: docker.pkg.github.com/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt:a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3 2020-07-31T13:56:05.369Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get https://docker.pkg.github.com/v2/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt/manifests/a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3: no basic auth credentials"}

2020-07-31T13:56:05.377Z ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository) 2020-07-31T13:56:05.399Z INFO - Stopping site mickeygousset-ttt-app because it failed during startup. 2020-07-31T13:58:39.351Z INFO - Pulling image: docker.pkg.github.com/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt:a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3 2020-07-31T13:58:39.730Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"unauthorized: Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured."}

2020-07-31T13:58:39.731Z ERROR - Pulling docker image docker.pkg.github.com/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt:a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3 failed: 2020-07-31T13:58:39.731Z INFO - Pulling image from Docker hub: docker.pkg.github.com/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt:a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3 2020-07-31T13:58:39.858Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get https://docker.pkg.github.com/v2/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt/manifests/a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3: no basic auth credentials"}

2020-07-31T13:58:39.860Z ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository) 2020-07-31T13:58:39.862Z INFO - Stopping site mickeygousset-ttt-app because it failed during startup. 2020-07-31T13:58:41.125Z INFO - Pulling image: docker.pkg.github.com/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt:a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3 2020-07-31T13:58:41.404Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"unauthorized: Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured."}

2020-07-31T13:58:41.405Z ERROR - Pulling docker image docker.pkg.github.com/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt:a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3 failed: 2020-07-31T13:58:41.405Z INFO - Pulling image from Docker hub: docker.pkg.github.com/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt:a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3 2020-07-31T13:58:41.524Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get https://docker.pkg.github.com/v2/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt/manifests/a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3: no basic auth credentials"}

2020-07-31T13:58:41.525Z ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository) 2020-07-31T13:58:41.529Z INFO - Stopping site mickeygousset-ttt-app because it failed during startup.

hectorsector commented 4 years ago

@lmkeston since you've been taking this course a lot lately, are you seeing the same thing?

lmkeston commented 4 years ago

@hectorsector I think this is because the deployment to prod step isn't actually functioning properly. on Step 9 in the final PR, the copy/paste code sample still has the label "stage" specified: image This is confusing. We should probably have a "prod" label ready and update this code accordingly. Either way, because we don't have a follow-on step in which we apply the label, the action runs but skips all the steps as shown below: image Therefore, I don't think the app is ever deployed.

hectorsector commented 4 years ago

I opened https://github.com/githubtraining/continuous-delivery-azure/pull/33 to address the issue ☝️, but I don't think that's @mickeygousset's issue.

My app also isn't running and I get the same error, although I do not have the Package token errors anywhere.

Looks like some sort of auth issue, based off some logs I could find quickly in Azure. I'm not authenticating to GitHub Package services or something like that. I'll look into it after lunch (when I'm free) and see what I can determine.

@mickeygousset could you share where you're seeing these logs? Going to try and replicate.

lmkeston commented 4 years ago

I opened #33 to address the issue ☝️, but I don't think that's @mickeygousset's issue.

Yeah, that was a red herring... I'm getting the same issue when running the latest deployment from #33. @mattdavis0351 can you assist? it looks like it might be a docker issue.

mattdavis0351 commented 4 years ago

Image pull failed: Verify docker image configuration and credentials (if using private repository) @lmkeston @hectorsector @mickeygousset This is the problem.

Azure is unable to authenticate back to GitHub to properly pull the container.

DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get https://docker.pkg.github.com/v2/mickeygousset/github-actions-continuous-delivery-azure/mickeygousset-azure-ttt/manifests/a1636b691f5b7f72bf23e2ccdbd14fb1798b63f3: no basic auth credentials"}

We can also see that here in this error. So either the GITHUB_TOKEN is no longer able to be used with Azure, or the step that configures GitHub Packages did not succeed properly

        if: success()
        run: |
          az webapp config container set --docker-custom-image-name nginx --docker-registry-server-password 
         ${{secrets.GITHUB_TOKEN}} --docker-registry-server-url https://docker.pkg.github.com --docker-registry-server-user 
         ${{github.actor}} --name ${{ env.AZURE_WEBAPP_NAME }} --resource-group ${{ env.AZURE_RESOURCE_GROUP }} -- 
         subscription ${{secrets.AZURE_SUBSCRIPTION_ID}}

Azure will reflect a successful deployment even if they didn't pull the container properly. I fought this same bug for days and that's why this workflow step was created. I'm wondering if something with the token or the communication between Azure and GH has changed

mattdavis0351 commented 4 years ago

@mickeygousset Just to close the loop on this. It has everything to do with the GITHUB_TOKEN being ephemeral. If you scope a new Personal Access Token on GitHub and add set it as the password on the Azure container settings for your project everything will work just fine.

We are making those changes to the course now. This was a great catch!

mickeygousset commented 4 years ago

WooT! Let me know once the course is updated and I'll run the whole thing again.

hectorsector commented 4 years ago

Took care of it in #34. @mickeygousset or @lmkeston if one of you can test out the new version of the course I can merge with one 👍

mickeygousset commented 4 years ago

@hectorsector I'll run it again in the morning and report back.

bpelikan commented 3 years ago

@hectorsector @mickeygousset Any updates? Error still occur, I got the same error today. I wrote little suggestion in #34

mickeygousset commented 3 years ago

@bpelikan Looks like the PR to fix this hasn't been approved yet. Your suggestion on #34 is also a valid solution, and probably a good direction to consider going, but my thoughts are to get what we have working and then update it.

I'll follow up with @lmkeston @hectorsector this week and see what we can do to move this forward, after we get past GitHub Universe. Please feel free to continue to ping me. :)