acarlstein
acarlstein

Reputation: 1838

Why WEBSITES_PORT and PORT in Microsoft.Web/sites is ignored, as well as, EXPOSE in the dockerfile?

Why WEBSITES_PORT and PORT in Microsoft.Web/sites is ignored, as well as, EXPOSE in the .dockerfile?

Our docker keeps crashing when the health check fails. There is no respond to the HTTP pings.

We get messages such as didn't respond to HTTP pings on port: 8080 as shown below:

enter image description here

Explanation

We are running a function app and a web app, done on Nodejs, on the same Azure App Service plan.

A single resource Microsoft.Web/serverfarms is created of kind Linux using Basic B2 plan.

Then, two Microsoft.Web/sites are created: One of kind functionapp,linux for the function app in and another of kind app for the Nodejs web app.

Our web app is a simple Nodejs using express server which is listening to the port:

const express = require('express')
const session = require('express-session')
...
const app = express()
...
const port = process.env.PORT || '3000'
app.set('port', port)
app.listen(port, () => console.log(`App started on port ${port}`))

Attempts

The following is a list of steps we have tried and had failed:

We even added an entry point:

app.get('/api/health/', function(req, res){
  res.status(200).send('OK')
})

Finally, we spend days searching online and trying everything we encountered and since we are still not solving this issue, we were wondering if someone could spot what are we missing.

In advance, thanks for going over this long explanation and appreciate any help you can provide me.

Upvotes: 1

Views: 369

Answers (1)

acarlstein
acarlstein

Reputation: 1838

My coworker Albert Linga found out what as the root cause of the problem.

Under Microsoft.Web/sites, properties, siteConfig, there is the property remoteDebuggingEnabled. This property must be disabled (false). Plus, the kind attribute must be changed from app to app,linux.

Then, in the task AzureWebApp@1, we changed the property runtimeStack to NODE|12-lts so it matches the property linuxFxVersion (NODE|12-lts) which is inside siteConfig, under Microsoft.Web/sites

Upvotes: 0

Related Questions