Successful deployment still leads to default page

吃可爱长大的小学妹 提交于 2021-02-10 15:44:05

问题


I followed the contents of three different tutorials in deploying a slightly-modified boilerplate React app to Azure App Services. The primary issue I'm having is that while all deployment pipelines and releases have been successful on Azure DevOps, navigating to the page results in the default landing page for non-deployed app services;

Hey, Node developers! Your app service is up and running. Time to take the next step and deploy your code.

I'll briefly describe the steps I took to get to this point:

  1. I used create-react-app to generate a basic template, ran all the prerequisite commands, fiddled with the app.js file and its CSS companion, and left index.* untouched.
  2. I pushed all of it with an untouched gitignore to a Github repository.
  3. I created an App Service, running Linux and Node 12 LTS, on the Free plan.
  4. I created a DevOps project, and within it created a Pipeline and a Release Pipeline.
  5. In the Pipeline: I retrieved my repository source via linked accounts in the Get Sources step. In Agent job 1, I added a npm install element, a npm run build element, and a Publish Artifact element. I set the path to build, and artifact name to artifact, publishing to Azure Pipelines.
  6. In the Release Pipeline: I added an artifact that grabs its source from the previous pipeline, and gives a source alias of _artifact. CD trigger is enabled. I added a stage that has a Deploy Azure App Service element, using $(System.DefaultWorkingDirectory)/_artifact/artifact as the package/folder.

When I push a commit or manually trigger the first pipeline, everything succeeds with no obvious errors. The Release pipeline is triggered and also completes without error. Checking the logs, the artifact is stored and accessed accurately. I can see the correct build files being accessed.

In the Azure portal, I can see that deployment has succeeded with the correct timestamp, commit name, and pipelines. However, when I access the actual site, I am shown the generic page.

Am I missing a crucial step somewhere? I've tried navigating to /index.html, /src/index.html, and a bunch of other combinations of known files, but to no avail; Cannot GET /index.html.

Any insight would be appreciated.

For reference, I used these three walkthroughs:

  • https://medium.com/microsoftazure/deploying-create-react-app-as-a-static-site-on-azure-dd1330b215a5
  • https://medium.com/@to_pe/deploying-create-react-app-on-microsoft-azure-c0f6686a4321
  • https://www.pluralsight.com/guides/deploy-a-react-app-to-azure

回答1:


This question is very simple, you can refer to the following post.

1. Deploy create-react-app with azure pipelines

2. Unable to deploy React JS application on Azure App service

3. Process for React App deployment to Azure Web?

Suggestion:

  1. It is recommended to choose linux when creating a webapp.

  2. Configuration->StartupCommand: pm2 serve /home/site/wwwroot --no-daemon --spa



来源:https://stackoverflow.com/questions/64708381/successful-deployment-still-leads-to-default-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!