Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use forever with upstart on Ubuntu #657

Open
richsad opened this issue Dec 23, 2014 · 2 comments
Open

Unable to use forever with upstart on Ubuntu #657

richsad opened this issue Dec 23, 2014 · 2 comments

Comments

@richsad
Copy link

richsad commented Dec 23, 2014

I am trying to use forever v0.13.0 with Ubuntu 13.10 and upstart. I've found several blogs and stackoverflow posts explaining how to do this. However it always fails to run. It logs the error:

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: /home/rich/simple-server/simple.js

fs.js:439
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: EROFS, read-only file system '/etc/forever/sNX9.log'
at Object.fs.openSync (fs.js:439:18)
at Object.forever.startDaemon (/home/rich/npm/lib/node_modules/forever/lib/forever.js:484:14)
at /home/rich/npm/lib/node_modules/forever/lib/forever/cli.js:270:13
at /home/rich/npm/lib/node_modules/forever/lib/forever/cli.js:157:5
at /home/rich/npm/lib/node_modules/forever/lib/forever.js:436:11
at Object.oncomplete (fs.js:108:15)

I have tried many different directories, all marked read/write for all users. It doesn't matter what directory I use I get this same error. I have tried this with the tiniest possible node server with no node_module dependencies. The directory shown in the example above has 777 chmod rights.

The above error was generated with node.js v0.10.34. But I've also tried 0.10.25 on another system. Same problem. My upstart script simple has:

start on startup
env FOREVER_ROOT=/etc/forever
exec /home/rich/npm/bin/forever start /home/rich/simple-server/simple.js

I have used other more complex scripts as well, but no matter what forever is unable to write its data despite the directory being accessible to all users. Of course I've tried the default directory forever uses as well with the same results. I've even added sudo command between the exec and the forever command. No joy.

This seems like a bug in the module. Since other people are claiming forever can be used with upstart I have to assume this is something specific to version 0.13.0. For the sake of completeness, the test app I'm trying to run is:

var sys = require("sys"),
my_http = require("http");
my_http.createServer(function(request,response){
sys.puts("I got kicked");
response.writeHeader(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8080);
sys.puts("Server Running on 8080");

@davidrinnan
Copy link

I had similar issues.
If I was standing in the folder of the node js file I want to run everything worked well.

When I tried executing with upstart I had to write the full path to the node script I want to run and then it failed.

This is the only way I've been able to run it

start on startup
chdir /var/www/myfolder/server
exec forever start -a -w -o /var/log/twebout.log -e /var/log/tweberr.log main.js

I am not changing my env root so it is running from ~/.forever/
Everything is default, so to say.
I can use forever logs 0 (to give an example)

the way I run it now also means that -w is working from the chdir path.

@mihaicostin
Copy link

mihaicostin commented Sep 23, 2016

@richsad, I think this is an upstart script problem (not a forever one).

Error: EROFS, read-only file system '/etc/forever/sNX9.log'

Try using start on filesystem instead of start on startup (so that forever can actually write to the log file).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants