Closed ghost closed 9 years ago
Please provide your environment details, and also command you have used to provision the service, also have you tried this with latest release of forever and forever-service?
I'm using a RaspberryPi using Debian (from the Domoticz SD card image).
The command I'm using is forever-service install -s mqtt.js sky-plus-hd-mqtt
(I have already cd
to the directory the js file is in).
And I assume I'm using the latest release? 0.5.1? There's nothing to upgrade when I do apt-get
What is version of forever? Have you npm installed latest forever version? and what version of node it has?
I believe these are my versions: Forever: 0.14.2 Node: 0.12.1
node --version
forever --version
Also where are you getting the above error message?
After I use forever-service install -s mqtt.js sky-plus-hd-mqtt
can you dump full output here
No sorry, when i install the service i get:
forever-service version 0.5.1
Platform - Raspbian GNU/Linux 7 (wheezy)
Could not provision service
Service is already present
But after I run sudo service sky-plus-hd-mqtt start
(or stop, delete or status) I get the following:
error: Forever detected script exited with code: 0 error: Script restart attempt #1 error: Forever detected script exited with code: 0 error: Script restart attempt #2 error: Forever detected script exited with code: 0 error: Script restart attempt #3
And this just loops
node & forever version?
I've already given you those: Forever: 0.14.2 Node: 0.12.1
I have already seen that, I can't see how it applies to me though. Is there nothing you can help with?
Are you able to run your script by just running forever start mqtt.js
?
Mainly, I want to know what the error code means
You will have to open issue in forever github
$ forever start mqtt.js warn: --minUptime not set. Defaulting to: 1000ms warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms info: Forever processing file: mqtt.js
Are you able to tell me where you think the issue is? Whether it's in Forever, or Forever-service, or somewhere else?
It is with forever since forever-service has provisioned the service..
Okay, thanks
https://ghost.org/forum/installation/17680-unable-to-keep-ghost-up-and-running-with-forever-or-pm2-error-unable-to-access-ghost-s-content-path/ It could be related to permissions also..
I've seen that also. But can you actually tell me what the error code 0 means.....?
As i said i have no idea, just trying to help out. Why dont you open issue in forever also.
https://github.com/foreverjs/forever/issues/725 - If you could help with this issue, I'd greatly appreciate it. You might have more knowledge and info to give.
@leecollings were you able to resolve this?
Nope, haven't heard anything back from my issue in the Forever script. From the looks of it, they don't answer hardly any of their issues. The guy who was helping me in the first place also seems to have gone quiet. So right now, I'm at a bit of a roadblock.
Regards,
Lee
On 7 July 2015 at 15:07, Arvind Agarwal notifications@github.com wrote:
@leecollings https://github.com/leecollings were you able to resolve this?
— Reply to this email directly or view it on GitHub https://github.com/zapty/forever-service/issues/31#issuecomment-119213665 .
ok, to debug it further please see if you have any logs in /var/log/sky-plus-hd-mqtt.log file. If it is, post it here.
No, that log file doesn't exist. However in the /var/log folder I have another folder called Mosquitto, within that there is a general mosquitto.log if that's helpful?
Regards,
Lee
On 7 July 2015 at 15:19, Arvind Agarwal notifications@github.com wrote:
ok, to debug it further please see if you have any logs in /var/log/sky-plus-hd-mqtt.log file. If it is, post it here.
— Reply to this email directly or view it on GitHub https://github.com/zapty/forever-service/issues/31#issuecomment-119219269 .
check you /var/log/messages and see after boot you see any messages related to this service..
Jul 7 15:32:11 domoticz domoticz: Domoticz is starting up.... Jul 7 15:32:11 domoticz domoticz: Domoticz running... Jul 7 15:33:00 domoticz kernel: [ 57.809247] w1_master_driver w1_bus_master1: Family 0 for 00.800000000000.8c is not registered.
(The last message, appears many times through the messages list - Although this could be because I have test devices set up in Domoticz, that don't have proper IDs.) But apart from that, that's the only messages on there.
Regards,
Lee
On 7 July 2015 at 15:30, Arvind Agarwal notifications@github.com wrote:
check you /var/log/messages and see after boot you see any messages related to this service..
— Reply to this email directly or view it on GitHub https://github.com/zapty/forever-service/issues/31#issuecomment-119222017 .
Can you put a console.log test message in your script in the beginning and then check if it generates the /var/log/sky-plus-hd-mqtt.log log file when starting the service.
So I added console.log("Test"); at the start of the mqtt.js file, and attempted to start the service by sudo service sky-plus-hd-mqtt start.
I received the Error code:0 message, and checked the log file, and it still doesn't exist.
Regards,
Lee
On 7 July 2015 at 15:37, Arvind Agarwal notifications@github.com wrote:
Can you put a console.log test message in your script in the beginning and then check if it generates the /var/log/sky-plus-hd-mqtt.log log file when starting the service.
— Reply to this email directly or view it on GitHub https://github.com/zapty/forever-service/issues/31#issuecomment-119223803 .
I'm running Ghost on RaspberryPi and I'm seeing the same error. I would like to just be able to delete the failing service but 'forever-service' delete fails too.
root@pi:/home/dennis/ghost# forever-service delete ghost forever-service version 0.5.2
Platform - Raspbian GNU/Linux 7 (wheezy) Shutting down ghost: error: Forever detected script exited with code: 0 error: Script restart attempt #1 error: Forever detected script exited with code: 0 error: Script restart attempt #2 ...
Can you provide a script to replicate this issue in Centos / Debian?
I'm using Raspbian (3.18.7-v7+ armv7l GNU/Linux) and the script is the GhostJs launch script; https://github.com/TryGhost/Ghost/blob/master/index.js
@denniskenny are you able to replicate it in Centos / or Debian? I cant debug in Raspbian..
Both @leecollings and myself are using GhostJs on Raspbian, so it may be specific to that build or app. Let me know if there are further steps or logs I can post here. I'll keep digging.
I'm also seeing error: Forever detected script exited with code: 0
but I'm using Amazon Linux AMI. Running latest forever 0.15.1 and latest forever-service 0.5.3. I've made sure that both forever and forever-service are installed globally.
I've tried all kinds of things, and have some 5 apps running on the system, and none of them are able to start as a service.
This is hard to debug, because the only error I get is the one above. I've tried the newish --runAsUser but that did not change anything, same error.
@leecollings @denniskenny have you been able to make this work in any way?
And just wanted to add that starting any of the 5 apps using forever either using sudo or normally as the ec2-user, starts them and runs overall super stable. 4 of them are Express based apps, the last one is a super simple http test app, that includes the below:
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('testing. . .\n');
}).listen(3000);
console.log('Server running');
@houmark how did you install nodejs on Amazon Linux? I am trying to debug this, I have personally 50+ instances in Amazon linux running with forever-service and have never faced this issue. So this is kind of strange, are you able to replicate this issue in a brand new Amazon Linux instance also? If yes, could you share the instance initialisation code, so that I can replicate the issue in my environment.
@arvind-agarwal That's a good question. I've been tweaking everything on the server, but the very first install, including nodejs, was done by a college, so I'm not completely sure. Can you point me to anything I can check for reference? nodejs relies in /usr/local/bin/node - sudo is required for global install (have been looking at adding that folder to the sudoers configuration but haven't done it yet).
@leecollings Not sure why this one was closed now?
In the meantime I was looking more into our current node installation and it seems like the node source was downloaded to the /home/ec2-user/node and then make install from there to its final location /usr/local/bin/node, as mentioned before. Is there a more recommended way? I also saw a recommendation to install using yum (which is how everything else on the server is installed): sudo yum install nodejs npm --enablerepo=epel
.
@arvind-agarwal What is your recommended way, so I can try to reinstall node in that way? This will be our first production system on AWS with node.js so we don't have much experience in setting it up. Maybe this use case can help tweak either how forever-service runs or some improved docs on how node should be running on Amazon Linux in order for it to work.
And here follows some more information about our EC2 install:
node.js is installed using make install after downloading the official source. Version is 0.12.4. make test
runs and completes all tests with no errors found. The etc/sudoers includes (and has always included) /usr/local/bin so nothing to change here in as I see it.
To me it seems like node.js is installed perfectly fine and should not be the issue here. So then the question goes to what we can look at then? I'm curious to hear how you install node.js on your EC2 instances. I would like to try installing a new isolated fresh instance up, but will be awaiting your feedback before attempting that.
@houmark can you try to run with -e param to specify the path -e "PATH=/usr/local/bin:\$PATH".
Look at #28 for sample
@arvind-agarwal Thanks for you feedback.
Unfortunately I get the same result. The service gets provisioned without problems (it always did), but starting it is a problem:
[ec2-user@ip-xxx-xxx-xxx-xxx test]$ sudo forever-service install testing -s /var/www/test/app.js -e "PATH=/usr/local/bin:\$PATH"
forever-service version 0.5.3
Platform - Amazon Linux AMI release 2015.03
testing provisioned successfully
Commands to interact with service testing
Start - "sudo service testing start"
Stop - "sudo service testing stop"
Status - "sudo service testing status"
Restart - "sudo service testing restart"
[ec2-user@ip-xxx-xxx-xxx-xxx test]$ sudo service testing start
error: Forever detected script exited with code: 0
I also tried without the -s parameter, but with the same result.
Added: Only killing with CTRL + C gets me out of that situation and it's the same situation if I try to delete the service. So I'm using a new unique name every time, and manually delete them by removing the script and symlink manually.
@houmark try one more thing, change directory to /var/www/test directory and than provision the script and see if it has better result
cd /var/www/test
sudo forever-service install testing -s app.js -e "PATH=/usr/local/bin:\$PATH"
Unfortunately that's exactly what I did...
I will try again, I see you did -s app.js which I did not try specifically.
Do you see anything in /var/log/testing.log?
Getting this error when trying to install a service, as well as get status, or remove it.
Can't find anywhere that explains this error, and have even seen other forum posts with similar errors but with codes null, 8, etc.
Can you help identify the problem?