kostya / eye

Process monitoring tool. Inspired from Bluepill and God.
MIT License
1.19k stars 86 forks source link

Prevent Eye::Local.dir from being set if EYE_HOME presents #107

Closed marshall-lee closed 9 years ago

marshall-lee commented 9 years ago

Hi!

I really think that eye home directory and Eyefile must be decoupled. So if we have EYE_HOME when running leye then we should not infer eye home directory from Eyefile path.

It also can be seen that existing logic is buggy: when passing EYE_HOME to leye the .eyeconfig path is infered from home but socket_path and pid_path are not because of @dir memoization.

If interested my initial goal was to store eye's pid and socket in shared directory created by capistrano. Am I doing anything wrong?

kostya commented 9 years ago

You want to split place of Eyefile and place where stored pid, sock?

But if you set one EYE_HOME, and run multiple leyes, sock,pid files would rewrited

marshall-lee commented 9 years ago

Why should I run multiple leyes with one EYE_HOME? Typical usage of leye (as i thought) is to use separate home dirs for different projects. Or I can just run multiple leyes with one EYE_HOME but different EYE_V if i need. No problem!

kostya commented 9 years ago

I think this is ok, but you loose all handies of shell leye usage. Which was the goal of leye. you would need to write everywhere: cd /project/ && EYE_HOME=/some/path leye info, instead of cd /project && leye info better just to use EYE_V: EYE_V=some_project eye info

Upd: I understand now capistrano problem, need to think how to better do it

marshall-lee commented 9 years ago

Yes, it forces me write EYE_HOME=.... So what? The option EYE_HOME already exists and if someone wants to somehow use it then he will have to type it all the time anyway :smiley:. And since the option already exists it must work properly or should be disabled to use with leye.

marshall-lee commented 9 years ago

Спасибо! :dolphin:

kostya commented 9 years ago

What if we by default would store pid and sock in: dir(eye_file) + "/.eye", this should solve capistrano problem, .eye can be shared

marshall-lee commented 9 years ago

This is good and also it's more conventional than storing that files in current directory. Global eye uses ~/.eye but leye uses PWD/.eye — that's good!

But users already running leye in production should be somehow warned about this transition and probably the wiki article about usage with capistrano should be written. By the way, what happens when eye gem is updated? Need to manually restart it? Then there's no problem with this transition I think.

kostya commented 9 years ago

not sure that leye using anyone, it was added recently, just as toy.

With major changes need to: eye q, gem install eye, eye l ..., between minor versions not needed (and most major). With this change of sockpath, it needed. I write if it need in changes: https://github.com/kostya/eye/blob/master/CHANGES.md

grimm26 commented 9 years ago

I've started using leye in production now as a way of managing multiple eye instances for different applications on the same node. I create a file under /etc/default for each eye instance that contains the relevant ENV variables. So I can . /etc/default/eye.app1 and then run leye commands for that app. What is EYE_V?

marshall-lee commented 9 years ago

@grimm26 EYE_V is just a number. For example, if home directory is always the same (~/.eye) then EYE_V=1 and EYE_V=2 would make eye use ~/.eye/pid1+~/.eye/sock1 and ~/.eye/pid2+~/.eye/sock2 respectively.

See https://github.com/kostya/eye/wiki/What-is-loader_eye-and-leye and https://github.com/kostya/eye/blob/master/lib/eye/local.rb

kostya commented 9 years ago

pushed new 0.6.4 gem, where you can use --eyefile options, and changed leye dir to PWD/.eye (https://github.com/kostya/eye/blob/master/CHANGES.md#064), so require to restart any leye process while gem update. (leye quit && gem install eye && leye load)