Reputation: 1838
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:
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:
WEBSITES_PORT
and/or PORT
in the Microsoft.Web/sites
for the web app. Also, we had created a .dockerfile
with EXPOSE
keyword inside the web app itself.WEBSITES_WEBDEPLOY_USE_SCM
set to falseCR LF
to LF
in the git repository, applying the change and re-normalizing.linuxFxVersion
and/or nodeVersion
Microsoft.Web/sites
for the web app,http20Enabled
from true
to false
and applied different versions of minTlsVersion
healthCheckPath
, autoHealEnabled
, autoHealRules
and loadBalancing
WEBSITES_CONTAINER_START_TIME_LIMIT
node_modules
to the repositoryhome
directory and even a startup.sh
fileWEBSITES_CONTAINER_START_TIME_LIMIT
app.set('trust proxy', 1)
Microsoft.Web/serverfarms
. One for the Function App and another for the Web AppDOCKER_ENABLE_CI
as true
WEBSITES_PORT
) using the appSettings
property of task AzureWebApp@1
in our deployment YAML fileWe 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
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