strongloop / strong-service-install

Create/install system service for a given app
Other
7 stars 3 forks source link

pm-install missing creation of /var/lib/strong-pm? #10

Open notbrain opened 9 years ago

notbrain commented 9 years ago

(Moved from https://github.com/strongloop/strongloop/issues/244)

I've just upgraded to 5.0.0 and our apps are no longer spawning with strong-pm. See strong-pm issue 270, strange syntax error when I simply try to run the upstart job.

But also now that I've attempted a fresh global install of strongloop, a subsequent sudo slc pm-install no longer knows how to create the /var/lib/strong-pm directory.

This is after a complete removal of strongloop and deleting /var/lib/strong-pm:

$ sudo npm install -g strongloop
...
$ sudo slc pm-install
Error installing service 'strong-pm': ENOENT, open '/var/lib/strong-pm/env.json'

A manual creation of /var/lib/strong-pm (+ chown -R strong-pm:strong-pm) seems to have fixed it and allowed the upstart job to start.

rmg commented 9 years ago

@notbrain feel like opening a PR?

Based on this index.js:373, I have a feeling it will be trivial to fix ;-)

panduroab commented 9 years ago

Same issue with:

Ubuntu 14.04.2 LTS
node v0.12.7 
npm 2.11.3
strong-pm@5.0.1

I run

sudo npm install -g strong-pm
//No errors in the installation
sudo sl-pm-install

I got this message

Error installing service 'strong-pm': ENOENT, open '/var/lib/strong-pm/env.json'

and the folder /var/lib/strong-pm doesn't exists

Regards

rmg commented 9 years ago

@panduroab did you previously install strong-pm and then delete /var/lib/strong-pm? Or did you create a strong-pm user ahead of time?

The easiest fix here would be:

sudo mkdir -p /var/lib/strong-pm
sudo chown -R strong-pm /var/lib/strong-pm
panduroab commented 9 years ago

@rmg I did that and I can deploy my application on the server, however the problem is that the application is unable to start with strong-pm@5.0.0

The application code is uploaded at

/var/lib/strong-pm/svc/1/work/00e1766a067375bdeb154f85a43b00cda10137f8.1444333138496/

But doesn't appears a 'current' folder like with the older version of strong-pm

I have this configuration in the /etc/init/strong-pm.conf file

# strong-pm
# Generated by strong-service-upstart on 2015-10-08T20:04:09.064Z

description "StrongLoop Process Manager"
author "root"
start on runlevel [2345]
stop on runlevel [016]
respawn
console log
chdir /var/lib/strong-pm
setuid strong-pm
setgid strong-pm
limit nofile 50000 50000
limit core unlimited unlimited
env HOME=/var/lib/strong-pm
exec /usr/bin/nodejs /usr/lib/node_modules/strong-pm/bin/sl-pm.js --listen 8080 --base /var/lib/strong-pm --base-port 3000 --driver direct

Is this the right configuration for this strong-pm version? Actually I can run the application with node and forever.

Regards

rmg commented 9 years ago

Is there anything in /var/log/upstart/strong-pm.log indicating an error starting the app?

panduroab commented 9 years ago

Hello @rmg after a successful deployment I get this error on the strong-pm.log file

npm ERR! Linux 3.13.0-53-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "rebuild"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! path /var/lib/strong-pm/svc/1/work/e64ea1bc3d64a4b49abbc5d436746ac49fc841f4.1444659766403/node_modules/grunt-docular/node_modules/express/node_modules/send/node_modules/mime/cli.js
npm ERR! code ENOENT
npm ERR! errno -2

npm ERR! enoent ENOENT, chmod '/var/lib/strong-pm/svc/1/work/e64ea1bc3d64a4b49abbc5d436746ac49fc841f4.1444659766403/node_modules/grunt-docular/node_modules/express/node_modules/send/node_modules/mime/cli.js'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     /var/lib/strong-pm/svc/1/work/e64ea1bc3d64a4b49abbc5d436746ac49fc841f4.1444659766403/npm-debug.log

Regards

panduroab commented 9 years ago

Hello @rmg, I updated the dependencies and I deployed the application again and I got this message:

2015-10-12T15:16:25.911Z pid:14067 worker:0 INFO strong-agent strong-agent using strong-cluster-control v2.2.1
2015-10-12T15:16:25.914Z pid:14067 worker:0 INFO supervisor reporting metrics to `internal:`
2015-10-12T15:16:25.922Z pid:14067 worker:0 INFO strong-agent agent metrics license not found, local reporting disabled.
2015-10-12T15:16:25.922Z pid:14067 worker:0 Please contact sales@strongloop.com for assistance.
2015-10-12T15:16:25.925Z pid:14067 worker:0 INFO supervisor size set to 1
2015-10-12T15:16:26.037Z pid:14067 worker:0 INFO supervisor started worker 1 (pid 14072)
2015-10-12T15:16:26.038Z pid:14067 worker:0 INFO supervisor resized to 1
2015-10-12T15:16:26.381Z pid:14072 worker:1 INFO strong-agent[14072] started profiling agent
2015-10-12T15:16:29.031Z pid:14072 worker:1 LoopBack server listening @ https://dev-api.mydomain.com:3001/
sl-pm.js: Service "1" listening on *:3001

Also the 'current' folder has been created on the 'work' path, it seems like is running but not, I tried to access to:

https://dev-api.mydomain.com:3001/ https://dev-api.mydomain.com:3000/ http://dev-api.mydomain.com:3001/ http://dev-api.mydomain.com:3000/ https://dev-api.mydomain.com/ http://dev-api.mydomain.com/

and nothing.

Exists another log file that I can consult to see what is happening?

Thanks

rmg commented 9 years ago

It looks like you fixed the dependency problem... is the "main" script of your app server/server.js by any chance?

If so, this might be strongloop/strong-pm#283 which will be fixed very soon (strongloop/strong-supervisor#165).

panduroab commented 9 years ago

@rmg yes, the "main" script is server/server.js

Thanks!

rmg commented 9 years ago

strong-supervisor@3.3.0 has been released and includes the fix for this. @panduroab can you update and give it a spin?

panduroab commented 9 years ago

@rmg I don't see strong-supervisor as a dependence of strong-pm module, what is the way to use it on my project?

I installed it as a general dependence on my sever and I restart my project

npm install -g strong-supervisor
sudo /sbin/initctl restart strong-pm

Is this the right way or I need to do something different?

Thank you!

rmg commented 9 years ago

it's not a direct dependency of strong-pm. Re-running npm install -g strong-pm will install the latest dependencies (similar to npm update -g strong-pm only faster).

panduroab commented 9 years ago

@rmg the applications works pretty well, thank you very much for your help!

cgole commented 8 years ago

@panduroab, can I close this issue?

rmg commented 8 years ago

@cgole please leave open. The original issue is still valid and unrelated to @panduroab's problem.

Cu4rach4 commented 7 years ago

Did you install node with nvm?