-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
feature: restart and health #1366
Conversation
7be85a0
to
2c3710d
Compare
shouldn't this be graceful by default, and have an option or possibly a timeout, after which it is forced. |
My first thought was to have both Of course it can work both ways. Either a stop that sends a |
|
local kill = require "kong.cmd.utils.kill" | ||
local pl_stringx = require "pl.stringx" | ||
local pl_path = require "pl.path" | ||
local pl_tablex = require "pl.tablex" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please order those (I know it sounds silly but so far all new modules are ordered and as a result among many other efforts, the code is more readable).
See: https://github.com/Mashape/kong/blob/refactor/cli/kong/cmd/stop.lua#L1-L7
Also @Tieske the graceful I think that a |
local function is_running(pid_path) | ||
if not pl_path.exists(pid_path) then return nil end | ||
local code = kill(pid_path, "-0") | ||
return code == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to for the code
local.
@thefosk a forcefull stop should never be the default, quitting an app half way transactions, with open files, and connections etc. is a last resort, not a default. Default should be gracefull and blocking, with a |
6c2820c
to
959c809
Compare
Just pushed a revised version of those with more tests. |
(Of |
959c809
to
c55c981
Compare
I disagree (nginx also disagrees, $ bin/kong stop
$ ps aux | grep nginx
marco 33552 0.0 0.0 2618256 6380 ?? S 7:28PM 0:00.02 nginx: worker process
marco 33551 0.0 0.0 2610704 5480 ?? S 7:28PM 0:00.01 nginx: worker process
marco 33550 0.0 0.0 2607528 544 ?? Ss 7:28PM 0:00.00 nginx: master process /usr/local/openresty/nginx/sbin/nginx -p /usr/local/kong -c nginx.conf Which would mean that I am not even arguing that I am fine to have both |
I have added
|
it("force-leaves a node", function() | ||
assert(helpers.kong_exec("start --conf "..helpers.test_conf_path)) | ||
local _, _, stdout = assert(helpers.kong_exec("cluster force-leave 127.0.0.1 --conf "..helpers.test_conf_path)) | ||
assert.matches("left node 127.0.0.1", stdout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be
assert.matches("left node 127.0.0.1", stdout, nil, true)
Because arg #1 will be interpreted as a pattern otherwise, which means .
can be any character. Better to have sane examples to not lead to errors in the future.
true, that's why I said;
personally I find having both As an example; |
I think the graceful versions should still get a
|
Commands expecting a running Kong should not accept a --conf argument
- abstract away `is_running()` in `kill.lua` util - add missing `kong health` to `kong --help` message - some linting inherited from the base branch of this branch
3cd3ece
to
5d35ee2
Compare
Adds the
restart
andhealth
CLI commands.The
stop
command accepts an optional--graceful
parameter.