Managing of 'redeploy' #18

Open
livedata opened this Issue May 27, 2012 · 8 comments

Comments

Projects
None yet
4 participants
@ghost

ghost commented May 27, 2012

I'm wondering how do You guys are dealing with a lot of drones with ie. 3-5 processes each, and running and ie. 2 and more hubs?

For now: fleet ps; fleet stop PID; fleet stop PID; fleet stop PID; (20-30 times) and fleet deploy; fleet spawn -- node file.js; fleet spawn -- node file.js, etc... is the only way i know..

I'm managing it running a bash script from crontab (with patched fleet drone file) which starts all processes and drones after crash (processes itself or a VPS/jail crash), but when i want to 'redeploy' my project it is a pain in my... ;-)

It would be nice to create a process groups, and then using:
fleet spawn -- node foo.js --group foobar --fork 5 AND fleet stop --group foobar AND fleet redeploy --group foobar (which will do something like: fleet deploy; fleet stop --group foobar; fleet spawn -- node foo.js --group foobar --fork 5)

@ghost

ghost commented May 27, 2012

Oh, process list is writen into simple json file with dumped process details: drone CWD, used command, etc. Each 'spawn' inserts new object into file, and each 'stop' removes it... Everytime when drone is launched form scratch, spawn.json is readed and it spawns all processes again - i've created a really dirty hack for that, so i will not create any patch for now ;-)

abrkn commented May 27, 2012

how about adding a command to stop all pids for a drone?

as for the rest, i think it's hard to generalize "redeploy" without ending up with huge bloat

@ghost

ghost commented May 27, 2012

for a drone? no.. for a project/group, yes... for example, i'm using 2 sub-projects under one set of drones (4 drones), one is running with http balancer, and all of them also runs git pushover service.. it would be nice to not touch any of pushover process while updating balancer service ;-)

well, in my opinion 'redeploy' will be (as i said) stop/deploy/spawn, nothing to complicated, all things which You need to do by hand, when You want to launch latest commit. Try to use meteor deploy - http://meteor.com. It is much more simplier cause it is not git based (not good), but you can get the idea.

Merging these two projects would be just awesome: https://github.com/substack/zygote

@substack I'm wondering about this one too

You should be able to do

$ fleet exec -- pkill "node web.js"

But that somehow kills the hub, where as

$ pkill "node web.js"

doesn't...

I wrote a small helper tool that allows you to stop all running processes at once. https://github.com/nisaacson/fleet-stopall

It exposes a command-line tool so you can execute fleet-stopall in a directory which contains a fleet.json file. The module matches pids#foo lines in the output of fleet-ps and calls fleet-stop pid#foo for each one.

I sometimes have an issue where fleet-stop pid#foo did not always stop the process. I have to manually execute fleet-stop a bunch of times before the process would die. Fleet-stopall solves this by retrying the fleet-stop command until it succeeds (usually within 5 attempts)

If you want finer grained control I wrote fleet-stopregex as well. This allows you to pass a regular express to match against the pid, command, or commit

fleet-stopregex -f command node i will stop any process which has node, Node, NODE etc in their command

To re-spawn processes I wrote fleet-atc. Fleet Air Traffic Controller allows you to specify all your repos and spawn commands in a single spawn.json file. Then you can execute fleet-atc and everything in the spawn.json file will be spawned.

fleet-atc needs more work but it is a start.

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