I'm trying to run the simplest of node.js apps on a Azure App Service (Linux) but I'm out of idéas on how to get this running. I've been trying different approaches and nothing seems to work.
I'm simply deploying the app through FTP and putting the files under "wwwroot" but when requesting the url it loads forever and then ends up with a service unavailable response.
When creating the app I choose Linux as platform, runtime node.js 8.11 and deploy through "code" and not docker.
In the logs I can see this:
docker run -d -p 46852:8080 --name [appname] -e WEBSITE_NODE_DEFAULT_VERSION=8.11 -e APPSETTING_WEBSITE_NODE_DEFAULT_VERSION=8.11 -e WEBSITE_SITE_NAME=[appname] -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_INSTANCE_ID=[id] -e HTTP_LOGGING_ENABLED=1 appsvc/node:8.11.2_1805212105
Container [appname] for site [appname] did not start within expected time limit. Elapsed time = 230.4882261 sec
What does this mean, is docker being used somehow even though I setup the app with deploy through "Code" and FTP.
package.json
{
"name": "foo",
"version": "1.0.0",
"description": "x",
"author": "x",
"private": true,
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "^4.16.3"
}
}
server.js
const express = require('express')
const app = express()
const port = process.env.PORT || 3000
const host = process.env.HOST || '127.0.0.1'
app.get('/', (req, res) => res.send('Hello!'))
app.listen(port, host)
I've also tried ssh into the app and running npm install
. I've tried running the app through ssh console node server.js
but ends up with the message "Port already in use". I've tried setting the port to 8080 in "application settings" in Azure Portal.
What am I missing here? How do I get the app running?