[Vuejs]-Service Unavailable running Vue app to Azure App Service on Linux

0👍

To host one Azure App Service I found (on Windows anyway) you need:

  • A server.js file
  • A correct npm start task in your packages.config.

server.js

An older basic version or the new 1.x examples for different node servers you can use. You can see in these how they use const port = process.env.PORT || 3000, where process.env.PORT is an environment variable set by default in Azure.

Potentially you can add an app setting in the portal for your app called PORT to override the default environment variable if you ever had to, but I don’t know if it’d work as I’m guessing Azure host off a port they know, trust and expose willingly.

npm start task

node server.js, or try remove the task entirely as Azure (at least on Windows) runs the same automatically.

Automated deployments
I also setup git deployment for my app so it auto-deploys when I push commits to my master branch. I needed a custom post deployment script to run the npm tasks. Here’s my gist instructions if it helps. Again, for Windows, but you can take a default post-deploy Linux script and add the necessary custom lines like I did.

Leave a comment