-
Notifications
You must be signed in to change notification settings - Fork 15
tt: daemon module #129
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
tt: daemon module #129
Conversation
fd13505
to
8f6c578
Compare
7a6bc08
to
dfd9192
Compare
aac5b07
to
6bd63a1
Compare
6bd63a1
to
33d81b9
Compare
22ead1c
to
2ca4747
Compare
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.
LGTM
e8e036f
to
6768fc5
Compare
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.
Hi! Thank you for the patchset. I reviewed the patches and left a few comments. Take a look at these, and I'll continue to explore the patch set.
And rebase the branch to the master.
6768fc5
to
bf83f33
Compare
3a8fa03
to
7f67ae0
Compare
7f67ae0
to
d64e462
Compare
The watchdog process (the child) inherits copies of the parent's stdout/stderr open file descriptors. `tt start` starts instances on the background, so watchdog processes are running after `tt start` and `tt` will hang forever, because stdout fd of child process would not be closed. Part of #10
d64e462
to
08c6531
Compare
"strings" | ||
"syscall" | ||
"time" | ||
|
||
"github.com/tarantool/tt/cli/cmdcontext" | ||
"github.com/tarantool/tt/cli/config" | ||
"github.com/tarantool/tt/cli/configure" | ||
"github.com/tarantool/tt/cli/process_utils" |
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.
Why not just github.com/tarantool/tt/cli/process
?
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.
It is because we have type Process
in daemon/process.go
, having process
package and type process
in different package causes confusion.
cli/process_utils/process_utils.go
Outdated
} | ||
|
||
// StopProcess stops the process by pidFile. | ||
func StopProcess(pidFile, consoleSocket, processName string) error { |
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.
Only the PID is needed to stop the process by PID, the other arguments must not be passed.
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.
Fixed StopProcess
:
tt/cli/process_utils/process_utils.go
Lines 113 to 134 in f2224f7
// StopProcess stops the process by pidFile. | |
func StopProcess(pidFile string) (int, error) { | |
pid, err := GetPIDFromFile(pidFile) | |
if err != nil { | |
return 0, err | |
} | |
alive, err := IsProcessAlive(pid) | |
if !alive { | |
return 0, fmt.Errorf(`The process is already dead. Error: "%v".`, err) | |
} | |
if err = syscall.Kill(pid, syscall.SIGINT); err != nil { | |
return 0, fmt.Errorf(`Can't terminate the process. Error: "%v".`, err) | |
} | |
if res := waitProcessTermination(pid, 30*time.Second, 100*time.Millisecond); !res { | |
return 0, fmt.Errorf("Can't terminate the process.") | |
} | |
return pid, nil | |
} |
cli/daemon/daemon.go
Outdated
// should be found on to bind http server socket. | ||
ListenInterface string | ||
// Control UNIX socket for started instance. | ||
ConsoleSocket string |
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.
08c6531
to
3503a04
Compare
`tt daemon` module is used to manage HTTP server running on the background. HTTP server can process `tt` commands such as `start`, `status`, etc. Daemon can be configurated with `tt_daemon.yaml` config. The following set of commands is implemented: * `tt daemon start` - launch of a daemon; * `tt daemon stop` - terminate of the daemon; * `tt daemon status` - get daemon status; * `tt daemon restart` - daemon restart. Closes #10
3503a04
to
f2224f7
Compare
tt daemon
module is used to manage HTTP serverrunning on the background. HTTP server can process
tt
commands such asstart
,status
, etc.Daemon can be configurated with
tt_daemon.yaml
config.tt_daemon.yaml
file format:The following set of commands is implemented:
tt daemon start
- launch of a daemon;tt daemon stop
- terminate of the daemon;tt daemon status
- get daemon status;tt daemon restart
- daemon restart.Closes #10