[cdc_stream] Automatically start service (#28)

Starts the streaming service if it's not up and running. This required
adding the ability to run a detached process. By default, all child
processes are killed when the parent process exits. Since detached
child processes don't run with a console, they need to create sub-
processes with CREATE_NO_WINDOW since otherwise a new console pops up,
e.g. for every ssh command.

Polls for 20 seconds while the service starts up. For this purpose,
a BackgroundServiceClient is added. This will be reused in a future CL
by a new stop-service command to exit the service.

Also adds --service-port as additional argument to start-service.
This commit is contained in:
Lutz Justen
2022-12-02 14:34:36 +01:00
committed by GitHub
parent 6d63aa72d7
commit 1120dcbee0
21 changed files with 372 additions and 76 deletions

View File

@@ -23,22 +23,16 @@ import "google/protobuf/empty.proto";
service BackgroundService {
// Exit is used to ask the service to exit. In the case of the process
// manager, this cascades to all background processes.
rpc Exit(ExitRequest) returns (ExitResponse) {}
rpc Exit(google.protobuf.Empty) returns (google.protobuf.Empty) {}
// GetPid is used to get the PID of the service process.
rpc GetPid(GetPidRequest) returns (GetPidResponse) {}
rpc GetPid(google.protobuf.Empty) returns (GetPidResponse) {}
// HealthCheck is used to verify that the service is running. It returns an
// empty protobuf if the service is ready to serve requests.
rpc HealthCheck(google.protobuf.Empty) returns (google.protobuf.Empty) {}
}
message ExitRequest {}
message ExitResponse {}
message GetPidRequest {}
message GetPidResponse {
int32 pid = 1;
}