Skip to Content
0

Node js deployment using HCP

Dec 20, 2016 at 04:56 AM

340

avatar image
Former Member

Hi All,

I was trying to deploy a small sample node js program in HCP but unable to do so.

There is only one node js file in my local folder along with manifest.yml. The node js file only has a simple console.log.

The time I am pushing the code using - cf push <appname>, I am getting FAILED Server error, status code: 400, error code: 100005, message: You have exceeded y our organization's memory limit.

I was following below link and everything works well except this pushing.

https://www.cloudfoundry.org/deploy-a-react-redux-node-js-application-on-sap-hcp-with-cloud-foundry/

Below are the contents of my manifest.yml & I am using trial account for this deployment -

--- applications:

- name: appname

memory: 256M

Thanks in advance.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Florian Pfeffer
Dec 20, 2016 at 06:56 AM
0

The message looks like the memory quota is exceeded. In beta phase you have 1 GB assigned.

Are you running other applications within that organization (please check this e.g. by "cf apps" or in the "SAP HCP, Starter Edition for Cloud Foundry Services (beta) Cockpit".

Regards,
Florian

Show 5 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Florian,

Yes you are right, in the process of trying in breaks, I had already uploaded 2 applications of 2G each without realizing they were pushed.

After I deleted those, this one was pushed. When I look at the cockpit, I see that the application is in running state, but the application routes do not. I then tried to create an instance, but even then the instance is not getting up and below is the error which is getting fired -

"failed to accept connections within health check timeout", "crash_timestamp"=>1482219778}

In between, the instance tries to get up, but then in a fraction of a second it stops (the log is coming on the cf push console).

My node js at this moment has only below code -

var http = require('http');
http.createServer(function (req, res) {
res.end('Hello World\n');
}).listen(3000, '127.0.0.1');
console.log('Server running at http://127.0.0.1:3000/');

If you can help me know why this is happening, will save me efforts.Thanks a lot!

0

You are deploying the application using a fix port 3000 and a host (which is fine for your local testing). Running in CF you only have to set the port provided by CF:

let http = require('http');
http.createServer(function (req, res) {
res.end('Hello World');
}).listen(process.env.PORT || 3000);
0
Former Member
Florian Pfeffer

Ok, I did above by removing the hardcoding & replaced it with process.env.port - isn't working.

Getting something like this -

0 of 1 instances running, 1 down 0 of 1 instances running, 1 starting 0 of 1 instances running, 1 down 0 of 1 instances running, 1 down 0 of 1 instances running, 1 down 0 of 1 instances running, 1 down

Error showing is same -

2016-12-20T15:51:55.71+0530 [API/0] OUT App instance exited with

"reason"= >"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1482229315}

For time being, I also tried to set port environment variable using the

cf set-env <myappname> PORT 3000

Server error, status code: 400, error code: 100001, message: The app is invalid: environment_variables cannot set PORT

0

Sorry. the port property must of course be written in upper-case not lower-case (process.env.port -> process.env.PORT).

0
Former Member
Florian Pfeffer

No luck, still getting the same error -

2016-12-20T16:22:56.26+0530 [API/0] OUT App instance exited with guid payload: {"cc_partition"=>"default", "index"=>0, "reason"= >"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1482231176}

& it did try for once -

0 of 1 instances running, 1 down 0 of 1 instances running, 1 down 0 of 1 instances running, 1 down 0 of 1 instances running, 1 down 0 of 1 instances running, 1 starting 0 of 1 instances running, 1 down

0
avatar image
Former Member
Feb 22, 2017 at 03:06 AM
0

Seems like the healthcheck is not returning int he allotted time (1second)?

I had a question regarding healthcheck. I want to use a "http" healthcheck type and it seems it's not supported?

In manifest.yml:

health-check-type: http   

health-check-http-endpoint: /healthcheck


And i get the following error:

PALM00573175A:bridge-bot nsingh$ cf push
Using manifest file /Users/nsingh/Code/bridge-bot/manifest.yml
Updating app bridge-bot in org SAP_jam / space bridge-stage as navjeet.singh@sap.com...
FAILED
Server error, status code: 400, error code: 100001, message: The app is invalid: health_check_type must be one of port, none, process

Why is it returning "none" as one of the healthcheck types instead of "http" ?

Share
10 |10000 characters needed characters left characters exceeded