tableflip / guvnor

A node process manager that isn't spanners all the way down
MIT License
430 stars 37 forks source link

running etherpad-lite #72

Closed justmwa closed 8 years ago

justmwa commented 8 years ago

Hi, I pulled etherpad-lite from github, configured settings.json, launched manually run.sh once, everything is fine. Now if I want to guv start it, it's another story! I created a minimal package.json to have npm start working, but it's still no go for guv. I created a basic script:

!/usr/bin/env node

var path = require("path"); var fs = require("fs"); var path = path.dirname(fs.realpathSync(__filename));

require(path + '/node_modules/ep_etherpad-lite/node/server'); which works if I guv start it, but I can't restart it afterwards: {"message":"Cannot find module '/usr/local/guvnor/EkeRZPVAd'","code":"MODULE_NOT_FOUND","stack":"Error: Cannot find module '/usr/local/guvnor/EkeRZPVAd'\n at Function.Module._resolveFilename (module.js:336:15)\n at Function.Module._load (module.js:278:25)\n at Module.require (module.js:365:17)\n at require (module.js:384:17)\n at /usr/lib/node_modules/guvnor/lib/daemon/process/ProcessWrapper.js:59:7\n at process._tickCallback (node.js:355:11)","date":1436947090396,"level":"error","timestamp":"2015-07-15T07:58:10.398Z"}

I'm not a coder so bear with me if all I did was stupid, but I'd really like to have guv start etherpad like other apps and not do a manual script just for this one. thanks!

achingbrain commented 8 years ago

Looks like you've installed etherpad-lite as an app, then cloned it, edited the clone and tried to start that instead?

If that's correct, remove the app version and try starting your edited copy again.

If you do:

$ guv lsapps

You'll see a list of installed apps, probably containing etherpad-lite or something similar - to remove it do:


$ guv rmapp etherpad-lite

Replace etherpad-lite with whatever was shown as the app name in the output from guv lsapps

justmwa commented 8 years ago

I didn't clone it, that's where it ended when installing it from guv-web. So removing it with rmapp leaves me with nothing as there is no clone.. Maybe that's how I should do it, cloning first? I am still worried by the lack of package.json for this app...

achingbrain commented 8 years ago

Ah, right. You mentioned that you created a package.json, settings.json and what looks like a shell script - where did you put them?

justmwa commented 8 years ago

in /usr/local/guvnor/EkeRZPVAd.

achingbrain commented 8 years ago

Any changes you make in that directory will be undone if you update the app so tread carefully.

I've never used etherpad-lite but your best bet is to clone the etherpad-lite repo somewhere in your home directory and edit the files there.

From the looks of it, it's got a package.json in the src directory but it doesn't have a main field.

There's a bin field in the existing package.json that points to ./node/server.js - maybe add a main field that points to the same file?

If you can run node . in the same directory as the package.json and have it start up, then running guv start . in that directory will start it under guvnor.

justmwa commented 8 years ago

Thanks for your help, I'll look into having "node ." work properly. However, guv start bin/ethercalc works just fine with a package.json missing "main" and "node ." failing in a similar manner. Go figure!

achingbrain commented 8 years ago

If you pass a path to guv start that is a file, it'll pass that to node, so guv start bin/ethercalc is like running node bin/ethercalc. If it's a directory and there's a package.json present, node with use that to work out what it should be starting.

That said, if guv start bin/ethercalc works and you are happy with running it from your home directory (or wherever that isn't under /usr/local/guvnor), then it sounds like job done.

justmwa commented 8 years ago

Actually, ethercalc != etherpad. So I need to figure out what pleases node to have guv run etherpad, although ethercalc runs fine without "main" in package.json.

justmwa commented 8 years ago

A simple start script does the job (without package.json). For some reason the same setup wouldn't work in /usr/local/guvnor, but as long as it works now, I'm happy.

achingbrain commented 8 years ago

It doesn't work in /usr/local/guvnor/EkeRZPVAd because guvnor passes /usr/local/guvnor/EkeRZPVAd as the path to load (e.g. it's like running $ node /usr/local/guvnor/EkeRZPVAd) - there's no index.js or package.json in /usr/local/guvnor/EkeRZPVAd so node has nothing to run and it fails.

In this case package.json is actually in /usr/local/guvnor/EkeRZPVAd/src but guvnor has no way of knowing that.

Anyway, glad you got it sorted.