I am trying to deploy my angular web app
to a free tier azure web app service
for testing purposes.
My angular app is deployed by an azure pipeline
and completes successfully.
Which I can confirm in the Deployment Center
in the azure portal as well.
Though when visiting the page I end up on a 404 page.
As suggested in this post by the second answer.
I added this command to the StartUp section in the configuration
pm2 serve /home/site/wwwroot –spa –no-daemon
in the logs I can see the following;
2024-02-26T12:01:08.928889037Z: [INFO] 12:01:08 0|static-page-server-8080 | [2024-02-26T12:01:08.907Z] Error while serving /home/site/wwwroot/index.html with content-type text/html : ENOENT: no such file or directory, open '/home/site/wwwroot/index.html'
Which says it can’t find set files. to serve my application.
I, however, don’t know where my files would be or how I can find out where azure stores these files so I can adjust the given path for the pm2 command.
Can anyone help with this issue?
2
Answers
searching for an answer I came upon this post. Though the suggested answer was for a react application. I tried it myself, by putting the following command in my startup
This didn't give me my desired result, BUT it did show my file directories. this allowed me to find my where my index.html was located. In return I could edit the
PM2
command and my application was served as desired. Most like likely there is a different command that doest the same and maybe is even better suited. if so please just comment on my answer improve my answerIn order to deploy the Angular app successfully you need to build the Angular app in Azure devops pipeline and deploy its dist folder via YAML or Release pipeline. Refer my SO answer1 and SO answer2 where I have deployed the Angular app via Release and yaml azure devops pipelines.
Go to Pipelines > New Pipelines > Azure Repos git > Select your Angular project's repository > Starter pipeline > Add the yaml code below > Replace WebAppName with your Web app> Save and run the pipeline:-
My YAML pipeline code:-
Output:-
Connected to Azure Repos directly after the deployment in Deployment Center:-