kindelia / Kindelia

An efficient, secure cryptocomputer
https://kindelia.org/
603 stars 39 forks source link

kindelia node stop #225

Closed dan-da closed 1 year ago

dan-da commented 1 year ago

I was expecting to see kindelia node stop as counterpart to kindelia node start, but it doesn't exist.

Is it todo? If so, maybe I can take a stab at it.

dan-da commented 1 year ago

hmm, I think I see.

It seems that kindelia node start presently runs a node directly in the cli process.

I was expecting it to work like bitcoin et al, where the node and cli are separate processes.

Perhaps that is the plan as the modularization progresses?

developedby commented 1 year ago

The node and the cli are separate processes bundled in the same binary.

As you noticed, the kindelia node start runs the node on the foreground of your shell, but it wouldnt be hard at all to make a service file to run the node as a daemon.

If you want to use both the node and the cli tools at the same time, the easiest way right now is to run the node on one terminal and whatever tool you want in a separate terminal

steinerkelvin commented 1 year ago

Yeah, I think it is not worth thinking about daemonization now. The systemd service can be written like this. I understand most users will be running it on the foreground instead as it's easier to understand what's happening and get the errors if it crashes etc.

dan-da commented 1 year ago

even with a single process, I think it is still useful to have a node stop command that gracefully stops the node.

Otherwise, how to stop it? ctrl-c? If there is a better way, please let me know.

steinerkelvin commented 1 year ago

Ctrl-C is fine.

I mean, we are not doing any graceful stop at all (but we should, e.g. something that happens is the node will stop in the middle of writing a block to disk corrupting it (and we just ignore it when loading /shrug)). But using SIGINT (the signal your terminal emits when you type Ctrl-C) is perfectly fine: it's meant to be optionally handled by the programs, so we can intercept it and do a graceful exit.