Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular CLI app not running when deploying to Linux App Service

I'm trying to deploy an Angular CLI app to Azure App Service on Linux OS, using Azure Dev Ops - but no success. I get Image 1. No error in the server or application logs.

Image 1

This is what I done so far:

  1. Built the Angular CLI app using DevOps Build and placed the resulted "dist" folder to the "drop" folder. See below (Image 2) the tasks that compose my build. This is working fine and creating the expected files.

Image 2

  1. Created a release in DevOps, deploying all the dist files in the wwwroot folder in the Azure App Service in Linux. Shown below are both, the wwwroot folder (left) and my local dist folder (right) after I run a ng build --prod.

Image 3

I have the suspicion that I need to kickstart the angular by feeding some time of command when doing the deployment. I have tried running "ng serve --host 0.0.0.0" but that didn't work.

like image 942
Dustin Avatar asked Dec 08 '22 12:12

Dustin


2 Answers

Check the Azure App Service > Linux section on this page. Essentially, you have to serve the app. You can configure this with a ecoysystem.config.js PM2 file in the root directory, with this inside.

module.exports = {
    apps: [
        {
            script: "npx serve -s"
        }
    ]
};

I also added npx serve -s in the App Service Configuration > General Settings > Startup Command

enter image description here

See also: https://burkeholland.github.io/posts/static-site-azure

like image 81
Dave Skender Avatar answered May 19 '23 13:05

Dave Skender


I had to give the npx serve -s as the startup commandenter image description here

Then set the Runtime Stack with node framework 10.16 (NODE|10.16). See belowenter image description here

Then everything started working.

like image 29
sunil Avatar answered May 19 '23 15:05

sunil