yext / edward

A tool for managing local microservice instances
http://engblog.yext.com/edward/
MIT License
171 stars 32 forks source link

edward to support "service start command" #152

Open johnzhanghua opened 6 years ago

johnzhanghua commented 6 years ago

Hi,

I am using the json below to start the mongodb,

"services": [ { "name": "mongo", "commands": { "launch": "sudo service mongod start", "stop" : "sudo service mongod stop" }, "launch_checks": null, "requiresSudo" : true, "watch": { "include": [ "mongo" ] } } ]

As as I run edward start mongo, I got the following error:

mongo > Start: [Failed] (176.66ms) runner process exited Cleanup > mongo > Stop: [Failed] (54.025µs) open /proc/8592: no such file or directory Error: runner process exited

It looks edward is expecting to check the pid 8592, but this pid could be already exited.

But ps -ef |grep mongo, shows the mongodb service is running.

mongodb 8649 1 0 16:15 ? 00:00:05 /usr/bin/mongod --config /etc/mongod.conf

Thanks, John

theothertomelliott commented 6 years ago

Because the call to service start is launching a daemon, it won't be opening a port itself. By default, Edward will expect a port to be opened before the process exits.

If you run: sudo service mongod start

At the command line, is there any output that indicates that mongodb has started successfully? If so, you can use that in a launch check: http://engblog.yext.com/edward/projectconfig/#detecting-successful-launch

johnzhanghua commented 6 years ago

Thank you @theothertomelliott . I think I can use the port check to verify.

theothertomelliott commented 6 years ago

Great, let me know if that works out ok.

Which platform are you running on? We could also look into a backend to make it eaiser to start daemons like this in the future.

johnzhanghua commented 6 years ago

I am running on ubuntu 16.04, the port check not working. The config I'm using is : "name": "mongo", "commands": { "launch": "sudo service mongod start", "stop" : "sudo service mongod stop" }, "launch_checks": { "ports": [27017] }, "requiresSudo" : true, "watch": { "include": [ "mongo" ] }