HI, I'm trying to deploy an app which was working until a few hours ago without success.
So I created simple text case with node.js and express.js. Latest versions of anything. I create a new bluemix app and.
> express testapp
> cd test app
Then I edit /var/www setting:
"app.set('port', process.env.VCAP_APP_PORT || 3000);"
Saved the file.
Added:
"engines": {
"node": "0.10.x",
"npm": "1.3.x"
}
To package.json, saved the file. Then.
> cf push myexpresstest
Fails to start. In the logs I find:
> cf logs myexpresstest --recent
Says:
2014-12-17T10:12:52.16+0100 [DEA] OUT Got staging request for app with id a727292d-28f9-4880-b46b-61cb7d8b08e9
2014-12-17T10:12:55.33+0100 [API] OUT Updated app with guid a727292d-28f9-4880-b46b-61cb7d8b08e9 ({"state"=>"STARTED"})
2014-12-17T10:12:55.47+0100 [STG] OUT -----> Downloaded app package (4.0K)
2014-12-17T10:12:57.68+0100 [STG] OUT -----> Resolving node version by IBM
2014-12-17T10:12:57.74+0100 [STG] OUT -----> Requested node range: 0.10.x
2014-12-17T10:12:57.74+0100 [STG] OUT -----> Resolved node version: 0.10.33
2014-12-17T10:12:57.74+0100 [STG] OUT -----> Installing IBM SDK for Node.js from admin cache
2014-12-17T10:12:58.33+0100 [STG] OUT -----> Restoring node_modules directory from cache
2014-12-17T10:12:59.69+0100 [STG] OUT -----> Writing a custom .npmrc to circumvent npm bugs
2014-12-17T10:13:01.18+0100 [STG] OUT -----> Cleaning up node-gyp and npm artifacts
2014-12-17T10:13:01.19+0100 [STG] OUT -----> No Procfile found; Adding npm start to new Procfile
2014-12-17T10:13:01.19+0100 [STG] OUT -----> Building runtime environment
2014-12-17T10:13:01.20+0100 [STG] OUT -----> Checking and configuring service extensions
2014-12-17T10:13:01.28+0100 [STG] OUT -----> Node.js Buildpack is done creating the droplet
2014-12-17T10:13:03.66+0100 [STG] OUT -----> Uploading droplet (7.7M)
2014-12-17T10:13:22.78+0100 [API] OUT App instance exited with guid a727292d-28f9-4880-b46b-61cb7d8b08e9 payload: {"cc_partition"=>"default", "droplet"=>"a727292d-28f9-4880-b46b-61cb7d8b08e9", "version"=>"5842b60b-1bfb-4f35-9a97-6198c442ac41", "instance"=>"844898f989244baf857e0c395fea15c5", "index"=>0, "reason"=>"CRASHED", "exit_status"=>0, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1418814802}
2014-12-17T10:13:22.79+0100 [DEA] ERR Instance (index 0) failed to start accepting connections
2014-12-17T10:14:49.55+0100 [DEA] OUT Starting app instance (index 0) with guid a727292d-28f9-4880-b46b-61cb7d8b08e9
2014-12-17T10:14:52.20+0100 [API] OUT App instance exited with guid a727292d-28f9-4880-b46b-61cb7d8b08e9 payload: {"cc_partition"=>"default", "droplet"=>"a727292d-28f9-4880-b46b-61cb7d8b08e9", "version"=>"5842b60b-1bfb-4f35-9a97-6198c442ac41", "instance"=>"5abaaf4730fa4c5094d431fc92724ce2", "index"=>0, "reason"=>"CRASHED", "exit_status"=>0, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1418814892}
2014-12-17T10:14:52.20+0100 [DEA] ERR Instance (index 0) failed to start accepting connections
2014-12-17T10:14:52.22+0100 [API] OUT App instance exited with guid a727292d-28f9-4880-b46b-61cb7d8b08e9 payload: {"cc_partition"=>"default", "droplet"=>"a727292d-28f9-4880-b46b-61cb7d8b08e9", "version"=>"5842b60b-1bfb-4f35-9a97-6198c442ac41", "instance"=>"5abaaf4730fa4c5094d431fc92724ce2", "index"=>0, "reason"=>"CRASHED", "exit_status"=>0, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1418814892}
2014-12-17T10:15:47.00+0100 [DEA] OUT Starting app instance (index 0) with guid a727292d-28f9-4880-b46b-61cb7d8b08e9
2014-12-17T10:15:51.72+0100 [App/0] ERR
2014-12-17T10:15:51.90+0100 [DEA] ERR Instance (index 0) failed to start accepting connections
What it's happening?
Thanks.
Answer by Yata (1) | Dec 17, 2014 at 11:09 AM
Actually this is an issue in Bluemix.
In my package.json file:
"scripts": {
"start": "node ./bin/www"
}
No Procfile here. According to https://developer.ibm.com/answers/questions/22585/pushing-nodejs-app/ , script.start should be executed after cf push, but that never happens. node app.js is executed instead. Adding a Procfile does not solve anything.
So the solution was moving the contents of /bin/www to app.js. Now the app works.
Answer by Dave Cariello (2901) | Dec 17, 2014 at 10:11 AM
Hi Yata,
Have you seen this devWorks question? --> https://developer.ibm.com/answers/questions/22585/pushing-nodejs-app/
Looks like you are asking the same thing.
Bluemix - is possible create an app using NodeJS and ExpressJS 4? 2 Answers
How to increase default request timeout value in node.js application running on bluemix? 2 Answers
How do I get the instance memory in use for a Node-Express App running in CloudFoundry? 1 Answer
Failed on build stage when pushing a node.js app. 3 Answers
Simple application node.js + express + jsondb service times out 2 Answers