Dotcloud nodejs supervisord.conf not working

I am trying to control the process of a nodejs server with a supervisor, but I am having problems working on supervisord.conf. When I deploy, I get the following error:

WARNING: The service crashed at startup or is listening to the wrong port. It failed to respond on port "node" (42801) within 30 seconds. Please check the application logs. 

However, when I ssh to the dotcloud server and start the nodejs process manually, it works just fine, indicating that the supervisor is not starting the node instance.

My supervisord.conf looks like this:

 [program:node] command = node /home/dotcloud/current/app/server.js autostart=true autorestart=true 

And my directory structure is as follows:

 .dotcloudignore dotcloud.yml .gitignore app/ app/package.json app/server.js app/supervisord.conf 

At this moment, I don’t see what I am doing wrong, since it looks like the same directory structure as here , so I don’t understand what the solution is. Any ideas?

Edit:

After trying a supervisorctl status I get the following:

 node FATAL Exited too quickly (process log may have details) 

I found that the following error message appears in / var / log / supervisor:

 module.js:337 throw new Error("Cannot find module '" + request + "'"); ^ Error: Cannot find module '/home/dotcloud/current/app/server.js' at Function._resolveFilename (module.js:337:11) at Function._load (module.js:279:25) at Array.0 (module.js:484:10) at EventEmitter._tickCallback (node.js:190:38) 

I am not sure what causes this.

0
source share
1 answer

After examining the problem, it seems that the problem arose because dotcloud.yml specified by approot: app . In this case, it is useful to note that:

  • /home/dotcloud/code will point to the entire code repository;
  • /home/dotcloud/current will point to the corresponding one (more specifically, /home/dotcloud/current will be a symbolic link to the corresponding one, i.e. code/app in this case).

Therefore, supervisord.conf should not contain:

 command = node /home/dotcloud/current/app/server.js 

But instead:

 command = node /home/dotcloud/current/server.js 

The key was in the Node.js magazines themselves, as Node.js complained about being unable to find /home/dotcloud/current/app/server.js .

+2
source

Source: https://habr.com/ru/post/943576/


All Articles